19 PH_ASSERT_GT(radius,
static_cast<T
>(0));
31 const auto surfacePos2D = sampleToSurface2D(sample);
32 return TVector3<T>(surfacePos2D.y,
static_cast<T
>(0), surfacePos2D.x);
38 const auto surfacePos2D = sampleToSurface2D(sample, out_pdfA);
39 return TVector3<T>(surfacePos2D.y,
static_cast<T
>(0), surfacePos2D.x);
45 PH_ASSERT_IN_RANGE_INCLUSIVE(sample[0],
static_cast<T
>(0),
static_cast<T
>(1));
46 PH_ASSERT_IN_RANGE_INCLUSIVE(sample[1],
static_cast<T
>(0),
static_cast<T
>(1));
47 PH_ASSERT_GE(m_radius,
static_cast<T
>(0));
49 const T r = std::sqrt(sample[0]);
56 return localUnitPos.mul(m_radius);
63 *out_pdfA = uniformSamplePdfA();
65 return sampleToSurface2D(sample);
70 const std::array<T, 2>& sample,
74 const auto& diskPos2d = sampleToSurface2D(sample);
77 return (basis.getZAxis() * diskPos2d.x) +
78 (basis.getXAxis() * diskPos2d.y) +
84 const std::array<T, 2>& sample,
90 *out_pdfA = uniformSamplePdfA();
92 return sampleToSurfaceOriented(sample, normal, offset);
99 return static_cast<T
>(1) / getArea();
A 2-D disk with normal facing up (0, 1, 0).
Definition TDisk.h:19
TVector3< T > sampleToSurfaceOriented(const std::array< T, 2 > &sample, const TVector3< T > &normal=TVector3< T >(0, 1, 0), const TVector3< T > &offset=TVector3< T >(0)) const
Definition TDisk.ipp:69
T getArea() const
Definition TDisk.ipp:23
TVector3< T > sampleToSurface(const std::array< T, 2 > &sample) const
Definition TDisk.ipp:29
static TDisk makeUnit()
Definition TDisk.ipp:10
TVector2< T > sampleToSurface2D(const std::array< T, 2 > &sample) const
Definition TDisk.ipp:43
static TOrthonormalBasis3 makeFromUnitY(const TVector3< T > &unitYAxis)
Definition TOrthonormalBasis3.ipp:16
Represents a 2-D vector.
Definition TVector2.h:19
Represents a 3-D vector.
Definition TVector3.h:17
constexpr T two_pi
Value of .
Definition constant.h:27
constexpr T pi
Value of .
Definition constant.h:15
Math functions and utilities.
Definition TransformInfo.h:10