diff options
author | Jacques Lucke <jacques@blender.org> | 2022-07-02 22:51:45 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-07-02 22:51:58 +0300 |
commit | ab444a80a280e125b3e4d002941504d56f340ced (patch) | |
tree | 7862c87f35f3d0463d3322ddb68442014ba1afdd /source/blender/geometry | |
parent | 69ee9ca90e36aa6a74317262fccb1e3e2e9210bc (diff) |
BLI: refactor length parameterization
This refactor had two main goals:
* Simplify the sampling code by using an algorithm with fewer special cases.
* Generalize the sampling to support non-sorted samples.
The `SampleSegmentHint` optimization was inspired by `ValueAccessor` from
OpenVDB and improves performance 2x in my test cases.
Differential Revision: https://developer.blender.org/D15348
Diffstat (limited to 'source/blender/geometry')
-rw-r--r-- | source/blender/geometry/intern/resample_curves.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/geometry/intern/resample_curves.cc b/source/blender/geometry/intern/resample_curves.cc index c18c776fead..dd1da62408c 100644 --- a/source/blender/geometry/intern/resample_curves.cc +++ b/source/blender/geometry/intern/resample_curves.cc @@ -234,11 +234,10 @@ static Curves *resample_to_uniform(const CurveComponent &src_component, for (const int i_curve : sliced_selection) { const bool cyclic = curves_cyclic[i_curve]; const IndexRange dst_points = dst_curves.points_for_curve(i_curve); - length_parameterize::create_uniform_samples( - src_curves.evaluated_lengths_for_curve(i_curve, cyclic), - curves_cyclic[i_curve], - sample_indices.as_mutable_span().slice(dst_points), - sample_factors.as_mutable_span().slice(dst_points)); + length_parameterize::sample_uniform(src_curves.evaluated_lengths_for_curve(i_curve, cyclic), + !curves_cyclic[i_curve], + sample_indices.as_mutable_span().slice(dst_points), + sample_factors.as_mutable_span().slice(dst_points)); } /* For every attribute, evaluate attributes from every curve in the range in the original |