diff options
author | Hans Goudey <h.goudey@me.com> | 2022-07-04 04:44:56 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-07-04 04:44:56 +0300 |
commit | f4a9a3767ee2f5c34c8f8fa6e4dc89232bb3dcd6 (patch) | |
tree | 4d6571f2a56bce840d6d6a85c3a27771adbf3e6a | |
parent | e86c2f7288724bd6fec33ff43e89816d7520a2b3 (diff) |
Cleanup: Rename curve segment count function
`curve_segment_num` -> `segments_num`.
The "curve" prefix is reduntant for a function in the curve namespace.
6 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh index 2bebd3ff97d..b1f096b1c39 100644 --- a/source/blender/blenkernel/BKE_curves.hh +++ b/source/blender/blenkernel/BKE_curves.hh @@ -423,7 +423,7 @@ namespace curves { * The number of segments between control points, accounting for the last segment of cyclic * curves. The logic is simple, but this function should be used to make intentions clearer. */ -inline int curve_segment_num(const int points_num, const bool cyclic) +inline int segments_num(const int points_num, const bool cyclic) { BLI_assert(points_num > 0); return (cyclic && points_num > 1) ? points_num : points_num - 1; @@ -782,7 +782,7 @@ inline IndexRange CurvesGeometry::lengths_range_for_curve(const int curve_index, BLI_assert(cyclic == this->cyclic()[curve_index]); const IndexRange points = this->evaluated_points_for_curve(curve_index); const int start = points.start() + curve_index; - return {start, curves::curve_segment_num(points.size(), cyclic)}; + return {start, curves::segments_num(points.size(), cyclic)}; } inline Span<float> CurvesGeometry::evaluated_lengths_for_curve(const int curve_index, diff --git a/source/blender/blenkernel/intern/curve_catmull_rom.cc b/source/blender/blenkernel/intern/curve_catmull_rom.cc index 4b2174c912c..1875c7b366a 100644 --- a/source/blender/blenkernel/intern/curve_catmull_rom.cc +++ b/source/blender/blenkernel/intern/curve_catmull_rom.cc @@ -11,7 +11,7 @@ namespace blender::bke::curves::catmull_rom { int calculate_evaluated_num(const int points_num, const bool cyclic, const int resolution) { - const int eval_num = resolution * curve_segment_num(points_num, cyclic); + const int eval_num = resolution * segments_num(points_num, cyclic); /* If the curve isn't cyclic, one last point is added to the final point. */ return cyclic ? eval_num : eval_num + 1; } diff --git a/source/blender/blenkernel/intern/curve_nurbs.cc b/source/blender/blenkernel/intern/curve_nurbs.cc index cd6b64e9a03..3ab6fb01ea5 100644 --- a/source/blender/blenkernel/intern/curve_nurbs.cc +++ b/source/blender/blenkernel/intern/curve_nurbs.cc @@ -38,7 +38,7 @@ int calculate_evaluated_num(const int points_num, if (!check_valid_num_and_order(points_num, order, cyclic, knots_mode)) { return points_num; } - return resolution * curve_segment_num(points_num, cyclic); + return resolution * segments_num(points_num, cyclic); } int knots_num(const int points_num, const int8_t order, const bool cyclic) @@ -168,7 +168,7 @@ void calculate_basis_cache(const int points_num, MutableSpan<int> basis_start_indices(basis_cache.start_indices); const int last_control_point_index = cyclic ? points_num + degree : points_num; - const int evaluated_segment_num = curve_segment_num(evaluated_num, cyclic); + const int evaluated_segment_num = segments_num(evaluated_num, cyclic); const float start = knots[degree]; const float end = knots[last_control_point_index]; diff --git a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc index 78e5d07da96..baf56c0c350 100644 --- a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc +++ b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc @@ -39,8 +39,8 @@ static void fill_mesh_topology(const int vert_offset, MutableSpan<MLoop> loops, MutableSpan<MPoly> polys) { - const int main_segment_num = curves::curve_segment_num(main_point_num, main_cyclic); - const int profile_segment_num = curves::curve_segment_num(profile_point_num, profile_cyclic); + const int main_segment_num = curves::segments_num(main_point_num, main_cyclic); + const int profile_segment_num = curves::segments_num(profile_point_num, profile_cyclic); if (profile_point_num == 1) { for (const int i : IndexRange(main_point_num - 1)) { @@ -273,7 +273,7 @@ static ResultOffsets calculate_result_offsets(const CurvesInfo &info, const bool for (const int i_main : info.main.curves_range()) { const bool main_cyclic = info.main_cyclic[i_main]; const int main_point_num = info.main.evaluated_points_for_curve(i_main).size(); - const int main_segment_num = curves::curve_segment_num(main_point_num, main_cyclic); + const int main_segment_num = curves::segments_num(main_point_num, main_cyclic); for (const int i_profile : info.profile.curves_range()) { result.vert[mesh_index] = vert_offset; result.edge[mesh_index] = edge_offset; @@ -285,7 +285,7 @@ static ResultOffsets calculate_result_offsets(const CurvesInfo &info, const bool const bool profile_cyclic = info.profile_cyclic[i_profile]; const int profile_point_num = info.profile.evaluated_points_for_curve(i_profile).size(); - const int profile_segment_num = curves::curve_segment_num(profile_point_num, profile_cyclic); + const int profile_segment_num = curves::segments_num(profile_point_num, profile_cyclic); const bool has_caps = fill_caps && !main_cyclic && profile_cyclic; const int tube_face_num = main_segment_num * profile_segment_num; @@ -407,8 +407,8 @@ static void foreach_curve_combination(const CurvesInfo &info, profile_points, main_cyclic, profile_cyclic, - curves::curve_segment_num(main_points.size(), main_cyclic), - curves::curve_segment_num(profile_points.size(), profile_cyclic), + curves::segments_num(main_points.size(), main_cyclic), + curves::segments_num(profile_points.size(), profile_cyclic), offsets_to_range(offsets.vert.as_span(), i), offsets_to_range(offsets.edge.as_span(), i), offsets_to_range(offsets.poly.as_span(), i), diff --git a/source/blender/blenlib/BLI_length_parameterize.hh b/source/blender/blenlib/BLI_length_parameterize.hh index ff957d92263..c44bb94f65d 100644 --- a/source/blender/blenlib/BLI_length_parameterize.hh +++ b/source/blender/blenlib/BLI_length_parameterize.hh @@ -17,7 +17,7 @@ namespace blender::length_parameterize { * Return the size of the necessary lengths array for a group of points, taking into account the * possible last cyclic segment. * - * \note This is the same as #bke::curves::curve_segment_num. + * \note This is the same as #bke::curves::segments_num. */ inline int segments_num(const int points_num, const bool cyclic) { diff --git a/source/blender/draw/intern/draw_cache_impl_curve.cc b/source/blender/draw/intern/draw_cache_impl_curve.cc index ebcdabe4942..695c348d8e2 100644 --- a/source/blender/draw/intern/draw_cache_impl_curve.cc +++ b/source/blender/draw/intern/draw_cache_impl_curve.cc @@ -108,7 +108,7 @@ static void curve_eval_render_wire_verts_edges_len_get(const blender::bke::Curve const blender::VArray<bool> cyclic = curves.cyclic(); for (const int i : curves.curves_range()) { const IndexRange points = curves.evaluated_points_for_curve(i); - *r_edge_len += blender::bke::curves::curve_segment_num(points.size(), cyclic[i]); + *r_edge_len += blender::bke::curves::segments_num(points.size(), cyclic[i]); } } |