【发布时间】:2012-06-29 13:08:19
【问题描述】:
我有以下函数可以将与三角形在同一平面上的点转换为重心点。
// 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);
}
我怎样才能写出这个操作的逆运算?我想编写一个以重心坐标为参数并返回笛卡尔点的函数。
【问题讨论】:
标签: c++ math 3d coordinate-systems