|
template<typename Node , typename T = std::decay_t<decltype(*std::begin(std::declval<Node>()))>, typename = std::enable_if_t<std::is_scalar_v<T>>> |
static constexpr auto | area (const Node &n0, const Node &n1, const Node &n2) |
| Compute the area of a triangle. More...
|
|
template<typename Node , typename T = std::decay_t<decltype(*std::begin(std::declval<Node>()))>, typename = std::enable_if_t<std::is_scalar_v<T>>> |
static constexpr auto | getBarycentricCoordinates (const Node &p0, const Node &n0, const Node &n1, const Node &n2) |
| Compute the barycentric coordinates of the input point in the Triangle. It can be interpreted as masses placed at the vertices of Triangle (n0, n1, n2), such that the point is the center of mass of these masses. More...
|
|
template<typename Node , typename T = std::decay_t<decltype(*std::begin(std::declval<Node>()))>, typename = std::enable_if_t<std::is_scalar_v<T>>> |
static constexpr auto | normal (const Node &n0, const Node &n1, const Node &n2) |
| Compute the normal of a triangle. More...
|
|
template<typename Node , typename T = std::decay_t<decltype(*std::begin(std::declval<Node>()))>, typename = std::enable_if_t<std::is_scalar_v<T>>> |
static constexpr bool | isPointInTriangle (const Node &p0, const Node &n0, const Node &n1, const Node &n2, sofa::type::Vec< 3, T > &baryCoefs) |
| Test if input point is inside Triangle (n0, n1, n2) using Triangle. More...
|
|
template<typename TReal > |
static constexpr bool | rayIntersection (const sofa::type::Vec< 3, TReal > &n0, const sofa::type::Vec< 3, TReal > &n1, const sofa::type::Vec< 3, TReal > &n2, const sofa::type::Vec< 3, TReal > &origin, const sofa::type::Vec< 3, TReal > &direction, TReal &t, TReal &u, TReal &v) |
| Test if a ray intersects a triangle, and gives barycentric coordinates of the intersection if applicable. More...
|
|
template<typename TReal > |
static constexpr bool | rayIntersection (const sofa::type::Vec< 3, TReal > &n0, const sofa::type::Vec< 3, TReal > &n1, const sofa::type::Vec< 3, TReal > &n2, const sofa::type::Vec< 3, TReal > &origin, const sofa::type::Vec< 3, TReal > &direction) |
| Test if a ray intersects a triangle. More...
|
|
template<typename Node , typename T = std::decay_t<decltype(*std::begin(std::declval<Node>()))>, typename = std::enable_if_t<std::is_scalar_v<T>>>
static constexpr auto sofa::geometry::Triangle::getBarycentricCoordinates |
( |
const Node & |
p0, |
|
|
const Node & |
n0, |
|
|
const Node & |
n1, |
|
|
const Node & |
n2 |
|
) |
| |
|
inlinestaticconstexpr |
Compute the barycentric coordinates of the input point in the Triangle. It can be interpreted as masses placed at the vertices of Triangle (n0, n1, n2), such that the point is the center of mass of these masses.
- Template Parameters
-
Node | iterable container |
T | scalar |
- Parameters
-
p0 | position of the input point to compute the coefficients |
n0,n1,n2 | nodes of the triangle |
- Returns
- sofa::type::Vec<3, T> barycentric coefficients of each vertex of the Triangle. These masses can be zero or negative; they are all positive if and only if the point is inside the Triangle.