Photon Engine 2.0.0-beta
A physically based renderer.
|
Basic 3-D triangle functionalities. More...
#include <TBasicTriangle.h>
Public Member Functions | |
TBasicTriangle (TVector3< T > vA, TVector3< T > vB, TVector3< T > vC) | |
TBasicTriangle (std::array< TVector3< T >, 3 > vertices) | |
T | getArea () const |
TVector3< T > | getFaceNormal () const |
TVector3< T > | getCentroid () const |
TAABB3D< T > | getAABB () const |
T | getAspectRatio () const |
Calculate aspect ratio of this triangle. For a triangle, its aspect ratio is defined to be the ratio of the circumradius to twice the inradius. The higher the aspect ratio, the narrower the shape of the triangle. A triangle with extreme aspect ratio will look like a needle. The smallest aspect ratio possible is 1 (an equilateral triangle), while the largest possible aspect ratio is infinity (degenerate). | |
TVector3< T > | safeGetFaceNormal (const TVector3< T > &failSafe={0, 1, 0}) const |
Calculate face normal with a fail-safe value. The vertices may form a degenerate triangle (zero cross product and thus producing NaNs after being normalized, or vertices with Inf/NaN), in such case the fail-safe vector will be returned. | |
std::pair< TVector3< T >, TVector3< T > > | getEdgeVectors () const |
TVector3< T > | surfaceToBarycentric (const TVector3< T > &position) const |
TVector3< T > | barycentricToSurface (const TVector3< T > &barycentricCoords) const |
TVector3< T > | sampleToBarycentricOsada (const std::array< T, 2 > &sample) const |
Map the 2D sample to a position on the surface of the triangle. A common mapping on triangles which is based on slicing the triangular area into stripes. The mapped positions (after being converted from barycentric coordinates) are distributed uniformly if the sample is uniform. Reference: Osada et al., Section 4.2, "Shape Distributions", TOG02. | |
TVector3< T > | sampleToBarycentricOsada (const std::array< T, 2 > &sample, T *out_pdfA) const |
T | uniformSurfaceSamplePdfA () const |
bool | isDegenerate () const |
TVector3< T > | getVa () const |
TVector3< T > | getVb () const |
TVector3< T > | getVc () const |
Static Public Member Functions | |
static TVector3< T > | interpolate (const std::array< TVector3< T >, 3 > &attributes, const TVector3< T > &barycentricCoords) |
static TVector3< T > | interpolate (const TVector3< T > &attributeA, const TVector3< T > &attributeB, const TVector3< T > &attributeC, const TVector3< T > &barycentricCoords) |
static bool | calcSurfaceParamDerivatives (const std::array< TVector3< T >, 3 > &attributes, const std::array< TVector2< T >, 3 > ¶meterizations, TVector3< T > *out_dXdU, TVector3< T > *out_dXdV) |
Protected Member Functions | |
PH_DEFINE_INLINE_RULE_OF_5_MEMBERS (TBasicTriangle) | |
Basic 3-D triangle functionalities.
The class is not intended to be used polymorphically.
|
inline |
|
inlineexplicit |
|
inline |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
Calculate aspect ratio of this triangle. For a triangle, its aspect ratio is defined to be the ratio of the circumradius to twice the inradius. The higher the aspect ratio, the narrower the shape of the triangle. A triangle with extreme aspect ratio will look like a needle. The smallest aspect ratio possible is 1 (an equilateral triangle), while the largest possible aspect ratio is infinity (degenerate).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
protected |
|
inline |
Calculate face normal with a fail-safe value. The vertices may form a degenerate triangle (zero cross product and thus producing NaNs after being normalized, or vertices with Inf/NaN), in such case the fail-safe vector will be returned.
failSafe | The value to use when the face normal cannot be obtained. |
failSafe
.
|
inline |
Map the 2D sample to a position on the surface of the triangle. A common mapping on triangles which is based on slicing the triangular area into stripes. The mapped positions (after being converted from barycentric coordinates) are distributed uniformly if the sample is uniform. Reference: Osada et al., Section 4.2, "Shape Distributions", TOG02.
|
inline |
An overload with PDF. Expected the input sample
to be uniform.
|
inline |
|
inline |