|
Blender V5.3
|
Classes | |
| struct | Insertion |
Functions | |
| bool | segment_is_vector (const HandleType left, const HandleType right) |
| bool | segment_is_vector (const int8_t left, const int8_t right) |
| bool | segment_is_vector (Span< int8_t > handle_types_left, Span< int8_t > handle_types_right, int segment_index) |
| bool | has_vector_handles (int num_curve_points, int64_t evaluated_size, bool cyclic, int resolution) |
| bool | last_cyclic_segment_is_vector (Span< int8_t > handle_types_left, Span< int8_t > handle_types_right) |
| bool | point_is_sharp (Span< int8_t > handle_types_left, Span< int8_t > handle_types_right, int index) |
| void | calculate_evaluated_offsets (Span< int8_t > handle_types_left, Span< int8_t > handle_types_right, bool cyclic, int resolution, MutableSpan< int > evaluated_offsets) |
| Insertion | insert (const float3 &point_prev, const float3 &handle_prev, const float3 &handle_next, const float3 &point_next, float parameter) |
| float3 | calculate_vector_handle (const float3 &point, const float3 &next_point) |
| void | calculate_auto_handles (bool cyclic, Span< int8_t > types_left, Span< int8_t > types_right, Span< float3 > positions, MutableSpan< float3 > positions_left, MutableSpan< float3 > positions_right) |
| void | calculate_single_aligned_handles (const IndexMask &selection, Span< float3 > positions, Span< float3 > align_with, MutableSpan< float3 > align_handles) |
| void | calculate_aligned_handles (const IndexMask &selection, Span< float3 > positions, Span< float3 > handles_left, Span< float3 > handles_right, MutableSpan< float3 > align_handles_left, MutableSpan< float3 > align_handles_right) |
| void | set_handle_position (const float3 &position, HandleType type, HandleType type_other, const float3 &new_handle, float3 &handle, float3 &handle_other) |
| template<typename T> | |
| void | evaluate_segment (const T &point_0, const T &point_1, const T &point_2, const T &point_3, MutableSpan< T > result) |
| void | calculate_evaluated_positions (Span< float3 > positions, Span< float3 > handles_left, Span< float3 > handles_right, OffsetIndices< int > evaluated_offsets, MutableSpan< float3 > evaluated_positions) |
| void | interpolate_to_evaluated (GSpan src, OffsetIndices< int > evaluated_offsets, GMutableSpan dst) |
| Array< float3 > | retrieve_all_positions (const bke::CurvesGeometry &curves, const IndexMask &curves_selection) |
| void | write_all_positions (bke::CurvesGeometry &curves, const IndexMask &curves_selection, Span< float3 > all_positions) |
| static float3 | calculate_aligned_handle (const float3 &position, const float3 &other_handle, const float3 &aligned_handle) |
| static std::pair< float3, float3 > | calculate_align_both_handles (const float3 &position, const float3 &left_handle, const float3 &right_handle) |
| static void | calculate_point_handles (const HandleType type_left, const HandleType type_right, const float3 position, const float3 prev_position, const float3 next_position, float3 &left, float3 &right) |
| template<typename T> | |
| void | evaluate_segment_ex (const T &point_0, const T &point_1, const T &point_2, const T &point_3, MutableSpan< T > result) |
| template<> | |
| void | evaluate_segment (const float3 &point_0, const float3 &point_1, const float3 &point_2, const float3 &point_3, MutableSpan< float3 > result) |
| template<> | |
| void | evaluate_segment (const float2 &point_0, const float2 &point_1, const float2 &point_2, const float2 &point_3, MutableSpan< float2 > result) |
| template<typename T> | |
| static void | linear_interpolation (const T &a, const T &b, MutableSpan< T > dst) |
| template<typename T> | |
| static void | interpolate_to_evaluated (const Span< T > src, const OffsetIndices< int > evaluated_offsets, MutableSpan< T > dst) |
|
static |
Definition at line 107 of file curve_bezier.cc.
References calculate_align_both_handles(), blender::math::dot(), blender::math::length(), blender::math::normalize(), and position.
Referenced by calculate_align_both_handles(), and calculate_aligned_handles().
|
static |
Definition at line 89 of file curve_bezier.cc.
References calculate_aligned_handle(), blender::math::distance(), blender::math::is_zero(), length(), blender::math::normalize(), and position.
Referenced by calculate_aligned_handle(), calculate_point_handles(), calculate_single_aligned_handles(), and set_handle_position().
| void blender::bke::curves::bezier::calculate_aligned_handles | ( | const IndexMask & | selection, |
| Span< float3 > | positions, | ||
| Span< float3 > | handles_left, | ||
| Span< float3 > | handles_right, | ||
| MutableSpan< float3 > | align_handles_left, | ||
| MutableSpan< float3 > | align_handles_right ) |
Definition at line 251 of file curve_bezier.cc.
References calculate_align_both_handles(), calculate_aligned_handles(), blender::index_mask::IndexMask::foreach_index_optimized(), and blender::exec_mode::grain_size().
Referenced by calculate_aligned_handles(), and blender::bke::CurvesGeometry::calculate_bezier_aligned_handles().
| void blender::bke::curves::bezier::calculate_auto_handles | ( | bool | cyclic, |
| Span< int8_t > | types_left, | ||
| Span< int8_t > | types_right, | ||
| Span< float3 > | positions, | ||
| MutableSpan< float3 > | positions_left, | ||
| MutableSpan< float3 > | positions_right ) |
Recalculate all auto (BEZIER_HANDLE_AUTO) and vector (BEZIER_HANDLE_VECTOR) handles with positions automatically derived from the neighboring control points, and update aligned (BEZIER_HANDLE_ALIGN) handles to line up with neighboring non-aligned handles. The choices made here are relatively arbitrary, but having standardized behavior is essential.
Definition at line 268 of file curve_bezier.cc.
References calculate_auto_handles(), calculate_point_handles(), blender::MutableSpan< T >::first(), blender::Span< T >::first(), blender::IndexRange::IndexRange(), blender::MutableSpan< T >::last(), blender::Span< T >::last(), blender::threading::parallel_for(), and blender::Span< T >::size().
Referenced by calculate_auto_handles(), blender::bke::CurvesGeometry::calculate_bezier_auto_handles(), and blender::bke::tests::TEST_F().
| void blender::bke::curves::bezier::calculate_evaluated_offsets | ( | Span< int8_t > | handle_types_left, |
| Span< int8_t > | handle_types_right, | ||
| bool | cyclic, | ||
| int | resolution, | ||
| MutableSpan< int > | evaluated_offsets ) |
Calculate offsets into the curve's evaluated points for each control point. While most control point edges generate the number of edges specified by the resolution, vector segments only generate one edge.
The expectations for the result evaluated_offsets are the same as for OffsetIndices, so the size must be one greater than the number of points. The value at each index is the evaluated point at the start of that segment.
Definition at line 33 of file curve_bezier.cc.
References blender::BLI_assert(), calculate_evaluated_offsets(), blender::MutableSpan< T >::first(), blender::IndexRange::IndexRange(), blender::MutableSpan< T >::last(), last_cyclic_segment_is_vector(), segment_is_vector(), blender::MutableSpan< T >::size(), and blender::Span< T >::size().
Referenced by blender::bke::calculate_evaluated_offsets(), and calculate_evaluated_offsets().
| void blender::bke::curves::bezier::calculate_evaluated_positions | ( | Span< float3 > | positions, |
| Span< float3 > | handles_left, | ||
| Span< float3 > | handles_right, | ||
| OffsetIndices< int > | evaluated_offsets, | ||
| MutableSpan< float3 > | evaluated_positions ) |
Calculate all evaluated points for the Bezier curve.
| evaluated_offsets | The index in the evaluated points array for each control point, including the points from the corresponding segment. Used to vary the number of evaluated points per segment, i.e. to make vector segment only have one edge. This is expected to be calculated by calculate_evaluated_offsets, and is the reason why this function doesn't need arguments like "cyclic" and "resolution". |
Definition at line 352 of file curve_bezier.cc.
References blender::BLI_assert(), calculate_evaluated_positions(), blender::IndexRange::drop_back(), blender::IndexRange::drop_front(), evaluate_segment(), blender::IndexRange::first(), blender::MutableSpan< T >::first(), blender::Span< T >::first(), blender::Span< T >::index_range(), blender::IndexRange::last(), blender::MutableSpan< T >::last(), blender::Span< T >::last(), blender::threading::parallel_for(), blender::IndexRange::size(), blender::MutableSpan< T >::size(), blender::Span< T >::size(), blender::MutableSpan< T >::slice(), and blender::offset_indices::OffsetIndices< T >::total_size().
Referenced by calculate_evaluated_positions(), evaluate_segment(), blender::bke::CurvesGeometry::evaluated_positions(), and blender::draw::test_draw_curves_interpolate_position().
|
static |
Definition at line 151 of file curve_bezier.cc.
References blender::BEZIER_HANDLE_ALIGN, blender::BEZIER_HANDLE_AUTO, blender::BEZIER_HANDLE_VECTOR, calculate_aligned_handle(), calculate_point_handles(), calculate_vector_handle(), ELEM, len(), blender::math::length(), and position.
Referenced by calculate_auto_handles(), and calculate_point_handles().
| void blender::bke::curves::bezier::calculate_single_aligned_handles | ( | const IndexMask & | selection, |
| Span< float3 > | positions, | ||
| Span< float3 > | align_with, | ||
| MutableSpan< float3 > | align_handles ) |
Definition at line 238 of file curve_bezier.cc.
References calculate_aligned_handle(), calculate_single_aligned_handles(), blender::index_mask::IndexMask::foreach_index_optimized(), and blender::exec_mode::grain_size().
Referenced by calculate_single_aligned_handles(), and blender::ed::transform::curves::calculate_single_aligned_handles().
|
inline |
Calculate the automatically defined positions for a vector handle (BEZIER_HANDLE_VECTOR). While this can be calculated automatically with calculate_auto_handles, when more context is available, it can be preferable for performance reasons to calculate it for a single segment when necessary.
Definition at line 1141 of file BKE_curves.hh.
References calculate_vector_handle(), and blender::math::interpolate().
Referenced by calculate_point_handles(), and calculate_vector_handle().
| void blender::bke::curves::bezier::evaluate_segment | ( | const float2 & | point_0, |
| const float2 & | point_1, | ||
| const float2 & | point_2, | ||
| const float2 & | point_3, | ||
| MutableSpan< float2 > | result ) |
Definition at line 343 of file curve_bezier.cc.
References evaluate_segment(), evaluate_segment_ex(), and blender::result.
| void blender::bke::curves::bezier::evaluate_segment | ( | const float3 & | point_0, |
| const float3 & | point_1, | ||
| const float3 & | point_2, | ||
| const float3 & | point_3, | ||
| MutableSpan< float3 > | result ) |
Definition at line 334 of file curve_bezier.cc.
References evaluate_segment(), evaluate_segment_ex(), and blender::result.
| void blender::bke::curves::bezier::evaluate_segment | ( | const T & | point_0, |
| const T & | point_1, | ||
| const T & | point_2, | ||
| const T & | point_3, | ||
| MutableSpan< T > | result ) |
Evaluate a cubic Bezier segment, using the "forward differencing" method. A generic Bezier curve is made up by four points, but in many cases the first and last points are referred to as the control points, and the middle points are the corresponding handles.
References calculate_evaluated_positions(), evaluate_segment(), interpolate_to_evaluated(), blender::result, and T.
Referenced by calculate_evaluated_positions(), evaluate_segment(), evaluate_segment(), evaluate_segment(), and blender::ed::sculpt_paint::greasepencil::sample_curve_2d().
| void blender::bke::curves::bezier::evaluate_segment_ex | ( | const T & | point_0, |
| const T & | point_1, | ||
| const T & | point_2, | ||
| const T & | point_3, | ||
| MutableSpan< T > | result ) |
Definition at line 310 of file curve_bezier.cc.
References blender::BLI_assert(), evaluate_segment_ex(), float, blender::result, and T.
Referenced by evaluate_segment(), evaluate_segment(), and evaluate_segment_ex().
|
inline |
True if the Bezier curve contains polygonal segments of HandleType::BEZIER_HANDLE_VECTOR.
| num_curve_points | Number of points in the curve. |
| evaluated_size | Number of evaluated points in the curve. |
| cyclic | If curve is cyclic. |
| resolution | Curve resolution. |
Definition at line 1133 of file BKE_curves.hh.
References has_vector_handles(), and blender::bke::curves::segments_num().
Referenced by has_vector_handles(), and blender::geometry::lookup_point_bezier().
| Insertion blender::bke::curves::bezier::insert | ( | const float3 & | point_prev, |
| const float3 & | handle_prev, | ||
| const float3 & | handle_next, | ||
| const float3 & | point_next, | ||
| float | parameter ) |
Compute the insertion of a control point and handles in a Bezier segment without changing its shape.
| parameter | Factor in from 0 to 1 defining the insertion point within the segment. |
handle_prev handle_next
x-----------------x
/ \
/ x---O---x \
/ result \
/ \
O O
point_prev point_next
Definition at line 69 of file curve_bezier.cc.
References blender::BLI_assert(), insert(), blender::math::interpolate(), and blender::result.
Referenced by insert(), blender::ed::curves::pen_tool::insert_point_to_curve(), blender::geometry::knot_insert_bezier(), blender::geometry::sample_bezier_curve_positions_handles(), blender::geometry::sample_interval_bezier(), and blender::geometry::subdivide_bezier_segment().
|
static |
Definition at line 415 of file curve_bezier.cc.
References blender::BLI_assert(), blender::IndexRange::drop_back(), blender::IndexRange::drop_front(), blender::MutableSpan< T >::first(), blender::Span< T >::first(), blender::Span< T >::index_range(), interpolate_to_evaluated(), blender::Span< T >::is_empty(), linear_interpolation(), blender::threading::parallel_for(), blender::MutableSpan< T >::size(), blender::Span< T >::size(), blender::MutableSpan< T >::slice(), and blender::offset_indices::OffsetIndices< T >::total_size().
| void blender::bke::curves::bezier::interpolate_to_evaluated | ( | GSpan | src, |
| OffsetIndices< int > | evaluated_offsets, | ||
| GMutableSpan | dst ) |
Evaluate generic data to the evaluated points, with counts for each segment described by #evaluated_offsets. Unlike other curve types, for Bezier curves generic data and positions are treated separately, since attribute values aren't stored for the handle control points.
Definition at line 441 of file curve_bezier.cc.
References interpolate_to_evaluated(), T, blender::bke::attribute_math::to_static_type(), and blender::GSpan::type().
Referenced by blender::bke::evaluate_generic_data_for_curve(), evaluate_segment(), interpolate_to_evaluated(), interpolate_to_evaluated(), blender::draw::test_draw_curves_interpolate_attributes(), and blender::draw::test_draw_curves_interpolate_position().
| bool blender::bke::curves::bezier::last_cyclic_segment_is_vector | ( | Span< int8_t > | handle_types_left, |
| Span< int8_t > | handle_types_right ) |
Return true if the curve's last cyclic segment has a vector type. This only makes a difference in the shape of cyclic curves.
Definition at line 27 of file curve_bezier.cc.
References blender::Span< T >::first(), blender::Span< T >::last(), last_cyclic_segment_is_vector(), and segment_is_vector().
Referenced by calculate_evaluated_offsets(), and last_cyclic_segment_is_vector().
|
inlinestatic |
Definition at line 405 of file curve_bezier.cc.
References b, blender::IndexRange::drop_front(), blender::MutableSpan< T >::first(), blender::MutableSpan< T >::index_range(), linear_interpolation(), blender::bke::attribute_math::mix2(), blender::MutableSpan< T >::size(), step, and T.
Referenced by interpolate_to_evaluated(), and linear_interpolation().
|
inline |
Return true if the handle types at the index are free (BEZIER_HANDLE_FREE) or vector (BEZIER_HANDLE_VECTOR). In these cases, directional continuities from the previous and next evaluated segments is assumed not to be desired.
Definition at line 1115 of file BKE_curves.hh.
References blender::BEZIER_HANDLE_FREE, blender::BEZIER_HANDLE_VECTOR, ELEM, and point_is_sharp().
Referenced by blender::bke::mark_bezier_vector_edges_sharp(), and point_is_sharp().
| Array< float3 > blender::bke::curves::bezier::retrieve_all_positions | ( | const bke::CurvesGeometry & | curves, |
| const IndexMask & | curves_selection ) |
Return a flat array of all the bezier positions including the left and right handles. The layout is [handle_left#0, position#0, handle_right#0, handle_left#1, position#1, handle_right#1, ...]
Definition at line 198 of file curves_utils.cc.
References blender::CURVE_TYPE_BEZIER, blender::index_mask::IndexMask::foreach_index(), blender::exec_mode::grain_size(), retrieve_all_positions(), and blender::Span< T >::size().
Referenced by blender::ed::object::data_xform_create_ex(), retrieve_all_positions(), and blender::geometry::smooth_curve_positions().
|
inline |
Return true if the handles that make up a segment both have a vector type. Vector segments for Bezier curves have special behavior because they aren't divided into many evaluated points.
Definition at line 1123 of file BKE_curves.hh.
References blender::BEZIER_HANDLE_VECTOR, and segment_is_vector().
Referenced by calculate_evaluated_offsets(), last_cyclic_segment_is_vector(), segment_is_vector(), segment_is_vector(), segment_is_vector(), and blender::geometry::subdivide_bezier_segment().
|
inline |
Definition at line 1128 of file BKE_curves.hh.
References segment_is_vector().
| bool blender::bke::curves::bezier::segment_is_vector | ( | Span< int8_t > | handle_types_left, |
| Span< int8_t > | handle_types_right, | ||
| int | segment_index ) |
Definition at line 18 of file curve_bezier.cc.
References blender::BLI_assert(), blender::IndexRange::contains(), blender::IndexRange::drop_back(), blender::Span< T >::index_range(), and segment_is_vector().
| void blender::bke::curves::bezier::set_handle_position | ( | const float3 & | position, |
| HandleType | type, | ||
| HandleType | type_other, | ||
| const float3 & | new_handle, | ||
| float3 & | handle, | ||
| float3 & | handle_other ) |
Change the handles of a single control point, aligning any aligned (BEZIER_HANDLE_ALIGN) handles on the other side of the control point.
Definition at line 220 of file curve_bezier.cc.
References blender::BEZIER_HANDLE_ALIGN, blender::BEZIER_HANDLE_AUTO, blender::BEZIER_HANDLE_VECTOR, calculate_aligned_handle(), ELEM, position, and set_handle_position().
Referenced by set_handle_position().
| void blender::bke::curves::bezier::write_all_positions | ( | bke::CurvesGeometry & | curves, |
| const IndexMask & | curves_selection, | ||
| Span< float3 > | all_positions ) |
Write to handle_position_left, position, and handle_position_right from a lat array of positions.
| curves_selection | The curves to write to. |
| all_positions | All positions of the selected bezier curves. The size of all_positions must be equal to 3 * the size of curves_selection. |
Definition at line 228 of file curves_utils.cc.
References blender::CURVE_TYPE_BEZIER, blender::index_mask::IndexMask::foreach_index(), blender::exec_mode::grain_size(), blender::index_mask::IndexMask::is_empty(), and write_all_positions().
Referenced by blender::ed::object::data_xform_by_mat4(), blender::ed::object::data_xform_restore(), and write_all_positions().