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

Method sample

tutorials/convert/distribution2d.cpp:40–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 }
39
40 Vec2f Distribution2D::sample(const Vec2f& u) const
41 {
42 /*! use u.y to sample a row */
43 float sy = yDist.sample(u.y);
44 int idx = clamp(int(sy),0,int(height)-1);
45
46 /*! use u.x to sample inside the row */
47 float sx = xDists[idx].sample(u.x);
48 return Vec2f(sx,sy);
49 }
50
51 float Distribution2D::pdf(const Vec2f& p) const {
52 int idx = clamp(int(p.y*height),0,int(height)-1);

Callers 1

instantiateMethod · 0.45

Calls 1

clampFunction · 0.50

Tested by

no test coverage detected