354 std::optional<Bounds<float3>>
bounds_min_max(
bool use_radius =
true)
const;
429 void ensure_nurbs_basis_cache()
const;
502 return this->adapt_domain(
GVArray(varray), from, to).
typed<
T>();
552 std::optional<Span<float3>>
positions()
const;
577 return (cyclic && points_num > 1) ? points_num : points_num - 1;
588 return {
v.x,
v.y, 1.0f -
v.x -
v.y};
599 return {curve_index + points.
start(), points.
size() + 1};
718 const float3 &handle_prev,
719 const float3 &handle_next,
844 BLI_assert(0.0f <= parameter && parameter <= 1.0f);
869 int points_num,
int8_t order,
bool cyclic,
KnotsMode knots_mode,
int resolution);
945 BasisCache &basis_cache);
983 GeometrySet &geometry);
986 const IndexMask &points_to_copy,
987 const AttributeFilter &attribute_filter);
990 const IndexMask &curves_to_copy,
991 const AttributeFilter &attribute_filter);
1041 types.
begin(), types.
end(), [&](
CurveType type) { return this->has_curve_with_type(type); });
1079inline IndexRange CurvesGeometry::lengths_range_for_curve(
const int curve_index,
1080 const bool cyclic)
const
1084 const int start = points.
start() + curve_index;
1091 const IndexRange range = this->lengths_range_for_curve(curve_index,
cyclic);
1102 return lengths.
last();
1136 const int resolution)
1138 return evaluated_size - !cyclic !=
int64_t(
segments_num(num_curve_points, cyclic)) * resolution;
1159 return points_num + order + cyclic * (order - 1);
1164 return points_num + cyclic * (order - 1);
1194inline const bke::CurvesGeometry &CurvesGeometry::wrap()
const
1196 return *
reinterpret_cast<const bke::CurvesGeometry *
>(
this);
Low-level operations for curves that cannot be defined in the C++ header yet.
VArray< T > typed() const
constexpr int64_t size() const
constexpr IndexRange()=default
constexpr int64_t start() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr const T & last(const int64_t n=0) const
constexpr const T * end() const
constexpr const T * begin() const
constexpr bool is_empty() const
const Curves & curves_id_orig
std::optional< MutableSpan< float3 > > positions_for_write()
ImplicitSharingPtrAndData positions_data
std::optional< Span< float3 > > positions() const
CurvesEditHints(const Curves &curves_id_orig)
std::optional< Array< float3x3 > > deform_mats
SharedCache< Vector< curves::nurbs::BasisCache > > nurbs_basis_cache
SharedCache< Vector< float > > evaluated_length_cache
SharedCache< Bounds< float3 > > bounds_with_radius_cache
SharedCache< Vector< int > > custom_knot_offsets_cache
SharedCache< Vector< float3 > > evaluated_tangent_cache
SharedCache< EvaluatedOffsets > evaluated_offsets_cache
SharedCache< Vector< float3 > > evaluated_normal_cache
std::unique_ptr< bake::BakeMaterialsList > bake_materials
const ImplicitSharingInfo * custom_knots_sharing_info
SharedCache< std::optional< int > > max_material_index_cache
SharedCache< Bounds< float3 > > bounds_cache
SharedCache< Vector< float3 > > evaluated_position_cache
const ImplicitSharingInfo * curve_offsets_sharing_info
SharedCache< bool > has_cyclic_curve_cache
std::array< int, CURVE_TYPES_NUM > type_counts
Span< float3 > evaluated_tangents() const
MutableSpan< MDeformVert > deform_verts_for_write()
MutableSpan< int8_t > handle_types_left_for_write()
VArray< int8_t > curve_types() const
void ensure_can_interpolate_to_evaluated() const
void update_curve_types()
VArray< int8_t > nurbs_orders() const
std::optional< Span< float > > nurbs_weights() const
void calculate_bezier_auto_handles()
int evaluated_points_num() const
MutableSpan< int8_t > nurbs_orders_for_write()
void blend_write(BlendWriter &writer, ID &id, const BlendWriteData &write_data)
Span< float > nurbs_custom_knots() const
std::optional< int > material_index_max() const
bool has_cyclic_curve() const
MutableSpan< float3 > positions_for_write()
MutableSpan< int8_t > handle_types_right_for_write()
std::optional< Bounds< float3 > > bounds_min_max(bool use_radius=true) const
void blend_read(BlendDataReader &reader)
void remove_points(const IndexMask &points_to_delete, const AttributeFilter &attribute_filter)
void transform(const float4x4 &matrix)
std::optional< Span< float3 > > handle_positions_right() const
MutableSpan< int8_t > normal_mode_for_write()
void resize(int points_num, int curves_num)
MutableSpan< float > tilt_for_write()
VArray< bool > cyclic() const
OffsetIndices< int > nurbs_custom_knots_by_curve() const
AttributeAccessor attributes() const
MutableSpan< float > nurbs_custom_knots_for_write()
Span< float3 > positions() const
bool is_single_type(CurveType type) const
void interpolate_to_evaluated(int curve_index, GSpan src, GMutableSpan dst) const
void tag_topology_changed()
MutableSpan< float3 > handle_positions_right_for_write()
MutableSpan< float2 > surface_uv_coords_for_write()
void remove_attributes_based_on_types()
bool nurbs_has_custom_knots() const
std::optional< Span< float3 > > handle_positions_left() const
void calculate_bezier_aligned_handles()
Span< int > bezier_evaluated_offsets_for_curve(int curve_index) const
IndexRange curves_range() const
std::optional< Span< float2 > > surface_uv_coords() const
Span< MDeformVert > deform_verts() const
MutableSpan< int > resolution_for_write()
void blend_write_prepare(BlendWriteData &write_data, bool use_5_0_compatibility)
void tag_normals_changed()
VArray< int8_t > normal_mode() const
IndexMask nurbs_custom_knot_curves(IndexMaskMemory &memory) const
VArray< int8_t > nurbs_knots_modes() const
MutableSpan< int8_t > curve_types_for_write()
IndexMask indices_for_curve_type(CurveType type, IndexMaskMemory &memory) const
CurvesGeometry & operator=(const CurvesGeometry &other)
MutableSpan< int8_t > nurbs_knots_modes_for_write()
VArray< int8_t > handle_types_left() const
Span< float > evaluated_lengths_for_curve(int curve_index, bool cyclic) const
void ensure_evaluated_lengths() const
OffsetIndices< int > evaluated_points_by_curve() const
MutableSpan< float3 > handle_positions_left_for_write()
Span< int > offsets() const
bool has_curve_with_type(CurveType type) const
MutableSpan< int > offsets_for_write()
IndexRange points_range() const
void fill_curve_types(CurveType type)
const std::array< int, CURVE_TYPES_NUM > & curve_type_counts() const
Span< float3 > evaluated_positions() const
VArray< int > resolution() const
void tag_positions_changed()
MutableSpan< float > radius_for_write()
float evaluated_length_total_for_curve(int curve_index, bool cyclic) const
VArray< T > adapt_domain(const VArray< T > &varray, AttrDomain from, AttrDomain to) const
MutableSpan< float > nurbs_weights_for_write()
VArray< int8_t > handle_types_right() const
VArray< float > tilt() const
VArray< float > radius() const
GVArray adapt_domain(const GVArray &varray, AttrDomain from, AttrDomain to) const
MutableSpan< bool > cyclic_for_write()
void count_memory(MemoryCounter &memory) const
void nurbs_custom_knots_resize(int knots_num)
void remove_curves(const IndexMask &curves_to_delete, const AttributeFilter &attribute_filter)
void tag_material_index_changed()
OffsetIndices< int > points_by_curve() const
Span< float3 > evaluated_normals() const
Array< int > point_to_curve_map() const
MutableAttributeAccessor attributes_for_write()
void reverse_curves(const IndexMask &curves_to_reverse)
void translate(const float3 &translation)
void nurbs_custom_knots_update_size()
T mix4(const float4 &weights, const T &v0, const T &v1, const T &v2, const T &v3)
Insertion insert(const float3 &point_prev, const float3 &handle_prev, const float3 &handle_next, const float3 &point_next, float parameter)
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)
bool segment_is_vector(const HandleType left, const HandleType right)
bool point_is_sharp(Span< int8_t > handle_types_left, Span< int8_t > handle_types_right, int index)
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_evaluated_offsets(Span< int8_t > handle_types_left, Span< int8_t > handle_types_right, bool cyclic, int resolution, MutableSpan< int > evaluated_offsets)
float3 calculate_vector_handle(const float3 &point, const float3 &next_point)
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)
void evaluate_segment(const T &point_0, const T &point_1, const T &point_2, const T &point_3, MutableSpan< T > result)
void calculate_single_aligned_handles(const IndexMask &selection, Span< float3 > positions, Span< float3 > align_with, MutableSpan< float3 > align_handles)
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)
void set_handle_position(const float3 &position, HandleType type, HandleType type_other, const float3 &new_handle, float3 &handle, float3 &handle_other)
T interpolate(const T &a, const T &b, const T &c, const T &d, const float parameter)
int calculate_evaluated_num(int points_num, bool cyclic, int resolution)
float4 calculate_basis(const float parameter)
void interpolate_to_evaluated(GSpan src, bool cyclic, int resolution, GMutableSpan dst)
Vector< int > calculate_multiplicity_sequence(Span< float > knots)
int calculate_evaluated_num(int points_num, int8_t order, bool cyclic, int resolution, KnotsMode knots_mode, Span< float > knots)
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, int resolution, bool cyclic, KnotsMode knots_mode, Span< float > knots, BasisCache &basis_cache)
bool check_valid_eval_params(int points_num, int8_t order, bool cyclic, KnotsMode knots_mode, int resolution)
int knots_num(int points_num, 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)
int control_points_num(int points_num, int8_t order, bool cyclic)
void interpolate_to_evaluated(const BasisCache &basis_cache, int8_t order, Span< float > control_weights, GSpan src, GMutableSpan dst)
void calculate_normals_z_up(Span< float3 > tangents, MutableSpan< float3 > normals)
void calculate_normals_minimum(Span< float3 > tangents, bool cyclic, MutableSpan< float3 > normals)
void calculate_tangents(Span< float3 > positions, bool is_cyclic, MutableSpan< float3 > tangents)
IndexRange per_curve_point_offsets_range(const IndexRange points, const int curve_index)
float3 decode_surface_bary_coord(const float2 &v)
int segments_num(const int points_num, const bool cyclic)
float2 encode_surface_bary_coord(const float3 &v)
const AttributeAccessorFunctions & get_attribute_accessor_functions()
CurvesGeometry curves_copy_curve_selection(const CurvesGeometry &curves, const IndexMask &curves_to_copy, const AttributeFilter &attribute_filter)
CurvesGeometry curves_copy_point_selection(const CurvesGeometry &curves, const IndexMask &points_to_copy, const AttributeFilter &attribute_filter)
void curves_copy_parameters(const Curves &src, Curves &dst)
CurvesGeometry curves_new_no_attributes(int point_num, int curve_num)
void curves_store_surface_in_geometry_bundle(const Depsgraph &depsgraph, const Curves &curves, GeometrySet &geometry)
std::array< int, CURVE_TYPES_NUM > calculate_type_counts(const VArray< int8_t > &types)
Curves * curves_new_nomain_single(int points_num, CurveType type)
Curves * curves_new_nomain(int points_num, int curves_num)
void curves_normals_point_domain_calc(const CurvesGeometry &curves, MutableSpan< float3 > normals)
T interpolate(const T &a, const T &b, const FactorT &t)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
constexpr bool is_same_any_v
ATTR_WARN_UNUSED_RESULT const BMVert * v
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< float, 2 > float2
VecBase< float, 3 > float3
static unordered_map< ustring, NodeType > & types()
bke::CurvesGeometryRuntime * runtime
Vector< int > all_bezier_offsets
Vector< int > evaluated_offsets
Vector< CustomDataLayer, 16 > & curve_layers
BlendWriteData(BlendWriter *writer, ResourceScope &scope)
Vector< CustomDataLayer, 16 > & point_layers
AttributeStorage::BlendWriteData attribute_data
Vector< int > start_indices