[Bf-blender-cvs] [a4813379f9c] master: Fix T90042: Spline tangent calculation assert with coincident points

Hans Goudey noreply at git.blender.org
Mon Aug 2 21:43:45 CEST 2021


Commit: a4813379f9ce26862d826cfc98d1f28e0bbe11d7
Author: Hans Goudey
Date:   Mon Aug 2 15:43:37 2021 -0400
Branches: master
https://developer.blender.org/rBa4813379f9ce26862d826cfc98d1f28e0bbe11d7

Fix T90042: Spline tangent calculation assert with coincident points

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

M	source/blender/blenkernel/intern/spline_base.cc

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

diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc
index a7caae967f6..987152f34bc 100644
--- a/source/blender/blenkernel/intern/spline_base.cc
+++ b/source/blender/blenkernel/intern/spline_base.cc
@@ -189,7 +189,11 @@ static float3 direction_bisect(const float3 &prev, const float3 &middle, const f
   const float3 dir_prev = (middle - prev).normalized();
   const float3 dir_next = (next - middle).normalized();
 
-  return (dir_prev + dir_next).normalized();
+  const float3 result = (dir_prev + dir_next).normalized();
+  if (UNLIKELY(result.is_zero())) {
+    return float3(0.0f, 0.0f, 1.0f);
+  }
+  return result;
 }
 
 static void calculate_tangents(Span<float3> positions,



More information about the Bf-blender-cvs mailing list