[Bf-blender-cvs] [63be57307eb] master: Cleanup: Rename length parameterization interpolation function

Hans Goudey noreply at git.blender.org
Thu Jul 21 15:16:22 CEST 2022


Commit: 63be57307eba75c05e7584a2e43373e489b451fb
Author: Hans Goudey
Date:   Thu Jul 21 08:15:06 2022 -0500
Branches: master
https://developer.blender.org/rB63be57307eba75c05e7584a2e43373e489b451fb

Cleanup: Rename length parameterization interpolation function

The name makes more sense as an action, other interpolation
methods besides linear probably don't make sense here anyway.

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

M	source/blender/blenlib/BLI_length_parameterize.hh
M	source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc
M	source/blender/geometry/intern/resample_curves.cc

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

diff --git a/source/blender/blenlib/BLI_length_parameterize.hh b/source/blender/blenlib/BLI_length_parameterize.hh
index c44bb94f65d..035d4d04787 100644
--- a/source/blender/blenlib/BLI_length_parameterize.hh
+++ b/source/blender/blenlib/BLI_length_parameterize.hh
@@ -42,10 +42,10 @@ void accumulate_lengths(const Span<T> values, const bool cyclic, MutableSpan<flo
 }
 
 template<typename T>
-inline void linear_interpolation(const Span<T> src,
-                                 const Span<int> indices,
-                                 const Span<float> factors,
-                                 MutableSpan<T> dst)
+inline void interpolate(const Span<T> src,
+                        const Span<int> indices,
+                        const Span<float> factors,
+                        MutableSpan<T> dst)
 {
   BLI_assert(indices.size() == factors.size());
   BLI_assert(indices.size() == dst.size());
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
index 10564942ab9..ff27c16dc36 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
@@ -366,7 +366,7 @@ void move_last_point_and_resample(MutableSpan<float3> positions, const float3 &n
   length_parameterize::sample_at_lengths(orig_lengths, new_lengths, indices, factors);
 
   Array<float3> new_positions(positions.size() - 1);
-  length_parameterize::linear_interpolation<float3>(positions, indices, factors, new_positions);
+  length_parameterize::interpolate<float3>(positions, indices, factors, new_positions);
   positions.drop_back(1).copy_from(new_positions);
   positions.last() = new_last_position;
 }
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc b/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc
index 408139d6653..8ef18ba7da7 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc
@@ -127,7 +127,7 @@ class ShrinkCurvesEffect : public CurvesEffect {
 
     lp::sample_at_lengths(data.old_lengths, data.sample_lengths, data.indices, data.factors);
 
-    lp::linear_interpolation<float3>(data.old_positions, data.indices, data.factors, positions);
+    lp::interpolate<float3>(data.old_positions, data.indices, data.factors, positions);
   }
 };
 
diff --git a/source/blender/geometry/intern/resample_curves.cc b/source/blender/geometry/intern/resample_curves.cc
index 2c3a6c6e0cf..29e358cc3f4 100644
--- a/source/blender/geometry/intern/resample_curves.cc
+++ b/source/blender/geometry/intern/resample_curves.cc
@@ -252,10 +252,10 @@ static Curves *resample_to_uniform(const CurveComponent &src_component,
           const IndexRange dst_points = dst_curves.points_for_curve(i_curve);
 
           if (curve_types[i_curve] == CURVE_TYPE_POLY) {
-            length_parameterize::linear_interpolation(src.slice(src_points),
-                                                      sample_indices.as_span().slice(dst_points),
-                                                      sample_factors.as_span().slice(dst_points),
-                                                      dst.slice(dst_points));
+            length_parameterize::interpolate(src.slice(src_points),
+                                             sample_indices.as_span().slice(dst_points),
+                                             sample_factors.as_span().slice(dst_points),
+                                             dst.slice(dst_points));
           }
           else {
             const int evaluated_size = src_curves.evaluated_points_for_curve(i_curve).size();
@@ -264,10 +264,10 @@ static Curves *resample_to_uniform(const CurveComponent &src_component,
             MutableSpan<T> evaluated = evaluated_buffer.as_mutable_span().cast<T>();
             src_curves.interpolate_to_evaluated(i_curve, src.slice(src_points), evaluated);
 
-            length_parameterize::linear_interpolation(evaluated.as_span(),
-                                                      sample_indices.as_span().slice(dst_points),
-                                                      sample_factors.as_span().slice(dst_points),
-                                                      dst.slice(dst_points));
+            length_parameterize::interpolate(evaluated.as_span(),
+                                             sample_indices.as_span().slice(dst_points),
+                                             sample_factors.as_span().slice(dst_points),
+                                             dst.slice(dst_points));
           }
         }
       });
@@ -277,10 +277,10 @@ static Curves *resample_to_uniform(const CurveComponent &src_component,
     for (const int i_curve : sliced_selection) {
       const IndexRange src_points = src_curves.evaluated_points_for_curve(i_curve);
       const IndexRange dst_points = dst_curves.points_for_curve(i_curve);
-      length_parameterize::linear_interpolation(evaluated_positions.slice(src_points),
-                                                sample_indices.as_span().slice(dst_points),
-                                                sample_factors.as_span().slice(dst_points),
-                                                dst_positions.slice(dst_points));
+      length_parameterize::interpolate(evaluated_positions.slice(src_points),
+                                       sample_indices.as_span().slice(dst_points),
+                                       sample_factors.as_span().slice(dst_points),
+                                       dst_positions.slice(dst_points));
     }
 
     /* Fill the default value for non-interpolating attributes that still must be copied. */



More information about the Bf-blender-cvs mailing list