Visual Computing Library
|
The TriangleWrapper class is a wrapper around a N-Dimensional triangle. More...
#include <vclib/space/core/triangle_wrapper.h>
Public Types | |
using | ScalarType = PointT::ScalarType |
using | PointType = PointT |
Public Member Functions | |
TriangleWrapper (const PointT &p0, const PointT &p1, const PointT &p2) | |
Constructs a triangle wrapper around the three input points. | |
constexpr uint | size () const |
Returns the number of points of the triangle. | |
const PointT & | point (uint i) const |
const PointT & | point0 () const |
const PointT & | point1 () const |
const PointT & | point2 () const |
ScalarType | sideLength (uint i) const |
Returns the length of the i-th side of the triangle. | |
ScalarType | sideLength0 () const |
Returns the length of the first side of the triangle. | |
ScalarType | sideLength1 () const |
Returns the length of the second side of the triangle. | |
ScalarType | sideLength2 () const |
Returns the length of the third side of the triangle. | |
PointT | normal () const |
Returns the normal of the triangle. | |
PointT | barycenter () const |
Computes the barycenter of the triangle. | |
PointT | weightedBarycenter (ScalarType w0, ScalarType w1, ScalarType w2) const |
Computes the weighted barycenter of the triangle. | |
PointT | weightedBarycenter (const Point3< ScalarType > &w) const |
Computes the weighted barycenter of the triangle. | |
PointT | barycentricCoordinatePoint (ScalarType b0, ScalarType b1, ScalarType b2) const |
PointT | barycentricCoordinatePoint (const Point3< ScalarType > &b) const |
PointT | circumcenter () const |
Compute the circumcenter of the triangle. | |
ScalarType | perimeter () const |
Computes the perimeter of the triangle. | |
ScalarType | area () const |
Computes the area of the triangle. | |
ScalarType | quality () const |
Calculates the quality measure of the triangle. | |
ScalarType | qualityRadii () const |
Compute a shape quality measure of the triangle. | |
ScalarType | qualityMeanRatio () const |
Compute the mean ratio of the triangle shape quality measure. | |
Static Public Attributes | |
static const uint | DIM = PointT::DIM |
Dimension of the triangle. | |
Private Attributes | |
const PointT & | mPoint0 |
const PointT & | mPoint1 |
const PointT & | mPoint2 |
The TriangleWrapper class is a wrapper around a N-Dimensional triangle.
The dimension of the triangle is determined by the dimension of the points it is composed of.
The class does not store the triangle points, but it provides a wrapper around them. This class is useful when the triangle points are already stored somewhere else and the user does not want to copy them, but have access to the a triangle interface.
This means that the TriangleWrapper object must live as long as the points it wraps. If the points are destroyed, the TriangleWrapper object becomes invalid.
This class cannot be copied or moved, and has just one constructor that takes three points as input. The points are passed by const reference, and their references are stored inside the class.
|
inline |
Constructs a triangle wrapper around the three input points.
The input points are not copied, and this class just stores their references.
[in] | p0 | first point of the triangle. |
[in] | p1 | second point of the triangle. |
[in] | p2 | third point of the triangle. |
|
inline |
Computes the area of the triangle.
|
inline |
Computes the barycenter of the triangle.
|
inline |
|
inline |
|
inline |
Compute the circumcenter of the triangle.
The function computes the circumcenter of the triangle, which is the center of the circle that passes through the three vertices of the triangle. The circumcenter is defined as the intersection of the perpendicular bisectors of the three sides of the triangle.
|
inline |
Returns the normal of the triangle.
|
inline |
Computes the perimeter of the triangle.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Calculates the quality measure of the triangle.
The quality measure is computed as 2 times the triangle's area divided by the square of the length of its longest edge. The resulting value is in the range [0.0, 0.866], where 0.0 represents a degenerate triangle and 0.866 represents an equilateral triangle.
|
inline |
Compute the mean ratio of the triangle shape quality measure.
The function computes the mean ratio shape quality measure of the triangle. The mean ratio is defined as 2 * sqrt(a * b) / (a + b), where a and b are the eigenvalues of the M^tM transformation matrix into a regular simplex. The mean ratio is a scalar value in the range [0, 1] that describes the triangle quality, where 0 means the triangle is degenerate, and 1 means it is perfectly equilateral.
|
inline |
Compute a shape quality measure of the triangle.
This function computes the quality measure of a triangle based on the ratio between its inradius and circumradius.
|
inline |
Returns the length of the i-th side of the triangle.
[in] | i | Index of the side. |
|
inline |
Returns the length of the first side of the triangle.
|
inline |
Returns the length of the second side of the triangle.
|
inline |
Returns the length of the third side of the triangle.
|
inlineconstexpr |
Returns the number of points of the triangle.
|
inline |
Computes the weighted barycenter of the triangle.
Given three weights corresponding to the three triangle points, this function computes the weighted barycenter of the triangle.
[in] | w0 | The weight of the first point of the triangle. |
[in] | w1 | The weight of the second point of the triangle. |
[in] | w2 | The weight of the third point of the triangle. |
|
inline |
Computes the weighted barycenter of the triangle.
Given three weights corresponding to the three triangle points, this function computes the weighted barycenter of the triangle.
[in] | w0 | The weight of the first point of the triangle. |
[in] | w1 | The weight of the second point of the triangle. |
[in] | w2 | The weight of the third point of the triangle. |