Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-03-24 07:01:02 +0300
committerHans Goudey <h.goudey@me.com>2022-03-24 07:05:46 +0300
commite253f9f66d6f63592ffd97afe207ef7c72547d03 (patch)
tree9a9345ab1184f0f6fda51740967595cc2f52a4bf /source/blender/blenkernel/BKE_curves.hh
parenta1598d6835d0c579579881bca900f9259b26d11a (diff)
Cleanup: Adjust naming in new curves code
Rename "size" variables and functions to use "num" instead, based on T85728 (though this doesn't apply to simple C++ containers, it applies here). Rename "range" to "points" in some functions, so be more specific. Differential Revision: https://developer.blender.org/D14431
Diffstat (limited to 'source/blender/blenkernel/BKE_curves.hh')
-rw-r--r--source/blender/blenkernel/BKE_curves.hh38
1 files changed, 19 insertions, 19 deletions
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh
index eb4f8f5d5c8..5039b6f0f57 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -122,14 +122,14 @@ class CurvesGeometry : public ::CurvesGeometry {
* Accessors.
*/
- int points_size() const;
- int curves_size() const;
+ int num_points() const;
+ int num_curves() const;
IndexRange points_range() const;
IndexRange curves_range() const;
/**
* The index of the first point in every curve. The size of this span is one larger than the
- * number of curves. Consider using #range_for_curve rather than using the offsets directly.
+ * number of curves. Consider using #points_for_curve rather than using the offsets directly.
*/
Span<int> offsets() const;
MutableSpan<int> offsets();
@@ -137,8 +137,8 @@ class CurvesGeometry : public ::CurvesGeometry {
/**
* Access a range of indices of point data for a specific curve.
*/
- IndexRange range_for_curve(int index) const;
- IndexRange range_for_curves(IndexRange curves) const;
+ IndexRange points_for_curve(int index) const;
+ IndexRange points_for_curves(IndexRange curves) const;
/** The type (#CurveType) of each curve, or potentially a single if all are the same type. */
VArray<int8_t> curve_types() const;
@@ -249,11 +249,11 @@ class CurvesGeometry : public ::CurvesGeometry {
* Access a range of indices of point data for a specific curve.
* Call #evaluated_offsets() first to ensure that the evaluated offsets cache is current.
*/
- IndexRange evaluated_range_for_curve(int index) const;
+ IndexRange evaluated_points_for_curve(int index) const;
/**
* The index of the first evaluated point for every curve. The size of this span is one larger
- * than the number of curves. Consider using #evaluated_range_for_curve rather than using the
+ * than the number of curves. Consider using #evaluated_points_for_curve rather than using the
* offsets directly.
*/
Span<int> evaluated_offsets() const;
@@ -275,7 +275,7 @@ class CurvesGeometry : public ::CurvesGeometry {
* Change the number of elements. New values for existing attributes should be properly
* initialized afterwards.
*/
- void resize(int point_size, int curve_size);
+ void resize(int num_points, int num_curves);
/** Call after deforming the position attribute. */
void tag_positions_changed();
@@ -314,9 +314,9 @@ namespace curves {
* and the fact that curves with two points cannot be cyclic. The logic is simple, but this
* function should be used to make intentions clearer.
*/
-inline int curve_segment_size(const int size, const bool cyclic)
+inline int curve_segment_size(const int num_points, const bool cyclic)
{
- return (cyclic && size > 2) ? size : size - 1;
+ return (cyclic && num_points > 2) ? num_points : num_points - 1;
}
namespace bezier {
@@ -381,10 +381,10 @@ namespace catmull_rom {
/**
* Calculate the number of evaluated points that #interpolate_to_evaluated is expected to produce.
- * \param size: The number of points in the curve.
+ * \param num_points: The number of points in the curve.
* \param resolution: The resolution for each segment.
*/
-int calculate_evaluated_size(int size, bool cyclic, int resolution);
+int calculate_evaluated_size(int num_points, bool cyclic, int resolution);
/**
* Evaluate the Catmull Rom curve. The length of the #dst span should be calculated with
@@ -399,7 +399,7 @@ namespace nurbs {
/**
* Checks the conditions that a NURBS curve needs to evaluate.
*/
-bool check_valid_size_and_order(int size, int8_t order, bool cyclic, KnotsMode knots_mode);
+bool check_valid_size_and_order(int num_points, int8_t order, bool cyclic, KnotsMode knots_mode);
/**
* Calculate the standard evaluated size for a NURBS curve, using the standard that
@@ -410,14 +410,14 @@ bool check_valid_size_and_order(int size, int8_t order, bool cyclic, KnotsMode k
* shared.
*/
int calculate_evaluated_size(
- int size, int8_t order, bool cyclic, int resolution, KnotsMode knots_mode);
+ int num_points, int8_t order, bool cyclic, int resolution, KnotsMode knots_mode);
/**
* Calculate the length of the knot vector for a NURBS curve with the given properties.
* The knots must be longer for a cyclic curve, for example, in order to provide weights for the
* last evaluated points that are also influenced by the first control points.
*/
-int knots_size(int size, int8_t order, bool cyclic);
+int knots_size(int num_points, int8_t order, bool cyclic);
/**
* Calculate the knots for a spline given its properties, based on built-in standards defined by
@@ -428,7 +428,7 @@ int knots_size(int size, int8_t order, bool cyclic);
* changes, and is generally more intuitive than defining the knot vector manually.
*/
void calculate_knots(
- int size, KnotsMode mode, int8_t order, bool cyclic, MutableSpan<float> knots);
+ int num_points, KnotsMode mode, int8_t order, bool cyclic, MutableSpan<float> knots);
/**
* Based on the knots, the order, and other properties of a NURBS curve, calculate a cache that can
@@ -436,7 +436,7 @@ void calculate_knots(
* two pieces of information for every evaluated point: the first control point that influences it,
* and a weight for each control point.
*/
-void calculate_basis_cache(int size,
+void calculate_basis_cache(int num_points,
int evaluated_size,
int8_t order,
bool cyclic,
@@ -461,11 +461,11 @@ void interpolate_to_evaluated(const BasisCache &basis_cache,
} // namespace curves
-Curves *curves_new_nomain(int point_size, int curves_size);
+Curves *curves_new_nomain(int num_points, int num_curves);
/**
* Create a new curves data-block containing a single curve with the given length and type.
*/
-Curves *curves_new_nomain_single(int point_size, CurveType type);
+Curves *curves_new_nomain_single(int num_points, CurveType type);
} // namespace blender::bke