Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fengxiuyaun opened this issue Apr 23, 2021 · 0 comments
Open

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

fengxiuyaun opened this issue Apr 23, 2021 · 0 comments

Comments

@fengxiuyaun
Copy link

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

这里应该判断在是否在3个顶点所在的线段上,不然会有个毛刺。
修改代码如下
if (dot00*dot11 - 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;
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant