Cleanup: Update / improve comments
This commit is contained in:
parent
3c978a73d1
commit
e7e183aa2b
|
@ -48,10 +48,12 @@ using SplinePtr = std::unique_ptr<Spline>;
|
|||
* 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 {
|
||||
|
|
|
@ -168,6 +168,10 @@ static float3 next_position(Span<float3> 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<float3> 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
|
||||
|
|
|
@ -259,7 +259,7 @@ static void calculate_basis_for_point(const float parameter,
|
|||
MutableSpan<float> 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;
|
||||
|
|
Loading…
Reference in New Issue