Template Class Triangle
Defined in File Triangle.hpp
Class Documentation
-
template<typename Vec = Eigen::Vector3f, typename Scalar = float>
class Triangle Represents a triangle, allows for computation of barycentric coordinates.
Public Functions
-
Triangle(Vec a, Vec b, Vec c)
Construct a new Triangle object.
- Parameters:
a – a point in clockwise order
b – a point in clockwise order
c – a point in clockwise order
-
Triangle(const std::array<Vec, 3UL> &array)
Construct a new Triangle object.
- Parameters:
array – An array containing 3 Vec objects
-
inline Scalar area() const
Returns the precalculated area of this Triangle.
- Returns:
Scalar Area of the Triangle
-
BarycentricCoords barycentric(Vec point) const
Calculates the barycentric coordinates of a point with respect to this triangle. Use point(BarycentricCoords) to do the opposite.
- Parameters:
point –
- Returns:
BarycentricCoords
-
Vec point(BarycentricCoords barycentric) const
Calculates the cartesian coordinates from barycentric coordinates.
- Parameters:
barycentric –
- Returns:
Vec
-
std::pair<Vec, Vec> getAABoundingBox() const
Returns the min and max corners of the axis aligned bounding box.
- Returns:
std::pair<Vec, Vec> first is the min corner and second the max corner
-
bool contains(Vec point) const
Calculates if a point lies within the triangle.
- Parameters:
point –
- Returns:
true
- Returns:
false
-
Triangle(Vec a, Vec b, Vec c)