remove unused function
authorCampbell Barton <ideasman42@gmail.com>
Tue, 17 Jan 2012 00:45:51 +0000 (00:45 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 17 Jan 2012 00:45:51 +0000 (00:45 +0000)
source/blender/editors/mesh/editbmesh_bvh.c

index 361a7a76368e5b74b903f20519a0f7bdbeb209fe..d5fab72c24c73fb79119533539c5792a75c43507 100644 (file)
@@ -375,251 +375,6 @@ static short winding(float *v1, float *v2, float *v3)
        return 1;
 }
 
-static float topo_compare(BMesh *bm, BMVert *v1, BMVert *v2)
-{
-       BMIter iter1, iter2;
-       BMEdge *e1, *e2, *cure1 = NULL, *cure2 = NULL;
-       BMLoop *l1, *l2;
-       BMVert *lastv1, *lastv2;
-       GHash *gh;
-       walklist *stack1=NULL, *stack2=NULL;
-       BLI_array_declare(stack1);
-       BLI_array_declare(stack2);
-       float vec1[3], vec2[3], minangle=FLT_MAX, w;
-       int lvl=1;
-       static int maxlevel = 3;
-
-       /*ok.  see how similar v is to v2, based on topological similaritys in the local
-         topological neighborhood*/
-
-       /*step 1: find two edges, one that contains v and one that contains v2, with the
-         smallest angle between the two edges*/
-
-       BM_ITER(e1, &iter1, bm, BM_EDGES_OF_VERT, v1) {
-               BM_ITER(e2, &iter2, bm, BM_EDGES_OF_VERT, v2) {
-                       float angle;
-                       
-                       if (BM_Edge_Share_Vert(e1, e2)) {
-                               continue;
-                       }
-
-                       sub_v3_v3v3(vec1, BM_OtherEdgeVert(e1, v1)->co, v1->co);
-                       sub_v3_v3v3(vec2, BM_OtherEdgeVert(e2, v2)->co, v2->co);
-
-                       angle = fabs(angle_v3v3(vec1, vec2));
-
-                       if (angle < minangle) {
-                               minangle = angle;
-                               cure1 = e1;
-                               cure2 = e2;
-                       }
-               }
-       }
-
-       if (!cure1 || !cure1->l || !cure2->l) {
-               /*just return 1.0 in this case*/
-               return 1.0f;
-       }
-
-       /*assumtions
-       
-         we assume a 2-manifold mesh here.  if at any time this isn't the case,
-         e.g. a hole or an edge with more then 2 faces around it, we um ignore
-         that edge I guess, and try to make the algorithm go around as necassary.*/
-
-       l1 = cure1->l;
-       l2 = cure2->l;
-
-       lastv1 = l1->v == v1 ? l1->next->v : l1->prev->v;
-       lastv2 = l2->v == v2 ? l2->next->v : l2->prev->v;
-
-       /*we can only provide meaningful comparisons if v1 and v2 have the same valence*/
-       if (BM_Vert_EdgeCount(v1) != BM_Vert_EdgeCount(v2))
-               return 1.0f; /*full mismatch*/
-
-       gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh bvh");
-
-#define SPUSH(s, d, vt, lv, e)\
-       if (BLI_array_count(s) <= lvl) BLI_array_growone(s);\
-       memset((s+lvl), 0, sizeof(*s));\
-       s[lvl].depth = d;\
-       s[lvl].v = vt;\
-       s[lvl].cure = e;\
-       s[lvl].lastv = lv;\
-       s[lvl].valence = BM_Vert_EdgeCount(vt);\
-
-       lvl = 0;
-
-       SPUSH(stack1, 0, v1, lastv1, cure1);
-       SPUSH(stack2, 0, v2, lastv2, cure2);
-
-       BLI_srand( BLI_rand() ); /* random seed */
-
-       lvl = 1;
-       while (lvl) {
-               int term = 0;
-               walklist *s1 = stack1 + lvl - 1, *s2 = stack2 + lvl - 1;
-
-               /*pop from the stack*/
-               lvl--;
-
-               if (s1->curl && s1->curl->e == s1->cure)
-                       term = 1;
-               if (s2->curl && s2->curl->e == s2->cure)
-                       term = 1;
-
-               /*find next case to do*/
-               if (!s1->curl)
-                       s1->curl = s1->cure->l;
-               if (!s2->curl) {
-                       float no1[3], no2[3], angle;
-                       int wind1, wind2;
-                       
-                       s2->curl = s2->cure->l;
-
-                       /*find which of two possible faces to use*/
-                       l1 = BM_OtherFaceLoop(s1->curl->e, s1->curl->f, s1->lastv);
-                       l2 = BM_OtherFaceLoop(s2->curl->e, s2->curl->f, s2->lastv);
-
-                       if (l1->v == s2->lastv) {
-                               l1 = l1->next;
-                               if (l1->v == s2->v)
-                                       l1 = l1->prev->prev;
-                       } else if (l1->v == s2->v) {
-                               l1 = l1->next;
-                               if (l1->v == s2->lastv)
-                                       l1 = l1->prev->prev;
-                       }
-
-                       if (l2->v == s2->lastv) {
-                               l2 = l2->next;
-                               if (l2->v == s2->v)
-                                       l2 = l2->prev->prev;
-                       } else if (l2->v == s2->v) {
-                               l2 = l2->next;
-                               if (l2->v == s2->lastv)
-                                       l2 = l2->prev->prev;
-                       }
-
-                       wind1 = winding(s1->v->co, s1->lastv->co, l1->v->co);
-
-                       wind2 = winding(s2->v->co, s2->lastv->co, l2->v->co);
-                       
-                       /*if angle between the two adjacent faces is greater then 90 degrees,
-                         we need to flip wind2*/
-                       l1 = l2;
-                       l2 = s2->curl->radial_next;
-                       l2 = BM_OtherFaceLoop(l2->e, l2->f, s2->lastv);
-                       
-                       if (l2->v == s2->lastv) {
-                               l2 = l2->next;
-                               if (l2->v == s2->v)
-                                       l2 = l2->prev->prev;
-                       } else if (l2->v == s2->v) {
-                               l2 = l2->next;
-                               if (l2->v == s2->lastv)
-                                       l2 = l2->prev->prev;
-                       }
-
-                       normal_tri_v3(no1, s2->v->co, s2->lastv->co, l1->v->co);
-                       normal_tri_v3(no2, s2->v->co, s2->lastv->co, l2->v->co);
-                       
-                       /*enforce identical winding as no1*/
-                       negate_v3(no2);
-
-                       angle = angle_v3v3(no1, no2);
-                       if (angle > M_PI/2 - FLT_EPSILON*2)
-                               wind2 = !wind2;
-
-                       if (wind1 == wind2)
-                               s2->curl = s2->curl->radial_next;
-               }
-
-               /*handle termination cases of having already looped through all child
-                 nodes, or the valence mismatching between v1 and v2, or we hit max
-                 recursion depth*/
-               term |= s1->valence != s2->valence || lvl+1 > maxlevel;
-               term |= s1->curl->radial_next == l1;
-               term |= s2->curl->radial_next == l2;
-
-               if (!term) {
-                       lastv1 = s1->v;
-                       lastv2 = s2->v;
-                       v1 = BM_OtherEdgeVert(s1->curl->e, lastv1);
-                       v2 = BM_OtherEdgeVert(s2->curl->e, lastv2);
-                       
-                       e1 = s1->curl->e;
-                       e2 = s2->curl->e;
-
-                       if (!BLI_ghash_haskey(gh, v1) && !BLI_ghash_haskey(gh, v2)) {
-                               /*repush the current stack item*/
-                               lvl++;
-                               
-                               //if (maxlevel % 2 == 0) {
-                                       BLI_ghash_insert(gh, v1, NULL);
-                                       BLI_ghash_insert(gh, v2, NULL);
-                               //}
-
-                               /*now push the child node*/
-                               SPUSH(stack1, lvl, v1, lastv1, e1);
-                               SPUSH(stack2, lvl, v2, lastv2, e2);
-
-                               lvl++;
-
-                               s1 = stack1 + lvl - 2;
-                               s2 = stack2 + lvl - 2;
-                       }
-
-                       s1->curl = s1->curl->v == s1->v ? s1->curl->prev : s1->curl->next;
-                       s2->curl = s2->curl->v == s2->v ? s2->curl->prev : s2->curl->next;
-               
-                       s1->curl = s1->curl->radial_next;
-                       s2->curl = s2->curl->radial_next;
-               }
-
-#define WADD(stack, s)\
-               if (lvl) {/*silly attempt to make this non-commutative: randomize\
-                             how much this particular weight adds to the total*/\
-                       stack[lvl-1].r += r;\
-                       s->w *= r;\
-                       stack[lvl-1].totwalked++;\
-                       stack[lvl-1].w += s->w;\
-               }
-
-               /*if no next case to do, update parent weight*/
-               if (term) {
-                       float r = 0.8f + BLI_frand()*0.2f - FLT_EPSILON;
-
-                       if (s1->totwalked) {
-                               s1->w /= s1->r;
-                       } else
-                               s1->w = s1->valence == s2->valence ? 1.0f : 0.0f;
-
-                       WADD(stack1, s1);
-
-                       if (s2->totwalked) {
-                               s2->w /= s2->r;
-                       } else
-                               s2->w = s1->valence == s2->valence ? 1.0f : 0.0f;
-                       
-                       WADD(stack2, s2);
-
-                       /*apply additional penalty to weight mismatch*/
-                       if (s2->w != s1->w)
-                               s2->w *= 0.8f;
-               }
-       }
-
-       w = (stack1[0].w + stack2[0].w)*0.5f;
-
-       BLI_array_free(stack1);
-       BLI_array_free(stack2);
-
-       BLI_ghash_free(gh, NULL, NULL);
-
-       return 1.0f - w;
-}
-
 #if 0 //BMESH_TODO: not implemented yet
 int BMBVH_VertVisible(BMBVHTree *tree, BMEdge *e, RegionView3D *r3d)
 {