From e7e183aa2b99b8c787a2d2c357cdc4f61f0f6bf1 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 14 May 2021 16:37:05 -0500 Subject: Cleanup: Update / improve comments --- source/blender/blenkernel/BKE_spline.hh | 8 ++++++-- source/blender/blenkernel/intern/spline_bezier.cc | 6 +++++- source/blender/blenkernel/intern/spline_nurbs.cc | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh index 54a8e97d5c6..acff2843806 100644 --- a/source/blender/blenkernel/BKE_spline.hh +++ b/source/blender/blenkernel/BKE_spline.hh @@ -48,10 +48,12 @@ using SplinePtr = std::unique_ptr; * evaluation happens in a layer on top of the evaluated points generated by the derived types. * * There are a few methods to evaluate a spline: - * 1. #evaluated_positions and #interpolate_to_evaluated_points give data at the initial + * 1. #evaluated_positions and #interpolate_to_evaluated_points give data for the initial * evaluated points, depending on the resolution. * 2. #lookup_evaluated_factor and #lookup_evaluated_factor are meant for one-off lookups * along the length of a curve. + * 3. #sample_uniform_index_factors returns an array that stores uniform-length samples + * along the spline which can be used to interpolate data from method 1. * * Commonly used evaluated data is stored in caches on the spline itself so that operations on * splines don't need to worry about taking ownership of evaluated data when they don't need to. @@ -288,7 +290,7 @@ class BezierSpline final : public Spline { int next_control_point_index; /** * Linear interpolation weight between the two indices, from 0 to 1. - * Higher means next control point. + * Higher means closer to next control point. */ float factor; }; @@ -319,6 +321,8 @@ class NURBSpline final : public Spline { EndPoint, Bezier, }; + + /** Method used to recalculate the knots vector when points are added or removed. */ KnotsMode knots_mode; struct BasisCache { diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc index ba0f33e0093..58a8f46730a 100644 --- a/source/blender/blenkernel/intern/spline_bezier.cc +++ b/source/blender/blenkernel/intern/spline_bezier.cc @@ -168,6 +168,10 @@ static float3 next_position(Span positions, const bool cyclic, const int return positions[i + 1]; } +/** + * Recalculate all #Auto and #Vector handles with positions automatically + * derived from the neighboring control points. + */ void BezierSpline::ensure_auto_handles() const { if (!auto_handles_dirty_) { @@ -504,7 +508,7 @@ Span BezierSpline::evaluated_positions() const /** * Convert the data encoded in #evaulated_mappings into its parts-- the information necessary * to interpolate data from control points to evaluated points between them. The next control - * point index result will not overflow the size of the vector. + * point index result will not overflow the size of the control point vectors. */ BezierSpline::InterpolationData BezierSpline::interpolation_data_from_index_factor( const float index_factor) const diff --git a/source/blender/blenkernel/intern/spline_nurbs.cc b/source/blender/blenkernel/intern/spline_nurbs.cc index 2022b9fb85a..7816f303e2e 100644 --- a/source/blender/blenkernel/intern/spline_nurbs.cc +++ b/source/blender/blenkernel/intern/spline_nurbs.cc @@ -259,7 +259,7 @@ static void calculate_basis_for_point(const float parameter, MutableSpan basis_buffer, NURBSpline::BasisCache &basis_cache) { - /* Clamp parameter due to floating point inaccuracy. TODO: Look into using doubles. */ + /* Clamp parameter due to floating point inaccuracy. */ const float t = std::clamp(parameter, knots[0], knots[points_len + order - 1]); int start = 0; -- cgit v1.2.3