decl driving me crazy
This commit is contained in:
parent
f938bdbc99
commit
1abc7b2e25
@ -386,10 +386,11 @@ double DECL::EdgeAngle(int edge)
|
||||
V.x = nx/length; V.y = ny/length; V.z = nz/length;
|
||||
dotprod = U.x*V.x + U.y*V.y + U.z*V.z;
|
||||
if (dotprod < 0.f){
|
||||
//printf("negative dot product on face\n");
|
||||
printf("negative dot product on face\n");
|
||||
dotprod=-dotprod;
|
||||
V.x = -V.x; V.y = -V.y; V.z = -V.z;
|
||||
}
|
||||
|
||||
if (dotprod > 1.f) dotprod=1.f;
|
||||
angle = acos(dotprod);
|
||||
/* project onto plane of cube face also works
|
||||
@ -414,15 +415,17 @@ double DECL::EdgeAngle(int edge)
|
||||
//length = sqrt(nx*nx+ny*ny+nz*nz);
|
||||
Point w=0.5*(P+Q)-R;
|
||||
if (W.x*w.x + W.y*w.y + W.z*w.z < 0.f){
|
||||
printf("flip edge normal \n");
|
||||
W.x = -W.x;
|
||||
W.y = -W.y;
|
||||
W.z = -W.z;
|
||||
}
|
||||
if (W.x*V.x + W.y*V.y + W.z*V.z < 0.f){
|
||||
if (W.x*V.x + W.y*V.y + W.z*V.z > 0.f){
|
||||
// concave
|
||||
angle = -angle;
|
||||
}
|
||||
//printf("angle=%f,dot=%f (Edge=%i, twin=%i): P={%f, %f, %f}, Q={%f, %f, %f} U={%f, %f, %f}, V={%f, %f, %f}\n",angle,dotprod,edge,halfedge.twin(edge),P.x,P.y,P.z,Q.x,Q.y,Q.z,U.x,U.y,U.z,V.x,V.y,V.z);
|
||||
|
||||
printf("angle=%f,dot=%f (Edge=%i, twin=%i): P={%f, %f, %f}, Q={%f, %f, %f} U={%f, %f, %f}, V={%f, %f, %f}\n",angle,dotprod,edge,halfedge.twin(edge),P.x,P.y,P.z,Q.x,Q.y,Q.z,U.x,U.y,U.z,V.x,V.y,V.z);
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user