Ocean
|
This class implements a 3D triangle. More...
Public Member Functions | |
TriangleT3 () | |
Creates a new triangle object with default parameters. More... | |
TriangleT3 (const VectorT3< T > &point0, const VectorT3< T > &point1, const VectorT3< T > &point2) | |
Creates a new triangle object by three given corners. More... | |
const VectorT3< T > & | point0 () const |
Returns the first point of this triangle. More... | |
const VectorT3< T > & | point1 () const |
Returns the second point of this triangle. More... | |
const VectorT3< T > & | point2 () const |
Returns the third point of this triangle. More... | |
VectorT3< T > | barycentric2cartesian (const VectorT3< T > &barycentric) const |
Returns the 3D cartesian coordinate of a given barycentric coordinate defined in relation to this triangle. More... | |
bool | hasIntersection (const LineT3< T > &ray) const |
Returns whether a given ray has an intersection with this triangle. More... | |
bool | intersection (const LineT3< T > &ray, VectorT3< T > &point, T &distance) const |
Returns whether a given ray has an intersection with this triangle and determines the intersection point. More... | |
bool | intersection (const LineT3< T > &ray, VectorT3< T > &point, VectorT3< T > &barycentric, T &distance) const |
Returns whether a given ray has an intersection with this triangle and determines the intersection point. More... | |
bool | intersection (const LineT3< T > &ray, LineT3< T > &reflection, T &distance) const |
Returns whether a given ray has an intersection with this triangle and determines the reflective ray starting at the intersection point. More... | |
bool | intersection (const LineT3< T > &ray, LineT3< T > &reflection, T &distance, VectorT3< T > &normal) const |
Returns whether a given ray has an intersection with this triangle and determines the reflective ray starting at the intersection point. More... | |
bool | frontIntersection (const LineT3< T > &ray, const VectorT3< T > &normal, LineT3< T > &reflection, T &distance) const |
Returns whether a given ray has a front intersection with this triangle and determines the reflective ray starting at the intersection point. More... | |
bool | frontIntersection (const LineT3< T > &ray, const VectorT3< T > &normal0, const VectorT3< T > &normal1, const VectorT3< T > &normal2, LineT3< T > &reflection, T &distance) const |
Returns whether a given ray has a front intersection with this triangle and determines the reflective ray starting at the intersection point. More... | |
bool | frontIntersection (const LineT3< T > &ray, const VectorT3< T > &normal0, const VectorT3< T > &normal1, const VectorT3< T > &normal2, LineT3< T > &reflection, T &distance, VectorT3< T > &normal) const |
Returns whether a given ray has a front intersection with this triangle and determines the reflective ray starting at the intersection point. More... | |
bool | planeIntersection (const LineT3< T > &ray, VectorT3< T > &barycentric) const |
Returns the intersection point with a given ray and a plane that is spanned by this triangle. More... | |
bool | isValid () const |
Returns whether this triangle is valid. More... | |
const VectorT3< T > & | operator[] (const unsigned int index) const |
Returns individual triangle corners. More... | |
TriangleT3< T > | operator+ (const VectorT3< T > &offset) const |
Shifts the triangle by a given 3D vector (by adding the vector to all three corners of the triangle). More... | |
TriangleT3< T > & | operator+= (const VectorT3< T > &offset) |
Shifts the triangle by a given 3D vector (by adding the vector to all three corners of the triangle). More... | |
TriangleT3< T > | operator- (const VectorT3< T > &offset) const |
Shifts the triangle by a given 3D vector (by subtracting the vector from all three corners of the triangle). More... | |
TriangleT3< T > & | operator-= (const VectorT3< T > &offset) |
Shifts the triangle by a given 3D vector (by subtracting the vector from all three corners of the triangle). More... | |
Private Attributes | |
VectorT3< T > | trianglePoints [3] |
Three triangle points. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Ocean::TriangleT< T > | |
static bool | isBarycentricInside (const VectorT3< T > &barycentricPoint) |
Returns whether a given point, specified as barycentric coordinate, lies inside a triangle. More... | |
static bool | isValidBarycentric (const VectorT3< T > &barycentric, const T &epsilon=NumericT< T >::eps()) |
Returns whether the a barycentric coordinate is valid. More... | |
This class implements a 3D triangle.
|
inline |
Creates a new triangle object with default parameters.
|
inline |
Creates a new triangle object by three given corners.
point0 | First triangle point |
point1 | Second triangle point |
point2 | Third triangle point |
|
inline |
Returns the 3D cartesian coordinate of a given barycentric coordinate defined in relation to this triangle.
barycentric | Barycentric coordinate to convert to a cartesian coordinate |
|
inline |
Returns whether a given ray has a front intersection with this triangle and determines the reflective ray starting at the intersection point.
An explicit reflection normal is used.
ray | Ray to determine whether an intersection occurs |
normal | Reflection normal |
reflection | Resulting reflection ray, if an intersection occurs |
distance | Resulting intersection distance |
|
inline |
Returns whether a given ray has a front intersection with this triangle and determines the reflective ray starting at the intersection point.
The reflection normal is determined by interpolation of the given three point normals.
ray | Ray to determine whether an intersection occurs |
normal0 | Normal of the first triangle point |
normal1 | Normal of the second triangle point |
normal2 | Normal of the third triangle point |
reflection | Resulting reflection ray, if an intersection occurs |
distance | Resulting intersection distance |
|
inline |
Returns whether a given ray has a front intersection with this triangle and determines the reflective ray starting at the intersection point.
The reflection normal is determined by interpolation of the given three point normals.
ray | Ray to determine whether an intersection occurs |
normal0 | Normal of the first triangle point |
normal1 | Normal of the second triangle point |
normal2 | Normal of the third triangle point |
reflection | Resulting reflection ray, if an intersection occurs |
distance | Resulting intersection distance |
normal | Resulting normal |
|
inline |
Returns whether a given ray has an intersection with this triangle.
ray | Ray to determine whether an intersection occurs |
bool Ocean::TriangleT3< T >::intersection | ( | const LineT3< T > & | ray, |
LineT3< T > & | reflection, | ||
T & | distance | ||
) | const |
Returns whether a given ray has an intersection with this triangle and determines the reflective ray starting at the intersection point.
The reflection normal is determined by the triangle.
ray | Ray to determine whether an intersection occurs |
reflection | Resulting reflection ray, if an intersection occurs |
distance | Resulting intersection distance |
bool Ocean::TriangleT3< T >::intersection | ( | const LineT3< T > & | ray, |
LineT3< T > & | reflection, | ||
T & | distance, | ||
VectorT3< T > & | normal | ||
) | const |
Returns whether a given ray has an intersection with this triangle and determines the reflective ray starting at the intersection point.
The reflection normal is determined by the triangle.
ray | Ray to determine whether an intersection occurs |
reflection | Resulting reflection ray, if an intersection occurs |
distance | Resulting intersection distance |
normal | Resulting normal |
bool Ocean::TriangleT3< T >::intersection | ( | const LineT3< T > & | ray, |
VectorT3< T > & | point, | ||
T & | distance | ||
) | const |
Returns whether a given ray has an intersection with this triangle and determines the intersection point.
ray | Ray to determine whether an intersection occurs |
point | Resulting intersection point, if an intersection occurs |
distance | Resulting intersection distance |
bool Ocean::TriangleT3< T >::intersection | ( | const LineT3< T > & | ray, |
VectorT3< T > & | point, | ||
VectorT3< T > & | barycentric, | ||
T & | distance | ||
) | const |
Returns whether a given ray has an intersection with this triangle and determines the intersection point.
ray | Ray to determine whether an intersection occurs |
point | Resulting intersection point, if an intersection occurs |
barycentric | Resulting Barycentric intersection point |
distance | Resulting intersection distance |
|
inline |
Returns whether this triangle is valid.
|
inline |
Shifts the triangle by a given 3D vector (by adding the vector to all three corners of the triangle).
offset | The offset vector to shift the triangle |
|
inline |
Shifts the triangle by a given 3D vector (by adding the vector to all three corners of the triangle).
offset | The offset vector to shift the triangle |
|
inline |
Shifts the triangle by a given 3D vector (by subtracting the vector from all three corners of the triangle).
offset | The offset vector to shift the triangle |
|
inline |
Shifts the triangle by a given 3D vector (by subtracting the vector from all three corners of the triangle).
offset | The offset vector to shift the triangle |
|
inline |
Returns individual triangle corners.
index | Index of the corner that is requested, with range [0, 2] |
bool Ocean::TriangleT3< T >::planeIntersection | ( | const LineT3< T > & | ray, |
VectorT3< T > & | barycentric | ||
) | const |
Returns the intersection point with a given ray and a plane that is spanned by this triangle.
ray | Ray to determine whether an intersection occurs |
barycentric | Resulting Barycentric intersection point |
|
inline |
Returns the first point of this triangle.
|
inline |
Returns the second point of this triangle.
|
inline |
Returns the third point of this triangle.
|
private |
Three triangle points.