Blender  V3.3
Classes | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
NURBSpline Class Referencefinal

#include <BKE_spline.hh>

Inheritance diagram for NURBSpline:
Spline

Classes

struct  BasisCache
 

Public Member Functions

 NURBSpline ()
 
 NURBSpline (const NURBSpline &other)
 
int size () const final
 
int resolution () const
 
void set_resolution (int value)
 
uint8_t order () const
 
void set_order (uint8_t value)
 
bool check_valid_num_and_order () const
 
int knots_num () const
 
void resize (int size) final
 
blender::MutableSpan< blender::float3positions () final
 
blender::Span< blender::float3positions () const final
 
blender::MutableSpan< floatradii () final
 
blender::Span< floatradii () const final
 
blender::MutableSpan< floattilts () final
 
blender::Span< floattilts () const final
 
blender::Span< floatknots () const
 
blender::MutableSpan< floatweights ()
 
blender::Span< floatweights () const
 
void mark_cache_invalid () final
 
int evaluated_points_num () const final
 
blender::Span< blender::float3evaluated_positions () const final
 
blender::GVArray interpolate_to_evaluated (const blender::GVArray &src) const final
 
- Public Member Functions inherited from Spline
virtual ~Spline ()=default
 
 Spline (const CurveType type)
 
 Spline (Spline &other)
 
SplinePtr copy () const
 
SplinePtr copy_only_settings () const
 
SplinePtr copy_without_attributes () const
 
CurveType type () const
 
int segments_num () const
 
bool is_cyclic () const
 
void set_cyclic (bool value)
 
virtual void translate (const blender::float3 &translation)
 
virtual void transform (const blender::float4x4 &matrix)
 
void reverse ()
 
int evaluated_edges_num () const
 
float length () const
 
blender::Span< floatevaluated_lengths () const
 
blender::Span< blender::float3evaluated_tangents () const
 
blender::Span< blender::float3evaluated_normals () const
 
void bounds_min_max (blender::float3 &min, blender::float3 &max, bool use_evaluated) const
 
LookupResult lookup_evaluated_factor (float factor) const
 
LookupResult lookup_evaluated_length (float length) const
 
blender::Array< floatsample_uniform_index_factors (int samples_num) const
 
LookupResult lookup_data_from_index_factor (float index_factor) const
 
void sample_with_index_factors (const blender::GVArray &src, blender::Span< float > index_factors, blender::GMutableSpan dst) const
 
template<typename T >
void sample_with_index_factors (const blender::VArray< T > &src, blender::Span< float > index_factors, blender::MutableSpan< T > dst) const
 
template<typename T >
void sample_with_index_factors (blender::Span< T > src, blender::Span< float > index_factors, blender::MutableSpan< T > dst) const
 
blender::GVArray interpolate_to_evaluated (blender::GSpan data) const
 
template<typename T >
blender::VArray< Tinterpolate_to_evaluated (blender::Span< T > data) const
 

Public Attributes

KnotsMode knots_mode
 
- Public Attributes inherited from Spline
NormalMode normal_mode = NORMAL_MODE_MINIMUM_TWIST
 
blender::bke::CustomDataAttributes attributes
 

Protected Member Functions

void correct_end_tangents () const final
 
void copy_settings (Spline &dst) const final
 
void copy_data (Spline &dst) const final
 
void reverse_impl () override
 
void calculate_knots () const
 
const BasisCachecalculate_basis_cache () const
 

Additional Inherited Members

- Static Public Member Functions inherited from Spline
static void copy_base_settings (const Spline &src, Spline &dst)
 
- Protected Attributes inherited from Spline
CurveType type_
 
bool is_cyclic_ = false
 
blender::Vector< blender::float3evaluated_tangents_cache_
 
std::mutex tangent_cache_mutex_
 
bool tangent_cache_dirty_ = true
 
blender::Vector< blender::float3evaluated_normals_cache_
 
std::mutex normal_cache_mutex_
 
bool normal_cache_dirty_ = true
 
blender::Vector< floatevaluated_lengths_cache_
 
std::mutex length_cache_mutex_
 
bool length_cache_dirty_ = true
 

Detailed Description

Data for Non-Uniform Rational B-Splines. The mapping from control points to evaluated points is influenced by a vector of knots, weights for each point, and the order of the spline. Every mapping of data to evaluated points is handled the same way, but the positions are cached in the spline.

Definition at line 443 of file BKE_spline.hh.

Constructor & Destructor Documentation

◆ NURBSpline() [1/2]

NURBSpline::NURBSpline ( )
inline

Definition at line 496 of file BKE_spline.hh.

◆ NURBSpline() [2/2]

NURBSpline::NURBSpline ( const NURBSpline other)
inline

Definition at line 499 of file BKE_spline.hh.

Member Function Documentation

◆ calculate_basis_cache()

const NURBSpline::BasisCache & NURBSpline::calculate_basis_cache ( ) const
protected

◆ calculate_knots()

void NURBSpline::calculate_knots ( ) const
protected

◆ check_valid_num_and_order()

bool NURBSpline::check_valid_num_and_order ( ) const

◆ copy_data()

