MCPcopy Create free account
hub / github.com/RenderKit/embree / init

Method init

tutorials/convert/distribution2d.cpp:17–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 }
16
17 void Distribution2D::init(const float* f, const size_t w, const size_t h)
18 {
19 /*! create arrays */
20 width = w; height = h;
21 xDists.resize(height);
22 std::vector<float> fy(height);
23
24 /*! compute y distribution and initialize row distributions */
25 for (size_t y=0; y<height; y++)
26 {
27 /*! accumulate row to compute y distribution */
28 fy[y] = 0.0f;
29 for (size_t x=0; x<width; x++)
30 fy[y] += f[y*w+x];
31
32 /*! initialize distribution for current row */
33 xDists[y].init(f+y*width, width);
34 }
35
36 /*! initializes the y distribution */
37 yDist.init(fy.data(), height);
38 }
39
40 Vec2f Distribution2D::sample(const Vec2f& u) const
41 {

Calls 2

resizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected