title: From barycentric to cartesian
body: <p>I have the following function to convert a point on the same plane as a triangle into a barycentric point.</p>
  
  <pre><code>// 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);
  }
  </code></pre>
  
  <p>How can I write the inverse of this operation? I would like to write a function that takes a barycentric coord and returns the cartesian point.</p>