Blender
V3.3
|
#include <BKE_spline.hh>
Classes | |
struct | InsertResult |
struct | InterpolationData |
Protected Member Functions | |
void | reverse_impl () override |
Additional Inherited Members | |
![]() | |
static void | copy_base_settings (const Spline &src, Spline &dst) |
![]() | |
NormalMode | normal_mode = NORMAL_MODE_MINIMUM_TWIST |
blender::bke::CustomDataAttributes | attributes |
![]() | |
CurveType | type_ |
bool | is_cyclic_ = false |
blender::Vector< blender::float3 > | evaluated_tangents_cache_ |
std::mutex | tangent_cache_mutex_ |
bool | tangent_cache_dirty_ = true |
blender::Vector< blender::float3 > | evaluated_normals_cache_ |
std::mutex | normal_cache_mutex_ |
bool | normal_cache_dirty_ = true |
blender::Vector< float > | evaluated_lengths_cache_ |
std::mutex | length_cache_mutex_ |
bool | length_cache_dirty_ = true |
A Bezier spline is made up of a many curve segments, possibly achieving continuity of curvature by constraining the alignment of curve handles. Evaluation stores the positions and a map of factors and indices in a list of floats, which is then used to interpolate any other data.
Definition at line 245 of file BKE_spline.hh.
|
inline |
Definition at line 277 of file BKE_spline.hh.
|
inline |
Definition at line 280 of file BKE_spline.hh.
BezierSpline::InsertResult BezierSpline::calculate_segment_insertion | ( | int | index, |
int | next_index, | ||
float | parameter | ||
) |
De Casteljau Bezier subdivision.
index | The index of the segment's start control point. |
next_index | The index of the control point at the end of the segment. Could be 0, if the spline is cyclic. |
parameter | The factor along the segment, between 0 and 1. Note that this is used directly by the calculation, it doesn't correspond to a portion of the evaluated length. |
handle_prev handle_next x----------------x / \ / x---O---x \ / result \ / \ O O point_prev point_next
Definition at line 361 of file spline_bezier.cc.
References BLI_assert, ELEM, blender::length_parameterize::interpolate(), and result.
Referenced by blender::nodes::node_geo_curve_trim_cc::to_single_point_bezier(), and blender::nodes::node_geo_curve_trim_cc::trim_bezier_spline().
Span< int > BezierSpline::control_point_offsets | ( | ) | const |
Returns access to a cache of offsets into the evaluated point array for each control point. While most control point edges generate the number of edges specified by the resolution, vector segments only generate one edge.
Definition at line 428 of file spline_bezier.cc.
References blender::MutableSpan< T >::first(), blender::MutableSpan< T >::last(), lock, offset, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), segment_is_vector(), and size().
Referenced by evaluated_mappings(), evaluated_points_num(), evaluated_positions(), blender::nodes::node_geo_curve_trim_cc::lookup_control_point_position(), and blender::nodes::node_geo_curve_trim_cc::trim_bezier_spline().
void BezierSpline::ensure_auto_handles | ( | ) | const |
Recalculate all #Auto and #Vector handles with positions automatically derived from the neighboring control points.
Definition at line 171 of file spline_bezier.cc.
References BEZIER_HANDLE_AUTO, BEZIER_HANDLE_VECTOR, ELEM, blender::length_parameterize::interpolate(), Spline::is_cyclic_, len, blender::math::length(), lock, min, next, next_position(), blender::meshintersect::prev(), previous_position(), and size().
Referenced by evaluated_positions(), handle_positions_left(), and handle_positions_right().
void BezierSpline::evaluate_segment | ( | int | index, |
int | next_index, | ||
blender::MutableSpan< blender::float3 > | positions | ||
) | const |
Definition at line 411 of file spline_bezier.cc.
References bezier_forward_difference_3d(), BLI_assert, positions(), and segment_is_vector().
Referenced by evaluated_positions().
Returns non-owning access to an array of values containing the information necessary to interpolate values from the original control points to evaluated points. The control point index is the integer part of each value, and the factor used for interpolating to the next control point is the remaining factional part.
Definition at line 494 of file spline_bezier.cc.
References calculate_mappings_linear_resolution(), control_point_offsets(), evaluated_points_num(), blender::MutableSpan< T >::first(), Spline::is_cyclic_, blender::threading::isolate_task(), lock, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), and size().
Referenced by interpolate_to_evaluated_impl().
|
finalvirtual |
Implements Spline.
Definition at line 338 of file spline_bezier.cc.
References BLI_assert, control_point_offsets(), blender::Span< T >::last(), and size().
Referenced by evaluated_mappings(), evaluated_positions(), interpolate_to_evaluated(), and interpolate_to_evaluated_impl().
Implements Spline.
Definition at line 527 of file spline_bezier.cc.
References BLI_assert, control_point_offsets(), ensure_auto_handles(), evaluate_segment(), evaluated_points_num(), Spline::is_cyclic_, blender::threading::isolate_task(), lock, max, blender::threading::parallel_for(), positions(), and size().
Definition at line 104 of file spline_bezier.cc.
References ensure_auto_handles().
Referenced by blender::bke::VArrayImpl_For_BezierHandles::get(), blender::bke::VArrayImpl_For_BezierHandles::get_handle_spans(), reverse_impl(), blender::bke::VArrayImpl_For_BezierHandles::set(), blender::bke::VArrayImpl_For_BezierHandles::set_all(), blender::nodes::node_geo_curve_trim_cc::to_single_point_bezier(), transform(), translate(), and blender::nodes::node_geo_curve_trim_cc::trim_bezier_spline().
MutableSpan< float3 > BezierSpline::handle_positions_left | ( | bool | write_only = false | ) |
Get writable access to the handle position.
write_only | pass true for an uninitialized spline, this prevents accessing uninitialized memory while auto-generating handles. |
Definition at line 109 of file spline_bezier.cc.
References ensure_auto_handles().
Definition at line 125 of file spline_bezier.cc.
References ensure_auto_handles().
Referenced by blender::bke::VArrayImpl_For_BezierHandles::get(), blender::bke::VArrayImpl_For_BezierHandles::get_handle_spans(), reverse_impl(), blender::bke::VArrayImpl_For_BezierHandles::set(), blender::bke::VArrayImpl_For_BezierHandles::set_all(), blender::nodes::node_geo_curve_trim_cc::to_single_point_bezier(), transform(), translate(), and blender::nodes::node_geo_curve_trim_cc::trim_bezier_spline().
MutableSpan< float3 > BezierSpline::handle_positions_right | ( | bool | write_only = false | ) |
Get writable access to the handle position.
write_only | pass true for an uninitialized spline, this prevents accessing uninitialized memory while auto-generating handles. |
Definition at line 130 of file spline_bezier.cc.
References ensure_auto_handles().
MutableSpan< int8_t > BezierSpline::handle_types_left | ( | ) |
Definition at line 100 of file spline_bezier.cc.
Definition at line 96 of file spline_bezier.cc.
Referenced by reverse_impl(), and blender::nodes::node_geo_curve_trim_cc::to_single_point_bezier().
MutableSpan< int8_t > BezierSpline::handle_types_right | ( | ) |
Definition at line 121 of file spline_bezier.cc.
Definition at line 117 of file spline_bezier.cc.
Referenced by reverse_impl(), and blender::nodes::node_geo_curve_trim_cc::to_single_point_bezier().
|
overridevirtual |
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 622 of file spline_bezier.cc.
References BLI_assert, blender::attribute_math::convert_to_static_type(), evaluated_points_num(), and src.
BezierSpline::InterpolationData BezierSpline::interpolation_data_from_index_factor | ( | float | index_factor | ) | 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 control point vectors.
Definition at line 579 of file spline_bezier.cc.
References blender::math::floor(), Spline::is_cyclic_, and size().
Referenced by interpolate_to_evaluated_impl().
|
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 327 of file spline_bezier.cc.
References Spline::length_cache_dirty_, Spline::normal_cache_dirty_, and Spline::tangent_cache_dirty_.
Referenced by resize(), blender::bke::VArrayImpl_For_BezierHandles::set(), blender::bke::VArrayImpl_For_BezierHandles::set_all(), set_resolution(), transform(), and translate().
bool BezierSpline::point_is_sharp | ( | int | index | ) | const |
Definition at line 303 of file spline_bezier.cc.
References BEZIER_HANDLE_FREE, BEZIER_HANDLE_VECTOR, and ELEM.
Implements Spline.
Definition at line 76 of file spline_bezier.cc.
|
finalvirtual |
Implements Spline.
Definition at line 72 of file spline_bezier.cc.
Referenced by evaluate_segment(), evaluated_positions(), blender::nodes::node_geo_curve_trim_cc::to_single_point_bezier(), transform(), translate(), and blender::nodes::node_geo_curve_trim_cc::trim_bezier_spline().
Implements Spline.
Definition at line 84 of file spline_bezier.cc.
|
finalvirtual |
Implements Spline.
Definition at line 80 of file spline_bezier.cc.
Referenced by blender::nodes::node_geo_curve_trim_cc::to_single_point_bezier(), and blender::nodes::node_geo_curve_trim_cc::trim_bezier_spline().
|
finalvirtual |
Implements Spline.
Definition at line 59 of file spline_bezier.cc.
References Spline::attributes, mark_cache_invalid(), blender::bke::CustomDataAttributes::reallocate(), blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), and size().
Referenced by blender::nodes::node_geo_curve_trim_cc::trim_bezier_spline().
int BezierSpline::resolution | ( | ) | const |
Definition at line 47 of file spline_bezier.cc.
Referenced by calculate_mappings_linear_resolution().
|
overrideprotectedvirtual |
Implements Spline.
Definition at line 138 of file spline_bezier.cc.
References handle_positions_left(), handle_positions_right(), handle_types_left(), handle_types_right(), and swap().
bool BezierSpline::segment_is_vector | ( | int | start_index | ) | const |
Definition at line 309 of file spline_bezier.cc.
References BEZIER_HANDLE_VECTOR, BLI_assert, blender::Vector< T, InlineBufferCapacity, Allocator >::first(), Spline::is_cyclic_, blender::Vector< T, InlineBufferCapacity, Allocator >::last(), and size().
Referenced by control_point_offsets(), and evaluate_segment().
void BezierSpline::set_handle_position_left | ( | int | index, |
const blender::float3 & | value | ||
) |
Set positions for the left handle of the control point, ensuring that aligned handles stay aligned. Has no effect for auto and vector type handles.
Definition at line 293 of file spline_bezier.cc.
References set_handle_position().
void BezierSpline::set_handle_position_right | ( | int | index, |
const blender::float3 & | value | ||
) |
Set positions for the right handle of the control point, ensuring that aligned handles stay aligned. Has no effect for auto and vector type handles.
Definition at line 283 of file spline_bezier.cc.
References set_handle_position().
void BezierSpline::set_resolution | ( | int | value | ) |
Definition at line 52 of file spline_bezier.cc.
References BLI_assert, and mark_cache_invalid().
|
finalvirtual |
Return the number of control points.
Implements Spline.
Definition at line 35 of file spline_bezier.cc.
References BLI_assert, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
Referenced by calculate_mappings_linear_resolution(), control_point_offsets(), ensure_auto_handles(), evaluated_mappings(), evaluated_points_num(), evaluated_positions(), interpolate_to_evaluated_impl(), interpolation_data_from_index_factor(), blender::nodes::node_geo_curve_trim_cc::lookup_control_point_position(), resize(), segment_is_vector(), and blender::bke::VArrayImpl_For_BezierHandles::set_all().
Implements Spline.
Definition at line 92 of file spline_bezier.cc.
|
finalvirtual |
Implements Spline.
Definition at line 88 of file spline_bezier.cc.
Referenced by blender::nodes::node_geo_curve_trim_cc::to_single_point_bezier(), and blender::nodes::node_geo_curve_trim_cc::trim_bezier_spline().
|
overridevirtual |
Reimplemented from Spline.
Definition at line 245 of file spline_bezier.cc.
References handle_positions_left(), handle_positions_right(), mark_cache_invalid(), and positions().
|
overridevirtual |
Reimplemented from Spline.
Definition at line 231 of file spline_bezier.cc.
References handle_positions_left(), handle_positions_right(), mark_cache_invalid(), and positions().