BarycentricCoordinates¶
struct BarycentricCoordinates
Represents barycentric coordinates between a point and 3 vertices of a triangle.
Functions¶
Name | Description |
---|---|
RayTriangleIntersection | Computes the barycentric coordinates of the intersection of a ray with a triangle. |
BarycentricCoordinates | Default constructor. |
BarycentricCoordinates | Computes barycentric coordinates from a position and a triangle. |
IsValid | Checks whether the coordinates are valid. |
Function Details¶
BarycentricCoordinates¶
BarycentricCoordinates()
Default constructor.
BarycentricCoordinates(const AmVec3& position, const std::array<AmVec3, 3>& triangle)
Computes barycentric coordinates from a position and a triangle.
- Parameter
position
- The position of the intersection.
- Parameter
triangle
- The triangle.
IsValid¶
[[nodiscard]] bool IsValid() const
Checks whether the coordinates are valid.
- Return
true
if the coordinates are valid,false
otherwise.
RayTriangleIntersection¶
static bool RayTriangleIntersection( const AmVec3& rayOrigin, const AmVec3& rayDirection, const std::array<AmVec3, 3>& triangle, BarycentricCoordinates& result)
Computes the barycentric coordinates of the intersection of a ray with a triangle.
- Parameter
rayOrigin
- The origin of the ray.
- Parameter
rayDirection
- The direction of the ray.
- Parameter
triangle
- The vertices of the triangle.
- Parameter
result
- The result of the intersection.
- Return
true
if the ray intersects the triangle,false
otherwise.