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 is degenerate, in which case all three weights are zero.

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.