diff options
author | Hans Goudey <h.goudey@me.com> | 2021-08-02 22:43:37 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-08-02 22:43:37 +0300 |
commit | a4813379f9ce26862d826cfc98d1f28e0bbe11d7 (patch) | |
tree | b17d91cd2f1673a191c2728a49f572ebab1e8719 /source/blender | |
parent | 4f6f445120bb534a36e2ee5ddd89be6793a4c35d (diff) |
Fix T90042: Spline tangent calculation assert with coincident points
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/spline_base.cc | 6 |
1 files changed, 5 insertions, 1 deletions
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, |