Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::math::TWatertightTriangle< T > Class Template Referencefinal

#include <TWatertightTriangle.h>

Inheritance diagram for ph::math::TWatertightTriangle< T >:
ph::math::TBasicTriangle< T >

Public Member Functions

bool isIntersecting (const TLineSegment< T > &segment, T *out_hitT, TVector3< T > *out_hitBarycentricCoords) const
 Checks whether the segment is interseting with this triangle.
 
- Public Member Functions inherited from ph::math::TBasicTriangle< T >
 TBasicTriangle (TVector3< T > vA, TVector3< T > vB, TVector3< T > vC)
 
 TBasicTriangle (std::array< TVector3< T >, 3 > vertices)
 
getArea () const
 
TVector3< T > getFaceNormal () const
 
TVector3< T > getCentroid () const
 
TAABB3D< T > getAABB () const
 
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
 
uniformSurfaceSamplePdfA () const
 
bool isDegenerate () const
 
TVector3< T > getVa () const
 
TVector3< T > getVb () const
 
TVector3< T > getVc () const
 

Additional Inherited Members

- Static Public Member Functions inherited from ph::math::TBasicTriangle< T >
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 > &parameterizations, TVector3< T > *out_dXdU, TVector3< T > *out_dXdV)
 
- Protected Member Functions inherited from ph::math::TBasicTriangle< T >
 PH_DEFINE_INLINE_RULE_OF_5_MEMBERS (TBasicTriangle)
 

Member Function Documentation

◆ isIntersecting()

template<typename T >
bool ph::math::TWatertightTriangle< T >::isIntersecting ( const TLineSegment< T > & segment,
T * out_hitT,
TVector3< T > * out_hitBarycentricCoords ) const
inline

Checks whether the segment is interseting with this triangle.

Parameters
segmentThe line section to intersect with.
[out]out_hitTThe parametric distance of the hit point for segment.
[out]out_hitBarycentricCoordsThe barycentric coordinates of the hit point for this triangle.
Note
It is advisible to use out_hitBarycentricCoodrs to calculate the hit point as the numerical error will generally be smaller than using out_hitT.

The documentation for this class was generated from the following files: