[Bf-blender-cvs] [acb8909021b] master: Fix: Division by zero in curve spiral primitive node

Hans Goudey noreply at git.blender.org
Wed Sep 15 21:12:55 CEST 2021


Commit: acb8909021b188658ba92031e9544f91ff872f90
Author: Hans Goudey
Date:   Wed Sep 15 14:12:48 2021 -0500
Branches: master
https://developer.blender.org/rBacb8909021b188658ba92031e9544f91ff872f90

Fix: Division by zero in curve spiral primitive node

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

M	source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc
index 169a169bb1c..0803d43e5c3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc
@@ -41,7 +41,7 @@ static std::unique_ptr<CurveEval> create_spiral_curve(const float rotations,
   std::unique_ptr<CurveEval> curve = std::make_unique<CurveEval>();
   std::unique_ptr<PolySpline> spline = std::make_unique<PolySpline>();
 
-  const int totalpoints = resolution * rotations;
+  const int totalpoints = std::max(int(resolution * rotations), 1);
   const float delta_radius = (end_radius - start_radius) / (float)totalpoints;
   float radius = start_radius;
   const float delta_height = height / (float)totalpoints;



More information about the Bf-blender-cvs mailing list