Commit 4f9328b7 by Célestin Marot

### explain and simplify the computation of candidates

parent 8ba14fb8
 ... @@ -871,37 +871,39 @@ static inline void compute_candidates(SPRCavity* SPR, ... @@ -871,37 +871,39 @@ static inline void compute_candidates(SPRCavity* SPR, #ifdef SPR_SORT_CANDIDATES #ifdef SPR_SORT_CANDIDATES // those heuristics can be changed in many way // those heuristics can be changed in many way // maybe it would be best to change the weight of each // if you have some theory validating some choice, // you can give a higher/lower score depending on // - valence of points // - ... uint8_t curScore = 0; uint8_t curScore = 0; // big bonus if the point is an interior point if(SPR->points.array[tet->node[3]].is_interior) if(SPR->points.array[tet->node[3]].is_interior) curScore += 8; curScore += 4; curScore+=SPR->points.array[tet->node[3]].valence/3; // bonus if you don't degrade partial cavity if(qual > step->quality) if(qual > step->quality) curScore+=4; else if(qual == step->quality) curScore+=2; curScore+=2; else if(qual == step->quality) curScore+=1; // bonus if you don't degrade the best quality we can hope for... if(qual > qualMax) if(qual > qualMax) curScore+=4; else if(qual == qualMax) curScore+=2; curScore+=2; else if(qual == qualMax) curScore+=1; // curScore += qual*16; // bonus if the point is in an adjacent triangle for (int f=0; f<3; f++) { for (int f=0; f<3; f++) { uint8_t p0 = tet->node[nodeFromFacet[0][f]]; uint8_t p0 = tet->node[nodeFromFacet[0][f]]; uint8_t p1 = tet->node[nodeFromFacet[1][f]]; uint8_t p1 = tet->node[nodeFromFacet[1][f]]; uint8_t p2 = tet->node[nodeFromFacet[2][f]]; uint8_t p2 = tet->node[nodeFromFacet[2][f]]; if(get_face_map(SPR, p0, p1, p2)!=UINT16_MAX) if(get_face_map(SPR, p0, p1, p2)!=UINT16_MAX) curScore+=4; curScore+=2; } } if(curScore>=64) // the maximum score is 4+2+2+3*2 = 15 curScore = 64-1; candidate[num] = tet->node[3]; candidate[num] = tet->node[3]; score[num] = curScore; score[num] = curScore; ... @@ -914,13 +916,13 @@ static inline void compute_candidates(SPRCavity* SPR, ... @@ -914,13 +916,13 @@ static inline void compute_candidates(SPRCavity* SPR, #ifdef SPR_SORT_CANDIDATES #ifdef SPR_SORT_CANDIDATES // simple radix sort pass // simple radix sort pass uint8_t count[64] = {0}; uint8_t count[16] = {0}; for (uint8_t i=0; imap.faces==NULL) if(SPR->map.faces==NULL) goto allocation_error; goto allocation_error; // compiler should replace this by a memset (UINT16_MAX is all ones) for (size_t i=0; imap.faces[i] = UINT16_MAX; SPR->map.faces[i] = UINT16_MAX; } } ... @@ -1031,6 +1034,8 @@ static inline int SPR_init(SPRCavity* SPR) ... @@ -1031,6 +1034,8 @@ static inline int SPR_init(SPRCavity* SPR) SPR->map.qualities = malloc(sizeof(double)*qual_len); SPR->map.qualities = malloc(sizeof(double)*qual_len); if(SPR->map.qualities==NULL) if(SPR->map.qualities==NULL) goto allocation_error; goto allocation_error; // compiler should also replace this by a memset (NAN is all ones) for (size_t i=0; imap.qualities[i] = NAN; SPR->map.qualities[i] = NAN; } } ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!