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

bug found in the intersection code, did a bad copy...

parent 4edf9336
# compilation and linking flags
CFLAGS=-Wall -Wextra -O3 -g
CFLAGS=-Wall -Wextra -O3 -g -DNDEBUG
LDFLAGS=-lm
# directories
......
......@@ -459,12 +459,12 @@ static inline int tet_tri_intersection(SPRCavity* SPR,
// now we want to know if an edge of the tetrahedron pierce the triangle or not
// if v0f or v1f or v2f or v3f is 0 and an edge that is coplanar to the triangle
// intersects it, then another edge should also intersect. (2nd nice property of tet :p)
if( (tet0_to_tri==0 && tet1_to_tri==0 && tri_edge_intersection(v0f==0?v1f:-v0f, -v1f, e0e0, e0e1, e0e2))
|| (tet0_to_tri==0 && tet2_to_tri==0 && tri_edge_intersection(v0f==0?v2f:-v0f, -v2f, e1e0, e1e1, e1e2))
|| (tet0_to_tri==0 && tet3_to_tri==0 && tri_edge_intersection(v0f==0?v3f:-v0f, -v3f, e2e0, e2e1, e2e2))
|| (tet1_to_tri==0 && tet2_to_tri==0 && tri_edge_intersection(v1f==0?v2f:-v1f, -v2f, e3e0, e3e1, e3e2))
|| (tet1_to_tri==0 && tet3_to_tri==0 && tri_edge_intersection(v1f==0?v3f:-v1f, -v3f, e4e0, e4e1, e4e2))
|| (tet2_to_tri==0 && tet3_to_tri==0 && tri_edge_intersection(v2f==0?v3f:-v2f, -v3f, e5e0, e5e1, e5e2))
if( (tet0_to_tri==-1 && tet1_to_tri==-1 && tri_edge_intersection(v0f==0?v1f:-v0f, -v1f, e0e0, e0e1, e0e2))
|| (tet0_to_tri==-1 && tet2_to_tri==-1 && tri_edge_intersection(v0f==0?v2f:-v0f, -v2f, e1e0, e1e1, e1e2))
|| (tet0_to_tri==-1 && tet3_to_tri==-1 && tri_edge_intersection(v0f==0?v3f:-v0f, -v3f, e2e0, e2e1, e2e2))
|| (tet1_to_tri==-1 && tet2_to_tri==-1 && tri_edge_intersection(v1f==0?v2f:-v1f, -v2f, e3e0, e3e1, e3e2))
|| (tet1_to_tri==-1 && tet3_to_tri==-1 && tri_edge_intersection(v1f==0?v3f:-v1f, -v3f, e4e0, e4e1, e4e2))
|| (tet2_to_tri==-1 && tet3_to_tri==-1 && tri_edge_intersection(v2f==0?v3f:-v2f, -v3f, e5e0, e5e1, e5e2))
)
return 1;
......@@ -760,7 +760,7 @@ static inline uint16_t best_face_heuristic(SPRCavity* SPR, double* qualMax)
int numValid = 0;
double max = 0.0;
for (tet.node[3]=0; tet.node[3] < npts && numValid<minValid; tet.node[3]++)
for (tet.node[3]=0; tet.node[3] < npts && numValid < minValid; tet.node[3]++)
{
if(tet.node[3] == tet.node[0] ||
tet.node[3] == tet.node[1] ||
......@@ -782,7 +782,7 @@ static inline uint16_t best_face_heuristic(SPRCavity* SPR, double* qualMax)
numValid++;
}
if(numValid<1)
if(numValid == 0)
return UINT16_MAX;
if(max < minimax)
......@@ -889,7 +889,7 @@ static inline void compute_candidates(SPRCavity* SPR,
else if(qual == qualMax)
curScore+=2;
curScore += qual*16;
// curScore += qual*16;
for (int f=0; f<3; f++) {
uint8_t p0 = tet->node[nodeFromFacet[0][f]];
......
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