Commit fb1862f2 authored by Célestin Marot's avatar Célestin Marot
Browse files

solved bug in tri-tet intersection

parent e0767822
......@@ -380,34 +380,16 @@ static inline int tet_tri_intersection(SPRCavity* SPR,
(tri2_to_tet==-1 && f0v2<=0 && f1v2<=0 && f2v2<=0 && f3v2<=0) )
return 1;
int side = 0;
int outside = 1;
int v0f = get_orient3d(SPR, tet[0], tri[0], tri[1], tri[2]);
side = v0f;
int v1f = get_orient3d(SPR, tet[1], tri[0], tri[1], tri[2]);
if(v1f!=0) {
if(side==0)
side = v1f;
else if(v1f*side<0) // not on the same side
outside = 0;
}
int v2f = get_orient3d(SPR, tet[2], tri[0], tri[1], tri[2]);
if(v2f!=0) {
if(side==0)
side = v2f;
else if(v2f*side<0) // not on the same side
outside = 0;
}
int v3f = get_orient3d(SPR, tet[3], tri[0], tri[1], tri[2]);
if(v3f!=0) {
if(side==0)
side = v3f;
else if(v3f*side<0) // not on the same side
outside = 0;
}
// if the tet is entirely on one side of the triangle: no intersection
if(outside)
if(v0f > 0 && v1f > 0 && v2f > 0 && v3f > 0)
return 0;
if(v0f < 0 && v1f < 0 && v2f < 0 && v3f < 0)
return 0;
// now we want to know if an edge of the triangle pierce a facet or not
......@@ -638,15 +620,15 @@ static SPRNOINLINE double add_quality_map(SPRCavity* SPR,
for (int ptID=0; ptID<n; ptID++) {
if(tet_contains_pt(SPR, &bbox, tet, ptID)) {
SPR->map.qualities[index] = 0.0;
return 0.0;
SPR->map.qualities[index] = -DBL_MAX;
return -DBL_MAX;
}
}
for (int edgeID=0; edgeID<SPR->edges.num; edgeID++) {
if(tet_edge_intersection(SPR, &bbox, tet, edgeID)) {
SPR->map.qualities[index] = 0.0;
return 0.0;
SPR->map.qualities[index] = -DBL_MAX;
return -DBL_MAX;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment