[Bf-blender-cvs] [cf721942149] master: Fix T71137: curve minimum twist producing wrong geometry

Campbell Barton noreply at git.blender.org
Thu Aug 19 09:11:19 CEST 2021


Commit: cf721942149057684c089c0677c224dbe9d90c52
Author: Campbell Barton
Date:   Thu Aug 19 16:57:05 2021 +1000
Branches: master
https://developer.blender.org/rBcf721942149057684c089c0677c224dbe9d90c52

Fix T71137: curve minimum twist producing wrong geometry

Originally D11886 by @ghaspias with minor edits applied.

===================================================================

M	source/blender/blenkernel/intern/curve.c

===================================================================

diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index db0ea71e233..c49788528a4 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -2331,17 +2331,21 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
   bevp1 = bevp2 + (bl->nr - 1);
   bevp0 = bevp1 - 1;
 
-  nr = bl->nr;
-  while (nr--) {
+  /* The ordinal of the point being adjusted (bevp2). First point is 1. */
 
-    if (nr + 3 > bl->nr) { /* first time and second time, otherwise first point adjusts last */
-      vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
-    }
-    else {
-      minimum_twist_between_two_points(bevp1, bevp0);
-    }
+  /* First point is the reference, don't adjust.
+   * Skip this point in the following loop. */
+  if (bl->nr > 0) {
+    vec_to_quat(bevp2->quat, bevp2->dir, 5, 1);
 
-    bevp0 = bevp1;
+    bevp0 = bevp1; /* bevp0 is unused */
+    bevp1 = bevp2;
+    bevp2++;
+  }
+  for (nr = 1; nr < bl->nr; nr++) {
+    minimum_twist_between_two_points(bevp2, bevp1);
+
+    bevp0 = bevp1; /* bevp0 is unused */
     bevp1 = bevp2;
     bevp2++;
   }



More information about the Bf-blender-cvs mailing list