Fix #33316: mesh edge short path select was wrong on large/small objects.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 26 Nov 2012 19:10:34 +0000 (19:10 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 26 Nov 2012 19:10:34 +0000 (19:10 +0000)
source/blender/editors/mesh/editmesh_select.c

index a6b798c88875cf42146b5ece8b316ea6f8a61f13..b46961a95d7e49870153e9222b04d2968adc7f1b 100644 (file)
@@ -1267,12 +1267,12 @@ static float step_cost_3_v3(const float v1[3], const float v2[3], const float v3
        /* The cost is based on the simple sum of the length of the two edgees... */
        sub_v3_v3v3(d1, v2, v1);
        sub_v3_v3v3(d2, v3, v2);
-       cost = len_v3(d1) + len_v3(d2);
+       cost = normalize_v3(d1) + normalize_v3(d2);
 
        /* but is biased to give higher values to sharp turns, so that it will take
         * paths with fewer "turns" when selecting between equal-weighted paths between
         * the two edges */
-       cost = cost + 0.5f * cost * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2))));
+       cost = cost * (1.0f + 0.5f * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2)))));
 
        return cost;
 }