convex test for faces

This commit is contained in:
James E McClure 2018-09-14 18:21:36 -04:00
parent 7935d2ccb7
commit f29df4b8aa

View File

@ -383,11 +383,8 @@ double DECL::EdgeAngle(int edge)
double len = sqrt(nx*nx+ny*ny+nz*nz);
// new value for V is this normal vector
V.x = nx/len; V.y = ny/len; V.z = nz/len;
dotprod = U.x*V.x + U.y*V.y + U.z*V.z;
if (dotprod > 1.f) dotprod=1.f;
if (dotprod < 0.f) dotprod=-dotprod;
angle = acos(dotprod);
/*W = U - dotprod*V;
/* project onto plane of cube face also works
W = U - dotprod*V;
length = sqrt(W.x*W.x+W.y*W.y+W.z*W.z); // for normalization
dotprod = (U.x*W.x + U.y*W.y + U.z*W.z)/length;
if (dotprod > 1.f) dotprod=1.f;
@ -395,7 +392,6 @@ double DECL::EdgeAngle(int edge)
angle = acos(dotprod);
*/
}
else{
dotprod=U.x*V.x + U.y*V.y + U.z*V.z;
if (dotprod > 1.f) dotprod=1.f;
if (dotprod < -1.f) dotprod=-1.f;
@ -409,7 +405,6 @@ double DECL::EdgeAngle(int edge)
angle = -angle;
}
angle *= 0.5; // half edge value
}
//printf(" %f, %f (Edge=%i, twin=%i)\n U={%f, %f, %f}, V={%f, %f, %f}\n",angle,dotprod,edge,halfedge.twin(edge),U.x,U.y,U.z,V.x,V.y,V.z);
return angle;
}