TriangleLocationDetail Class

Carries data about a location in the plane of a triangle.

  • Each instance carries both world and barycentric coordinates for the point, and provides query services on the latter.
  • No tolerance is used when querying barycentric coordinates (e.g., isInsideOrOn, classify). Use snapLocationToEdge to adjust the barycentric coordinates to a triangle edge if they lie within a distance or parametric tolerance.

Properties of the barycentric coordinates (b0, b1, b2) of a point p in the plane of a triangle T with vertices v0, v1, v2:

  • 1 = b0 + b1 + b2
  • p = b0 * v0 + b1 * v1 + b2 * v2
  • If T is spanned by the vectors U = v1 - v0 and V = v2 - v0, then the vector P = p - v0 can be written P = b1 * U + b2 * V.
  • The coordinates are all nonnegative if and only if p is inside or on T.
  • Exactly one coordinate is zero if and only if p lies on an (infinitely extended) edge of T.
  • Exactly two coordinates are zero if and only if p coincides with a vertex of T.
  • Note that if p can be written as a linear combination of the vertices of T using scales that do NOT sum to 1, then p is not coplanar with T

Methods

Name Description
copyContentsFrom(other: TriangleLocationDetail): void Set the instance contents from the other detail.  
invalidate(): void Invalidate this detail (set all attributes to zero) .  
create(result?: TriangleLocationDetail): TriangleLocationDetail Static Create an invalid detail.  

Properties

Name Type Description
a number Application-specific number  
classify Accessor ReadOnly PolygonLocation Queries this detail to classify the location of this instance with respect to the triangle.  
closestEdgeIndex number Index of the triangle vertex at the start of the closest edge to p.  
closestEdgeParam number The parameter f along the closest edge to p of its projection q.  
isInsideOrOn Accessor ReadOnly boolean Queries the barycentric coordinates to determine whether this instance specifies a location inside or  
isValid Accessor ReadOnly boolean Whether this detail is invalid.  
local Point3d The barycentric coordinates of p with respect to the triangle.  
world Point3d The Cartesian coordinates of the point p.  

Defined in

Last Updated: 28 October, 2024