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

we do not need to count swaps because we verify orientation

parent a0d6d12e
......@@ -129,11 +129,9 @@ static inline void get_compressed_index(unsigned v0,
unsigned v1,
unsigned v2,
unsigned v3,
unsigned* __restrict__ nSwaps,
unsigned* __restrict__ index)
unsigned* index)
{
*nSwaps = 0;
#define SPRSWAP(x,y) if(x>y){unsigned tmp=x; x=y; y=tmp; (*nSwaps)++;}
#define SPRSWAP(x,y) if(x>y){unsigned tmp=x; x=y; y=tmp;}
SPRSWAP(v0,v1)
SPRSWAP(v2,v3)
SPRSWAP(v0,v2)
......@@ -622,8 +620,7 @@ static SPRNOINLINE double add_quality_map(SPRCavity* SPR,
unsigned v1,
unsigned v2,
unsigned v3,
unsigned index,
unsigned nSwaps)
unsigned index)
{
double* c0 = SPR->points.array[v0].coord;
double* c1 = SPR->points.array[v1].coord;
......@@ -663,10 +660,7 @@ static SPRNOINLINE double add_quality_map(SPRCavity* SPR,
qual = DBL_MIN;
}
if(nSwaps&1)
SPR->map.qualities[index] = -qual;
else
SPR->map.qualities[index] = qual;
SPR->map.qualities[index] = qual;
return qual;
}
......@@ -686,33 +680,21 @@ static double get_quality_map(SPRCavity* SPR,
else if(SPR->quality.function==NULL)
return 1.0;
unsigned nSwaps, index;
get_compressed_index(v0, v1, v2, v3, &nSwaps, &index);
unsigned index;
get_compressed_index(v0, v1, v2, v3, &index);
double qual = SPR->map.qualities[index];
if(!isnan(qual)) {
if(nSwaps&1)
return -qual;
return qual;
}
else {
return add_quality_map(SPR, v0, v1, v2, v3,
index, nSwaps);
index);
}
}
// static void compute_bbox(SPRCavity* SPR, uint16_t triangleID)
// {
// SPRTriangle* f = &SPR->triangles.array[triangleID];
// SPRBbox* bbox = &SPR->triangles.bbox[triangleID];
// SPRBbox_from(bbox, SPR->points.array[f->node[0]].coord);
// SPRBbox_add(bbox, SPR->points.array[f->node[1]].coord);
// SPRBbox_add(bbox, SPR->points.array[f->node[2]].coord);
// }
/* Compute the worst face (the face that we should begin with)
* and the minimum value among all maximum quality we can
* get from a face. This value is an estimation for the quality
......
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