Cleanup: Rename curve segment count function
`curve_segment_num` -> `segments_num`. The "curve" prefix is reduntant for a function in the curve namespace.
This commit is contained in:
parent
e86c2f7288
commit
f4a9a3767e
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue