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 snapLocalToEdge to adjust the barycentric coordinates to a triangle edge if they lie within a parametric tolerance.

Properties of the barycentric coordinates (b0, b1, b2) of a point p in the plane of a triangle T with vertices p0, p1, p2:

  • 1 = b0 + b1 + b2
  • p = b0 * p0 + b1 * p1 + b2 * p2
  • If T is spanned by the vectors U=p1-p0 and V=p2-p0, then the vector P=p-p0 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.

Methods

Name Description
copyContentsFrom(other: TriangleLocationDetail): void Set the instance contents from the other detail.  
invalidate(): void Invalidate this detail.  
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 base of the edge closest to p.  
closestEdgeParam number The parameter along the closest edge of the projection of p.  
isInsideOrOn Accessor ReadOnly boolean Queries the barycentric coordinates to determine whether this instance specifies a location inside or on the triangle.  
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: 20 June, 2023