Fix T91093: off by one error in when resampling curve
The bug existed in the Curve Resample and Curve to Points node. Differential Revision: https://developer.blender.org/D12416
This commit is contained in:
@@ -169,7 +169,7 @@ static std::unique_ptr<CurveEval> resample_curve(const CurveEval &input_curve,
|
||||
threading::parallel_for(input_splines.index_range(), 128, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
const float length = input_splines[i]->length();
|
||||
const int count = std::max(int(length / *mode_param.length), 1);
|
||||
const int count = std::max(int(length / *mode_param.length) + 1, 1);
|
||||
output_splines[i] = resample_spline(*input_splines[i], count);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -101,7 +101,7 @@ static Array<int> calculate_spline_point_offsets(GeoNodeExecParams ¶ms,
|
||||
int offset = 0;
|
||||
for (const int i : IndexRange(size)) {
|
||||
offsets[i] = offset;
|
||||
offset += splines[i]->length() / resolution;
|
||||
offset += splines[i]->length() / resolution + 1;
|
||||
}
|
||||
offsets.last() = offset;
|
||||
return offsets;
|
||||
|
||||
Reference in New Issue
Block a user