How to compute a surface point half way of two others in Geometry Central?
Opened this issue · 1 comments
dpar39 commented
Say I have SurfacePoint
p1 and p2 defined in two edges of the same triangular face. How can I compute a SurfacePoint
p that lies in the face and it is half-way between p1 and p2?
I can use SurfacePoint::interpolate(geometry.vertexPositions)
to compute the 3D coordinate vector, but how can I translate the mid point back to the face's barycentric coordinates so that I can initialize SurfacePoint p(faceId, faceCoords);
?
nzfeng commented
Hope late is better than never :). You can do something like
Face commonFace = sharedFace(p1, p2);
SurfacePoint pA = p1.inFace(commonFace);
SurfacePoint pB = p2.inFace(commonFace);
SurfacePoint midpoint(commonFace, 0.5 * (pA.faceCoords + pB.faceCoords));
which is nicer than doing some computations with extrinsic coordinates.