[Bf-blender-cvs] [8000d526842] blender-v3.3-release: Fix T100796: wrong tangents on bezier splines with duplicate points and handles

Jacques Lucke noreply at git.blender.org
Mon Sep 5 15:20:38 CEST 2022


Commit: 8000d526842340387e137a84725a92f903555b24
Author: Jacques Lucke
Date:   Mon Sep 5 15:20:04 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB8000d526842340387e137a84725a92f903555b24

Fix T100796: wrong tangents on bezier splines with duplicate points and handles

Differential Revision: https://developer.blender.org/D15880

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

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

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

diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc
index af9533dc77f..940ec407d04 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -733,11 +733,14 @@ Span<float3> CurvesGeometry::evaluated_tangents() const
           const IndexRange points = this->points_for_curve(curve_index);
           const IndexRange evaluated_points = this->evaluated_points_for_curve(curve_index);
 
-          if (handles_right[points.first()] != positions[points.first()]) {
+          const float epsilon = 1e-6f;
+          if (!math::almost_equal_relative(
+                  handles_right[points.first()], positions[points.first()], epsilon)) {
             tangents[evaluated_points.first()] = math::normalize(handles_right[points.first()] -
                                                                  positions[points.first()]);
           }
-          if (handles_left[points.last()] != positions[points.last()]) {
+          if (!math::almost_equal_relative(
+                  handles_left[points.last()], positions[points.last()], epsilon)) {
             tangents[evaluated_points.last()] = math::normalize(positions[points.last()] -
                                                                 handles_left[points.last()]);
           }



More information about the Bf-blender-cvs mailing list