diff options
author | Hans Goudey <h.goudey@me.com> | 2021-06-22 07:07:26 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-06-22 07:07:26 +0300 |
commit | e1d6219731fc38c40f3dc55224e8ab6cfb217dd2 (patch) | |
tree | d11d7c6db56437ecd4c3fd3966bc746dc79d65a3 /source/blender/blenkernel/intern/spline_bezier.cc | |
parent | dc3b7602eeb08df788c6dcd1dee6860d58a5010d (diff) |
Cleanup: Use "size" instead of "points_len" in spline code
Previously this was mostly consistent, but not completely. It's helpful
to use the same name for the same meaning everywhere in this area.
Diffstat (limited to 'source/blender/blenkernel/intern/spline_bezier.cc')
-rw-r--r-- | source/blender/blenkernel/intern/spline_bezier.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc index e4f26eaf466..daae03167ef 100644 --- a/source/blender/blenkernel/intern/spline_bezier.cc +++ b/source/blender/blenkernel/intern/spline_bezier.cc @@ -392,13 +392,13 @@ Span<int> BezierSpline::control_point_offsets() const return offset_cache_; } - const int points_len = this->size(); - offset_cache_.resize(points_len + 1); + const int size = this->size(); + offset_cache_.resize(size + 1); MutableSpan<int> offsets = offset_cache_; int offset = 0; - for (const int i : IndexRange(points_len)) { + for (const int i : IndexRange(size)) { offsets[i] = offset; offset += this->segment_is_vector(i) ? 1 : resolution_; } @@ -527,23 +527,23 @@ Span<float3> BezierSpline::evaluated_positions() const BezierSpline::InterpolationData BezierSpline::interpolation_data_from_index_factor( const float index_factor) const { - const int points_len = this->size(); + const int size = this->size(); if (is_cyclic_) { - if (index_factor < points_len) { + if (index_factor < size) { const int index = std::floor(index_factor); - const int next_index = (index < points_len - 1) ? index + 1 : 0; + const int next_index = (index < size - 1) ? index + 1 : 0; return InterpolationData{index, next_index, index_factor - index}; } - return InterpolationData{points_len - 1, 0, 1.0f}; + return InterpolationData{size - 1, 0, 1.0f}; } - if (index_factor < points_len - 1) { + if (index_factor < size - 1) { const int index = std::floor(index_factor); const int next_index = index + 1; return InterpolationData{index, next_index, index_factor - index}; } - return InterpolationData{points_len - 2, points_len - 1, 1.0f}; + return InterpolationData{size - 2, size - 1, 1.0f}; } /* Use a spline argument to avoid adding this to the header. */ |