I have the following function for converting a point in the same plane as a triangle to a barycentric point.
// p0, p1 and p2 and the points that make up this triangle Vector3d Tri::barycentric(Vector3d p) { double triArea = (p1 - p0).cross(p2 - p0).norm() * 0.5; double u = ((p1 - p).cross(p2 - p).norm() * 0.5) / triArea; double v = ((p0 - p).cross(p2 - p).norm() * 0.5) / triArea; double w = ((p0 - p).cross(p1 - p).norm() * 0.5) / triArea; return Vector3d(u,v,w); }
How can I write an inverse of this operation? I would like to write a function that takes a barycentric coordinate and returns a Cartesian point.
user181351
source share