[Bf-blender-cvs] [29e24974a68] geometry-nodes-curve-support: Geometry Nodes Curves: Fix of by one resolution issue
Hans Goudey
noreply at git.blender.org
Mon Apr 5 20:54:56 CEST 2021
Commit: 29e24974a689083dc93fce11e618b2df93395cef
Author: Hans Goudey
Date: Mon Apr 5 13:54:30 2021 -0500
Branches: geometry-nodes-curve-support
https://developer.blender.org/rB29e24974a689083dc93fce11e618b2df93395cef
Geometry Nodes Curves: Fix of by one resolution issue
===================================================================
M source/blender/blenkernel/intern/derived_curve.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/derived_curve.cc b/source/blender/blenkernel/intern/derived_curve.cc
index f3eb2b0ff25..c0959e70e61 100644
--- a/source/blender/blenkernel/intern/derived_curve.cc
+++ b/source/blender/blenkernel/intern/derived_curve.cc
@@ -138,12 +138,13 @@ int BezierSpline::evaluated_points_size() const
return total_len;
}
-static void evaluate_bezier_part_3d(const float3 &point_0,
- const float3 &point_1,
- const float3 &point_2,
- const float3 &point_3,
- MutableSpan<float3> result)
+static void evaluate_bezier_section_3d(const float3 &point_0,
+ const float3 &point_1,
+ const float3 &point_2,
+ const float3 &point_3,
+ MutableSpan<float3> result)
{
+ BLI_assert(result.size() > 0);
/* TODO: This can probably be vectorized... no one has done this already? */
float *data = (float *)result.data();
for (const int axis : {0, 1, 2}) {
@@ -163,16 +164,16 @@ static void evaluate_segment_positions(const BezierPoint &point,
int &offset,
MutableSpan<float3> positions)
{
- if (segment_is_vector(point, next)) {
+ if (segment_is_vector(point, next) || resolution == 1) {
positions[offset] = point.position;
offset++;
}
else {
- evaluate_bezier_part_3d(point.position,
- point.handle_position_b,
- next.handle_position_a,
- next.position,
- positions.slice(offset, resolution - 1));
+ evaluate_bezier_section_3d(point.position,
+ point.handle_position_b,
+ next.handle_position_a,
+ next.position,
+ positions.slice(offset, resolution - 1));
offset += resolution;
}
}
More information about the Bf-blender-cvs
mailing list