void NURBSpline::copy_data ( Spline dst) const
finalprotectedvirtual

Implements Spline.

Definition at line 26 of file spline_nurbs.cc.

◆ copy_settings()

void NURBSpline::copy_settings ( Spline dst) const
finalprotectedvirtual

Implements Spline.

Definition at line 18 of file spline_nurbs.cc.

References knots_mode.

◆ correct_end_tangents()

void NURBSpline::correct_end_tangents ( ) const
finalprotectedvirtual

Implements Spline.

Definition at line 135 of file spline_nurbs.cc.

◆ evaluated_points_num()

int NURBSpline::evaluated_points_num ( ) const
finalvirtual

Implements Spline.

Definition at line 127 of file spline_nurbs.cc.

References check_valid_num_and_order(), and Spline::segments_num().

Referenced by calculate_basis_cache(), and evaluated_positions().

◆ evaluated_positions()

Span< float3 > NURBSpline::evaluated_positions ( ) const
finalvirtual

◆ interpolate_to_evaluated()

GVArray NURBSpline::interpolate_to_evaluated ( const blender::GVArray src) const
finalvirtual

Interpolate a virtual array of data with the size of the number of control points to the evaluated points. For poly splines, the lifetime of the returned virtual array must not exceed the lifetime of the input data.

Implements Spline.

Definition at line 352 of file spline_nurbs.cc.

References BLI_assert, calculate_basis_cache(), blender::attribute_math::convert_to_static_type(), and src.

◆ knots()

Span< float > NURBSpline::knots ( ) const

◆ knots_num()

int NURBSpline::knots_num ( ) const

Definition at line 155 of file spline_nurbs.cc.

References Spline::is_cyclic_, and size().

Referenced by calculate_knots().

◆ mark_cache_invalid()

void NURBSpline::mark_cache_invalid ( )
finalvirtual

Mark all caches for re-computation. This must be called after any operation that would change the generated positions, tangents, normals, mapping, etc. of the evaluated points.

Implements Spline.

Definition at line 118 of file spline_nurbs.cc.

References Spline::length_cache_dirty_, Spline::normal_cache_dirty_, and Spline::tangent_cache_dirty_.

Referenced by resize(), set_order(), and set_resolution().

◆ order()

uint8_t NURBSpline::order ( ) const

Definition at line 58 of file spline_nurbs.cc.

Referenced by calculate_basis_cache(), and calculate_knots().

◆ positions() [1/2]

Span< float3 > NURBSpline::positions ( ) const
finalvirtual

Implements Spline.

Definition at line 84 of file spline_nurbs.cc.

◆ positions() [2/2]

MutableSpan< float3 > NURBSpline::positions ( )
finalvirtual

Implements Spline.

Definition at line 80 of file spline_nurbs.cc.

◆ radii() [1/2]

Span< float > NURBSpline::radii ( ) const
finalvirtual

Implements Spline.

Definition at line 92 of file spline_nurbs.cc.

◆ radii() [2/2]

MutableSpan< float > NURBSpline::radii ( )
finalvirtual

Implements Spline.

Definition at line 88 of file spline_nurbs.cc.

◆ resize()

void NURBSpline::resize ( int  size)
finalvirtual

◆ resolution()

int NURBSpline::resolution ( ) const

Definition at line 46 of file spline_nurbs.cc.

◆ reverse_impl()

void NURBSpline::reverse_impl ( )
overrideprotectedvirtual

Implements Spline.

Definition at line 113 of file spline_nurbs.cc.

References weights().

◆ set_order()

void NURBSpline::set_order ( uint8_t  value)

Definition at line 63 of file spline_nurbs.cc.

References BLI_assert, and mark_cache_invalid().

◆ set_resolution()

void NURBSpline::set_resolution ( int  value)

Definition at line 51 of file spline_nurbs.cc.

References BLI_assert, and mark_cache_invalid().

◆ size()

int NURBSpline::size ( ) const
finalvirtual

Return the number of control points.

Implements Spline.

Definition at line 37 of file spline_nurbs.cc.

References BLI_assert, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().

Referenced by calculate_basis_cache(), check_valid_num_and_order(), knots_num(), and resize().

◆ tilts() [1/2]

Span< float > NURBSpline::tilts ( ) const
finalvirtual

Implements Spline.

Definition at line 100 of file spline_nurbs.cc.

◆ tilts() [2/2]

MutableSpan< float > NURBSpline::tilts ( )
finalvirtual

Implements Spline.

Definition at line 96 of file spline_nurbs.cc.

◆ weights() [1/2]

MutableSpan< float > NURBSpline::weights ( )

Definition at line 104 of file spline_nurbs.cc.

Referenced by calculate_basis_cache(), and reverse_impl().

◆ weights() [2/2]

Span< float > NURBSpline::weights ( ) const

Definition at line 108 of file spline_nurbs.cc.

Member Data Documentation

◆ knots_mode

KnotsMode NURBSpline::knots_mode

Method used to recalculate the knots vector when points are added or removed.

Definition at line 446 of file BKE_spline.hh.

Referenced by calculate_knots(), check_valid_num_and_order(), and copy_settings().


The documentation for this class was generated from the following files: