Blender
V3.3
|
Classes | |
struct | BasisCache |
Functions | |
bool | check_valid_num_and_order (int points_num, int8_t order, bool cyclic, KnotsMode knots_mode) |
int | calculate_evaluated_num (int points_num, int8_t order, bool cyclic, int resolution, KnotsMode knots_mode) |
int | knots_num (int points_num, int8_t order, bool cyclic) |
void | calculate_knots (int points_num, KnotsMode mode, int8_t order, bool cyclic, MutableSpan< float > knots) |
void | calculate_basis_cache (int points_num, int evaluated_num, int8_t order, bool cyclic, Span< float > knots, BasisCache &basis_cache) |
void | interpolate_to_evaluated (const BasisCache &basis_cache, int8_t order, Span< float > control_weights, GSpan src, GMutableSpan dst) |
static void | calculate_basis_for_point (const float parameter, const int points_num, const int degree, const Span< float > knots, MutableSpan< float > r_weights, int &r_start_index) |
template<typename T > | |
static void | interpolate_to_evaluated (const BasisCache &basis_cache, const int8_t order, const Span< T > src, MutableSpan< T > dst) |
template<typename T > | |
static void | interpolate_to_evaluated_rational (const BasisCache &basis_cache, const int8_t order, const Span< float > control_weights, const Span< T > src, MutableSpan< T > dst) |
void blender::bke::curves::nurbs::calculate_basis_cache | ( | int | points_num, |
int | evaluated_num, | ||
int8_t | order, | ||
bool | cyclic, | ||
Span< float > | knots, | ||
BasisCache & | basis_cache | ||
) |
Based on the knots, the order, and other properties of a NURBS curve, calculate a cache that can be used to more simply interpolate attributes to the evaluated points later. The cache includes two pieces of information for every evaluated point: the first control point that influences it, and a weight for each control point.
Definition at line 149 of file curve_nurbs.cc.
References BLI_assert, calculate_basis_for_point(), blender::math::clamp(), order, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::bke::curves::segments_num(), blender::MutableSpan< T >::slice(), blender::bke::curves::nurbs::BasisCache::start_indices, and blender::bke::curves::nurbs::BasisCache::weights.
|
static |
Definition at line 96 of file curve_nurbs.cc.
References buffer, blender::MutableSpan< T >::copy_from(), max, order, and blender::Span< T >::size().
Referenced by calculate_basis_cache().
int blender::bke::curves::nurbs::calculate_evaluated_num | ( | int | points_num, |
int8_t | order, | ||
bool | cyclic, | ||
int | resolution, | ||
KnotsMode | knots_mode | ||
) |
Calculate the standard evaluated size for a NURBS curve, using the standard that the resolution is multiplied by the number of segments between the control points.
Definition at line 32 of file curve_nurbs.cc.
References check_valid_num_and_order(), order, and blender::bke::curves::segments_num().
void blender::bke::curves::nurbs::calculate_knots | ( | int | points_num, |
KnotsMode | mode, | ||
int8_t | order, | ||
bool | cyclic, | ||
MutableSpan< float > | knots | ||
) |
Calculate the knots for a curve given its properties, based on built-in standards defined by KnotsMode.
Definition at line 52 of file curve_nurbs.cc.
References BLI_assert, ELEM, knots_num(), min_ii(), NURBS_KNOT_MODE_BEZIER, NURBS_KNOT_MODE_ENDPOINT, NURBS_KNOT_MODE_ENDPOINT_BEZIER, offset, order, r, blender::MutableSpan< T >::size(), and UNUSED_VARS_NDEBUG.
bool blender::bke::curves::nurbs::check_valid_num_and_order | ( | int | points_num, |
int8_t | order, | ||
bool | cyclic, | ||
KnotsMode | knots_mode | ||
) |
Checks the conditions that a NURBS curve needs to evaluate.
Definition at line 13 of file curve_nurbs.cc.
References ELEM, NURBS_KNOT_MODE_BEZIER, NURBS_KNOT_MODE_ENDPOINT_BEZIER, and order.
Referenced by calculate_evaluated_num().
|
static |
Definition at line 188 of file curve_nurbs.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::as_span(), blender::Span< T >::index_range(), blender::MutableSpan< T >::index_range(), order, point_index, blender::Span< T >::slice(), src, blender::bke::curves::nurbs::BasisCache::start_indices, and blender::bke::curves::nurbs::BasisCache::weights.
void blender::bke::curves::nurbs::interpolate_to_evaluated | ( | const BasisCache & | basis_cache, |
int8_t | order, | ||
Span< float > | control_weights, | ||
GSpan | src, | ||
GMutableSpan | dst | ||
) |
Using a "basis cache" generated by #BasisCache, interpolate attribute values to the evaluated points. The number of evaluated points is determined by the #basis_cache argument.
control_weights | An optional span of control point weights, which must have the same size as the number of control points in the curve if provided. Using this argument gives a NURBS curve the "Rational" behavior that's part of its acronym; otherwise it is a NUBS. |
Definition at line 229 of file curve_nurbs.cc.
References BLI_assert, blender::attribute_math::convert_to_static_type(), blender::GMutableSpan::copy_from(), blender::bke::curves::nurbs::BasisCache::invalid, blender::GMutableSpan::size(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), src, and blender::bke::curves::nurbs::BasisCache::start_indices.
|
static |
Definition at line 208 of file curve_nurbs.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::as_span(), blender::Span< T >::index_range(), blender::MutableSpan< T >::index_range(), order, point_index, blender::Span< T >::slice(), src, blender::bke::curves::nurbs::BasisCache::start_indices, and blender::bke::curves::nurbs::BasisCache::weights.
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.
Definition at line 44 of file curve_nurbs.cc.
References order.
Referenced by calculate_knots().