Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Fredriksson <Osares>2021-08-06 02:34:32 +0300
committerHans Goudey <h.goudey@me.com>2021-08-06 02:34:32 +0300
commitbc0d55e724a27fba61a93cc95f2cc48e205e1cd8 (patch)
tree1dcd4c1db63c7590c53da8dfe752ede0d07b27dd /source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
parent263fa406cd2bc1aefe410fe735c22967ee052e22 (diff)
Fix: Avoid floating point error in some mesh primitive nodes
Some mesh primitives created using geometry nodes use loops to create vertices and accumulates positions/angles in FP variables. This allows rounding errors to accumulate and can introduce significant errors. To minimize changes from original implementation, variables allowing errors to accumulate are replaced by: delta * index. Affected Mesh Primitives nodes are Line, Grid, Cylinder, Circle, Cone, and UV-Sphere. Differential Revision: https://developer.blender.org/D12136
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc4
1 files changed, 1 insertions, 3 deletions
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 a193c05daa1..2e6d8ca34c8 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
@@ -118,11 +118,9 @@ static Mesh *create_line_mesh(const float3 start, const float3 delta, const int
short normal[3];
normal_float_to_short_v3(normal, delta.normalized());
- float3 co = start;
for (const int i : verts.index_range()) {
- copy_v3_v3(verts[i].co, co);
+ copy_v3_v3(verts[i].co, start + delta * i);
copy_v3_v3_short(verts[i].no, normal);
- co += delta;
}
fill_edge_data(edges);