Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-09-14 16:04:01 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-09-14 16:04:01 +0300
commitfc7ac0bc4995472b2485add560cb380418c62a24 (patch)
tree8585e0a8b873231d05530b4477b7c7478010656d /source/blender/bmesh/tools/bmesh_path.c
parent8c21003248673764128eac7863b8e5b3c196a221 (diff)
Correct error in last commit
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_path.c')
-rw-r--r--source/blender/bmesh/tools/bmesh_path.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/bmesh/tools/bmesh_path.c b/source/blender/bmesh/tools/bmesh_path.c
index 9e1ea2e7196..85c591b6684 100644
--- a/source/blender/bmesh/tools/bmesh_path.c
+++ b/source/blender/bmesh/tools/bmesh_path.c
@@ -45,21 +45,20 @@ static float step_cost_3_v3_ex(
const float v1[3], const float v2[3], const float v3[3],
bool skip_12, bool skip_23)
{
- float cost, d1[3], d2[3];
-
+ float d1[3], d2[3];
/* 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 = ((skip_12 ? 0.0f : normalize_v3(d1)) +
- (skip_23 ? 0.0f : normalize_v3(d2)));
+ const float cost_12 = normalize_v3(d1);
+ const float cost_23 = normalize_v3(d2);
+ const float cost = ((skip_12 ? 0.0f : cost_12) +
+ (skip_23 ? 0.0f : cost_23));
/* 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 * (1.0f + 0.5f * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2)))));
-
- return cost;
+ return cost * (1.0f + 0.5f * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2)))));
}
static float step_cost_3_v3(