[RhinoCommon] Barycentric coordinates

Recently, I have been using the ClosestPoint method of a Mesh that returns a MeshPoint. In the documentation, I read the following about the barycentric coordinates:

Barycentric quad coordinates for the point on the mesh
face mesh.Faces[FaceIndex].  If the face is a triangle
disregard T[3] (it should be set to 0.0). If the face is
a quad and is split between vertexes 0 and 2, then T[3]
will be 0.0 when point is on the triangle defined by vi[0],
vi[1], vi[2] and T[1] will be 0.0 when point is on the
triangle defined by vi[0], vi[2], vi[3]. If the face is a
quad and is split between vertexes 1 and 3, then T[2] will
be -1 when point is on the triangle defined by vi[0],
vi[1], vi[3] and m_t[0] will be -1 when point is on 
triangle defined by vi[1], vi[2], vi[3].            

(see http://4.rhino3d.com/5/rhinocommon/html/AllMembers_T_Rhino_Geometry_MeshPoint.htm)

This seems to be a half-literal copy of the comments of ON_MESH_POINT in the C++ SDK.

Anyway: what I’m wondering about is the values of -1 in the comments. First of all, I never see values of -1 and I wonder if returning -1 is actually correct for this.

Can you look up if the return value of -1 is ever returned, and under what circumstances?

Hi Menno,

The documentation is incorrect, as the -1 values should be 0. I’ll see that the comments are fixed.

– Dale

1 Like