yfeng95 / face3d

Python tools for 3D face: 3DMM, Mesh processing(transform, camera, light, render), 3D face representations.
2.64k stars 609 forks source link

如何判断点在三角面片内 #82

Open fengxiuyaun opened 3 years ago

fengxiuyaun commented 3 years ago

https://github.com/YadiraF/face3d/blob/2fc26906d159a11398cd3e7a9b3f16b6f8937da3/face3d/mesh/cython/mesh_core.cpp#L41

这里应该判断在是否在3个顶点所在的线段上,不然会有个毛刺。 修改代码如下 if (dot00dot11 - dot01 dot01 == 0) { if (dot00 > dot11) { float u = v2.x / v0.x; float v = v2.y / v0.y; return u == v; } else { float u = v2.x / v1.x; float v = v2.y / v1.y; return u == v; } }