Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TDisk.h
Go to the documentation of this file.
1#pragma once
2
3#include "Math/TVector2.h"
4#include "Math/TVector3.h"
5#include "Math/constant.h"
6
7#include <Common/assertion.h>
8
9#include <cmath>
10#include <array>
11
12namespace ph::math
13{
14
17template<typename T>
18class TDisk final
19{
20public:
21 static TDisk makeUnit();
22
23 TDisk() = default;
24 explicit TDisk(T radius);
25
26 T getArea() const;
27
28 TVector3<T> sampleToSurface(const std::array<T, 2>& sample) const;
29 TVector3<T> sampleToSurface(const std::array<T, 2>& sample, T* out_pdfA) const;
30
31 TVector2<T> sampleToSurface2D(const std::array<T, 2>& sample) const;
32 TVector2<T> sampleToSurface2D(const std::array<T, 2>& sample, T* out_pdfA) const;
33
35 const std::array<T, 2>& sample,
36 const TVector3<T>& normal = TVector3<T>(0, 1, 0),
37 const TVector3<T>& offset = TVector3<T>(0)) const;
38
40 const std::array<T, 2>& sample,
41 T* out_pdfA,
42 const TVector3<T>& normal = TVector3<T>(0, 1, 0),
43 const TVector3<T>& offset = TVector3<T>(0)) const;
44
45private:
46 T m_radius;
47
48 T uniformSamplePdfA() const;
49};
50
51}// end namespace ph::math
52
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
TDisk()=default
Represents a 2-D vector.
Definition TVector2.h:19
Represents a 3-D vector.
Definition TVector3.h:17
Math functions and utilities.
Definition TransformInfo.h:10