Table of Contents

Method TryGetBarycentric

Namespace
GeometryHelper.Geometry
Assembly
GeometryHelper.dll

TryGetBarycentric(GeoPoint3, out double, out double, out double)

Gets the barycentric coordinates of a point with respect to this triangle.

public bool TryGetBarycentric(GeoPoint3 point, out double u, out double v, out double w)

Parameters

point GeoPoint3

The point to express; it need not lie on the triangle.

u double

Weight of vertex A.

v double

Weight of vertex B.

w double

Weight of vertex C.

Returns

bool

false when the triangle has no area by IsDegenerate(Tolerance) at the global tolerance, its height over its longest side within the point tolerance, in which case all three weights are zero: the triangle 100 long and 0.0005 high gives false at the default tolerance, where twice its area, 0.05, read against the vector tolerance gave true. The containment of a point in a triangle reads it at the tolerance it is asked within instead. A point with a coordinate that is not a finite number gives false too, where it was given weights of NaN.

Remarks

The point is projected onto the triangle plane first, so a point off the plane gets the coordinates of its projection. The three weights always sum to one, and all three are non-negative exactly when the projection falls inside the triangle.