[Bf-blender-cvs] [00a0c7943dc] geometry-nodes-mesh-primitives: Fix off-by-one error in the line node

Hans Goudey noreply at git.blender.org
Mon Mar 15 23:15:15 CET 2021


Commit: 00a0c7943dcdfc42d0355f45265aa3b9b5be997a
Author: Hans Goudey
Date:   Mon Mar 15 18:15:07 2021 -0400
Branches: geometry-nodes-mesh-primitives
https://developer.blender.org/rB00a0c7943dcdfc42d0355f45265aa3b9b5be997a

Fix off-by-one error in the line node

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

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

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
index cf00479ce32..baaf162f8b1 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
@@ -144,12 +144,12 @@ static void geo_node_mesh_primitive_line_exec(GeoNodeExecParams params)
     float3 delta;
     if (count_mode == GEO_NODE_MESH_LINE_COUNT_RESOLUTION) {
       const float resolution = params.extract_input<float>("Resolution");
-      count = total_delta.length() / resolution;
+      count = total_delta.length() / resolution + 1;
       delta = total_delta.normalized() * resolution;
     }
     else if (count_mode == GEO_NODE_MESH_LINE_COUNT_TOTAL) {
       count = params.extract_input<int>("Count");
-      delta = total_delta / count;
+      delta = total_delta / (float)(count - 1);
     }
 
     if (count > 0) {



More information about the Bf-blender-cvs mailing list