|
Blender V5.0
|
Classes | |
| struct | BasisCache |
Functions | |
| bool | check_valid_eval_params (int points_num, int8_t order, bool cyclic, KnotsMode knots_mode, int resolution) |
| int | calculate_evaluated_num (int points_num, int8_t order, bool cyclic, int resolution, KnotsMode knots_mode, Span< float > knots) |
| int | knots_num (int points_num, int8_t order, bool cyclic) |
| int | control_points_num (int num_control_points, int8_t order, bool cyclic) |
| void | load_curve_knots (KnotsMode mode, int points_num, int8_t order, bool cyclic, IndexRange curve_knots, Span< float > custom_knots, MutableSpan< float > knots) |
| void | calculate_knots (int points_num, KnotsMode mode, int8_t order, bool cyclic, MutableSpan< float > knots) |
| Vector< int > | calculate_multiplicity_sequence (Span< float > knots) |
| void | calculate_basis_cache (int points_num, int evaluated_num, int8_t order, int resolution, bool cyclic, KnotsMode knots_mode, 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) |
| void | gather_custom_knots (const bke::CurvesGeometry &src, const IndexMask &src_curves, int dst_curve_offset, bke::CurvesGeometry &dst) |
| void | update_custom_knot_modes (const IndexMask &mask, const KnotsMode mode_for_regular, const KnotsMode mode_for_cyclic, bke::CurvesGeometry &curves) |
| void | copy_custom_knots (const bke::CurvesGeometry &src_curves, const IndexMask &exclude_curves, bke::CurvesGeometry &dst_curves) |
| static int | calc_nonzero_knot_spans (const int points_num, const KnotsMode mode, const int8_t order, const bool cyclic) |
| static bool | is_breakpoint (const Span< float > knots, const int knot_span) |
| static int | count_nonzero_knot_spans (const int points_num, const int order, const bool cyclic, const Span< float > knots) |
| static void | copy_custom_knots (const int8_t order, const bool cyclic, const Span< float > custom_knots, MutableSpan< float > knots) |
| static void | calculate_basis_for_point (const Span< float > knots, const int degree, const float parameter, const int span_index, 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) |
|
static |
Definition at line 40 of file curve_nurbs.cc.
References ELEM, knots_num(), NURBS_KNOT_MODE_BEZIER, NURBS_KNOT_MODE_ENDPOINT, and NURBS_KNOT_MODE_ENDPOINT_BEZIER.
Referenced by calculate_evaluated_num().
| void blender::bke::curves::nurbs::calculate_basis_cache | ( | int | points_num, |
| int | evaluated_num, | ||
| int8_t | order, | ||
| int | resolution, | ||
| bool | cyclic, | ||
| KnotsMode | knots_mode, | ||
| 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 232 of file curve_nurbs.cc.
References BLI_assert, check_valid_eval_params(), control_points_num(), blender::IndexRange::from_begin_end(), blender::Array< T, InlineBufferCapacity, Allocator >::index_range(), is_breakpoint(), blender::threading::parallel_for(), blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::bke::curves::nurbs::BasisCache::start_indices, and blender::bke::curves::nurbs::BasisCache::weights.
Referenced by blender::bke::tests::TEST(), and blender::bke::tests::TEST().
|
static |
Definition at line 200 of file curve_nurbs.cc.
References BLI_assert, left, and blender::Span< T >::size().
| int blender::bke::curves::nurbs::calculate_evaluated_num | ( | int | points_num, |
| int8_t | order, | ||
| bool | cyclic, | ||
| int | resolution, | ||
| KnotsMode | knots_mode, | ||
| Span< float > | knots ) |
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 83 of file curve_nurbs.cc.
References calc_nonzero_knot_spans(), check_valid_eval_params(), count_nonzero_knot_spans(), and blender::Span< T >::is_empty().
Referenced by blender::bke::calculate_evaluated_offsets(), blender::bke::tests::TEST(), and blender::bke::tests::TEST().
| 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 116 of file curve_nurbs.cc.
References BLI_assert, ELEM, i, knots_num(), min_ii(), NURBS_KNOT_MODE_BEZIER, NURBS_KNOT_MODE_ENDPOINT, NURBS_KNOT_MODE_ENDPOINT_BEZIER, blender::MutableSpan< T >::size(), and UNUSED_VARS_NDEBUG.
Referenced by blender::io::obj::OBJCurves::get_knots_u(), blender::io::obj::OBJLegacyCurve::get_knots_u(), load_curve_knots(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::io::obj::TEST_F(), and update_custom_knots().
Compute the number of occurrences of each unique knot value (so knot multiplicity), forming a sequence for which: sum(multiplicity) == knots.size().
Example: Knots: [0, 0, 0, 0.1, 0.3, 0.4, 0.4, 0.4] Result: [3, 1, 1, 3]
Definition at line 178 of file curve_nurbs.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::IndexRange::drop_front(), i, blender::Span< T >::index_range(), blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), and blender::Span< T >::size().
Referenced by blender::io::usd::determine_knots_mode(), blender::io::obj::repeating_cyclic_point_num(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::io::obj::TEST_F(), and blender::io::obj::valid_nurb_control_point_range().
| bool blender::bke::curves::nurbs::check_valid_eval_params | ( | int | points_num, |
| int8_t | order, | ||
| bool | cyclic, | ||
| KnotsMode | knots_mode, | ||
| int | resolution ) |
Checks the conditions that a NURBS curve needs to evaluate.
Definition at line 16 of file curve_nurbs.cc.
References ELEM, NURBS_KNOT_MODE_BEZIER, and NURBS_KNOT_MODE_ENDPOINT_BEZIER.
Referenced by calculate_basis_cache(), and calculate_evaluated_num().
|
inline |
Calculate the total number of control points for a NURBS curve including virtual/repeated points for a cyclic/closed curve.
Definition at line 1143 of file BKE_curves.hh.
Referenced by calculate_basis_cache(), count_nonzero_knot_spans(), blender::io::obj::OBJCurves::num_control_points_u(), and blender::io::obj::OBJLegacyCurve::num_control_points_u().
| void blender::bke::curves::nurbs::copy_custom_knots | ( | const bke::CurvesGeometry & | src_curves, |
| const IndexMask & | exclude_curves, | ||
| bke::CurvesGeometry & | dst_curves ) |
Copies NURBS custom knots from one CurvesGeometry instance to another excluding exclude_curves. For excluded curves with NURBS_KNOT_MODE_CUSTOM knot mode is overwritten to NURBS_KNOT_MODE_NORMAL.
Definition at line 274 of file curves_utils.cc.
References BLI_assert, blender::bke::CurvesGeometry::curves_num(), blender::IndexMask::from_difference(), gather_custom_knots(), blender::bke::CurvesGeometry::nurbs_custom_knot_curves(), blender::bke::CurvesGeometry::nurbs_has_custom_knots(), NURBS_KNOT_MODE_NORMAL, and update_custom_knot_modes().
Referenced by blender::geometry::convert_curves_to_bezier(), blender::geometry::convert_curves_to_catmull_rom_or_poly(), blender::geometry::convert_curves_to_nurbs(), load_curve_knots(), blender::geometry::resample_to_count(), blender::geometry::resample_to_evaluated(), blender::geometry::resample_to_length(), blender::geometry::resample_to_uniform(), and blender::geometry::subdivide_curves().
|
static |
Definition at line 100 of file curve_nurbs.cc.
References blender::MutableSpan< T >::copy_from(), blender::MutableSpan< T >::index_range(), blender::Span< T >::last(), blender::Span< T >::size(), blender::MutableSpan< T >::slice(), and blender::MutableSpan< T >::take_back().
|
static |
Definition at line 67 of file curve_nurbs.cc.
References BLI_assert, control_points_num(), blender::IndexRange::from_begin_end(), and is_breakpoint().
Referenced by calculate_evaluated_num().
| void blender::bke::curves::nurbs::gather_custom_knots | ( | const bke::CurvesGeometry & | src, |
| const IndexMask & | src_curves, | ||
| int | dst_curve_offset, | ||
| bke::CurvesGeometry & | dst ) |
Gathers NURBS custom knots of selected curves from one CurvesGeometry instance to another. Should be used to implement operator's custom knot copying logic. dst_curve_offset can be used to append knots to already existing ones in the CurvesGeometry.
Definition at line 239 of file curves_utils.cc.
References blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), blender::array_utils::gather_group_to_group(), blender::offset_indices::gather_selected_offsets(), blender::bke::CurvesGeometry::nurbs_custom_knots(), blender::bke::CurvesGeometry::nurbs_custom_knots_by_curve(), blender::bke::CurvesGeometry::nurbs_custom_knots_for_write(), and blender::index_mask::IndexMask::size().
Referenced by blender::ed::curves::append_curve_knots(), blender::geometry::copy_and_reorder_curves(), copy_custom_knots(), blender::ed::curves::pen_tool::extrude_curves(), blender::ed::greasepencil::extrude_grease_pencil_curves(), and blender::ed::curves::pen_tool::insert_point_to_curve().
|
static |
Definition at line 311 of file curve_nurbs.cc.
References blender::MutableSpan< T >::index_range(), interpolate_to_evaluated(), and blender::threading::parallel_for().
| 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 353 of file curve_nurbs.cc.
References BLI_assert, blender::bke::attribute_math::convert_to_static_type(), blender::GMutableSpan::copy_from(), interpolate_to_evaluated(), blender::bke::curves::nurbs::BasisCache::invalid, blender::GMutableSpan::size(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::bke::curves::nurbs::BasisCache::start_indices, and blender::GSpan::type().
Referenced by blender::bke::evaluate_generic_data_for_curve(), blender::bke::CurvesGeometry::evaluated_positions(), interpolate_to_evaluated(), interpolate_to_evaluated(), blender::draw::test_draw_curves_interpolate_attributes(), and blender::draw::test_draw_curves_interpolate_position().
|
static |
Definition at line 331 of file curve_nurbs.cc.
References blender::MutableSpan< T >::index_range(), interpolate_to_evaluated_rational(), and blender::threading::parallel_for().
Referenced by interpolate_to_evaluated_rational().
|
static |
Definition at line 62 of file curve_nurbs.cc.
Referenced by calculate_basis_cache(), and count_nonzero_knot_spans().
|
inline |
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 1137 of file BKE_curves.hh.
Referenced by calc_nonzero_knot_spans(), calculate_knots(), blender::bke::copy_point_selection_custom_knots(), blender::io::obj::OBJCurves::get_knots_u(), blender::io::obj::OBJLegacyCurve::get_knots_u(), blender::io::usd::populate_curve_props_for_nurbs(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::io::obj::TEST_F(), update_custom_knots(), and blender::io::obj::valid_nurb_control_point_range().
| void blender::bke::curves::nurbs::load_curve_knots | ( | KnotsMode | mode, |
| int | points_num, | ||
| int8_t | order, | ||
| bool | cyclic, | ||
| IndexRange | curve_knots, | ||
| Span< float > | custom_knots, | ||
| MutableSpan< float > | knots ) |
Depending on KnotsMode calculates knots or copies custom knots into given MutableSpan. Adds order - 1 length tail for cyclic curves.
Definition at line 160 of file curve_nurbs.cc.
References BLI_assert, calculate_knots(), copy_custom_knots(), blender::IndexRange::is_empty(), blender::Span< T >::is_empty(), NURBS_KNOT_MODE_CUSTOM, and blender::Span< T >::slice().
Referenced by blender::io::usd::populate_curve_props_for_nurbs().
| void blender::bke::curves::nurbs::update_custom_knot_modes | ( | const IndexMask & | mask, |
| const KnotsMode | mode_for_regular, | ||
| const KnotsMode | mode_for_cyclic, | ||
| bke::CurvesGeometry & | curves ) |
Overwrites NURBS_KNOT_MODE_CUSTOM to given ones for regular and cyclic curves. The purpose is to update knot modes for curves when knot copying or calculation is not possible or too complex. Curve operators not supporting NURBS custom knots should call this function with IndexMask CurvesGeometry.curves_range(), if resulting curves are created by copying all attributes. This way NURBS_KNOT_MODE_CUSTOM values might be copied though custom knots not.
Definition at line 258 of file curves_utils.cc.
References mask(), and NURBS_KNOT_MODE_CUSTOM.
Referenced by copy_custom_knots(), blender::geometry::curves_merge_endpoints(), blender::ed::curves::pen_tool::extrude_curves(), blender::ed::greasepencil::extrude_grease_pencil_curves(), blender::geometry::fillet_curves(), blender::ed::curves::pen_tool::insert_point_to_curve(), blender::geometry::remove_points_and_split(), blender::ed::curves::resize_curves(), and blender::geometry::trim_curves().