Blender V5.0
blender::bke::curves::catmull_rom Namespace Reference

Functions

int calculate_evaluated_num (int points_num, bool cyclic, int resolution)
void interpolate_to_evaluated (GSpan src, bool cyclic, int resolution, GMutableSpan dst)
void interpolate_to_evaluated (const GSpan src, const bool cyclic, const OffsetIndices< int > evaluated_offsets, GMutableSpan dst)
float4 calculate_basis (const float parameter)
template<typename T>
T interpolate (const T &a, const T &b, const T &c, const T &d, const float parameter)
template<typename T>
static void evaluate_segment (const T &a, const T &b, const T &c, const T &d, MutableSpan< T > dst)
template<typename T, typename RangeForSegmentFn>
static void interpolate_to_evaluated (const Span< T > src, const bool cyclic, const RangeForSegmentFn &range_fn, MutableSpan< T > dst)
template<typename T>
static void interpolate_to_evaluated (const Span< T > src, const bool cyclic, const int resolution, MutableSpan< T > dst)
template<typename T>
static void interpolate_to_evaluated (const Span< T > src, const bool cyclic, const OffsetIndices< int > evaluated_offsets, MutableSpan< T > dst)

Function Documentation

◆ calculate_basis()

float4 blender::bke::curves::catmull_rom::calculate_basis ( const float parameter)

◆ calculate_evaluated_num()

int blender::bke::curves::catmull_rom::calculate_evaluated_num ( int points_num,
bool cyclic,
int resolution )

Calculate the number of evaluated points that interpolate_to_evaluated is expected to produce.

Parameters
points_numThe number of points in the curve.
resolutionThe resolution for each segment.

Definition at line 16 of file curve_catmull_rom.cc.

References blender::bke::curves::segments_num().

Referenced by blender::bke::calculate_evaluated_offsets(), and interpolate_to_evaluated().

◆ evaluate_segment()

template<typename T>
void blender::bke::curves::catmull_rom::evaluate_segment ( const T & a,
const T & b,
const T & c,
const T & d,
MutableSpan< T > dst )
static

◆ interpolate()

template<typename T>
T blender::bke::curves::catmull_rom::interpolate ( const T & a,
const T & b,
const T & c,
const T & d,
const float parameter )

Interpolate the control point values for the given parameter on the piecewise segment.

Parameters
aValue associated with the first control point influencing the segment.
dValue associated with the fourth control point.
parameterParameter in range [0, 1] to compute the interpolation for.

Definition at line 827 of file BKE_curves.hh.

References b, BLI_assert, calculate_basis(), blender::is_same_any_v, blender::bke::attribute_math::mix4(), and T.

Referenced by evaluate_segment(), and blender::geometry::interpolate_catmull_rom().

◆ interpolate_to_evaluated() [1/5]

void blender::bke::curves::catmull_rom::interpolate_to_evaluated ( const GSpan src,
const bool cyclic,
const OffsetIndices< int > evaluated_offsets,
GMutableSpan dst )

Evaluate the Catmull Rom curve. The placement of each segment in the #dst span is described by #evaluated_offsets.

Definition at line 158 of file curve_catmull_rom.cc.

References blender::bke::attribute_math::convert_to_static_type(), and blender::GSpan::type().

◆ interpolate_to_evaluated() [2/5]

template<typename T>
void blender::bke::curves::catmull_rom::interpolate_to_evaluated ( const Span< T > src,
const bool cyclic,
const int resolution,
MutableSpan< T > dst )
static

◆ interpolate_to_evaluated() [3/5]

template<typename T>
void blender::bke::curves::catmull_rom::interpolate_to_evaluated ( const Span< T > src,
const bool cyclic,
const OffsetIndices< int > evaluated_offsets,
MutableSpan< T > dst )
static

Definition at line 132 of file curve_catmull_rom.cc.

References interpolate_to_evaluated().

◆ interpolate_to_evaluated() [4/5]

template<typename T, typename RangeForSegmentFn>
void blender::bke::curves::catmull_rom::interpolate_to_evaluated ( const Span< T > src,
const bool cyclic,
const RangeForSegmentFn & range_fn,
MutableSpan< T > dst )
static
Parameters
range_fnReturns an index range describing where in the #dst span each segment should be evaluated to, and how many points to add to it. This is used to avoid the need to allocate an actual offsets array in typical evaluation use cases where the resolution is per-curve.

Definition at line 57 of file curve_catmull_rom.cc.

References blender::IndexRange::drop_back(), blender::IndexRange::drop_front(), evaluate_segment(), blender::MutableSpan< T >::first(), blender::Span< T >::first(), i, blender::Span< T >::index_range(), blender::IndexRange::last(), blender::MutableSpan< T >::last(), blender::Span< T >::last(), blender::threading::parallel_for(), blender::Span< T >::size(), and blender::MutableSpan< T >::slice().

◆ interpolate_to_evaluated() [5/5]

void blender::bke::curves::catmull_rom::interpolate_to_evaluated ( GSpan src,
bool cyclic,
int resolution,
GMutableSpan dst )