diff options
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index f0f9a95a1c5..18c10c8a28a 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2912,6 +2912,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n float *p1, *p2, *p3, pt[3]; float dvec_a[3], dvec_b[3]; float len, len_a, len_b; + float orig_len_ratio; const float eps = 1e-5; if (bezt->h1 == 0 && bezt->h2 == 0) { @@ -2956,6 +2957,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n if (len_a == 0.0f) len_a = 1.0f; if (len_b == 0.0f) len_b = 1.0f; + orig_len_ratio = len_a / len_b; if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) || ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { /* auto */ float tvec[3]; @@ -3092,15 +3094,11 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n len_a = len_v3v3(p2, p2_h1); len_b = len_v3v3(p2, p2_h2); - if (len_a == 0.0f) - len_a = 1.0f; - if (len_b == 0.0f) - len_b = 1.0f; if (bezt->f1 & SELECT) { /* order of calculation */ if (ELEM(bezt->h2, HD_ALIGN, HD_ALIGN_DOUBLESIDE)) { /* aligned */ if (len_a > eps) { - len = len_b / len_a; + len = 1.0f / orig_len_ratio; p2_h2[0] = p2[0] + len * (p2[0] - p2_h1[0]); p2_h2[1] = p2[1] + len * (p2[1] - p2_h1[1]); p2_h2[2] = p2[2] + len * (p2[2] - p2_h1[2]); @@ -3108,7 +3106,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n } if (ELEM(bezt->h1, HD_ALIGN, HD_ALIGN_DOUBLESIDE)) { if (len_b > eps) { - len = len_a / len_b; + len = orig_len_ratio; p2_h1[0] = p2[0] + len * (p2[0] - p2_h2[0]); p2_h1[1] = p2[1] + len * (p2[1] - p2_h2[1]); p2_h1[2] = p2[2] + len * (p2[2] - p2_h2[2]); @@ -3118,7 +3116,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n else { if (ELEM(bezt->h1, HD_ALIGN, HD_ALIGN_DOUBLESIDE)) { if (len_b > eps) { - len = len_a / len_b; + len = 1.0f / orig_len_ratio; p2_h1[0] = p2[0] + len * (p2[0] - p2_h2[0]); p2_h1[1] = p2[1] + len * (p2[1] - p2_h2[1]); p2_h1[2] = p2[2] + len * (p2[2] - p2_h2[2]); @@ -3126,7 +3124,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n } if (ELEM(bezt->h2, HD_ALIGN, HD_ALIGN_DOUBLESIDE)) { /* aligned */ if (len_a > eps) { - len = len_b / len_a; + len = orig_len_ratio; p2_h2[0] = p2[0] + len * (p2[0] - p2_h1[0]); p2_h2[1] = p2[1] + len * (p2[1] - p2_h1[1]); p2_h2[2] = p2[2] + len * (p2[2] - p2_h1[2]); |