这是“多边形网格过程”示例的片段:
for (v_it=mesh_.vertices_begin(); v_it!=v_end; ++v_it) {
area = 0.0;
for (vf_it=mesh_.vf_iter(v_it); vf_it; ++vf_it)
{
fv_it = mesh_.fv_iter(vf_it);
const Mesh::Point& P = mesh_.point(fv_it); ++fv_it;
const Mesh::Point& Q = mesh_.point(fv_it); ++fv_it;
const Mesh::Point& R = mesh_.point(fv_it);
area += ((Q-P)%(R-P)).norm() * 0.5f * 0.3333f; // norm: compute euclidean norm, return Scalar
}
weight(v_it) = (fabs(area)>FLT_MIN ? 1.0 / (2.0 * area) : 0.0);
}
为什么最后乘以 0.3333f?