32class AttributeAccessor;
33class MutableAttributeAccessor;
37struct BakeMaterialsList;
42namespace curves::nurbs {
359 void ensure_nurbs_basis_cache()
const;
362 IndexRange lengths_range_for_curve(
int curve_index,
bool cyclic)
const;
471 std::optional<Span<float3>>
positions()
const;
496 return (cyclic && points_num > 1) ? points_num : points_num - 1;
507 return {
v.x,
v.y, 1.0f -
v.x -
v.y};
518 return {curve_index + points.
start(), points.size() + 1};
637 const float3 &handle_prev,
638 const float3 &handle_next,
685 const T &point_0,
const T &point_1,
const T &point_2,
const T &point_3,
MutableSpan<T> result);
717namespace catmull_rom {
750T
interpolate(
const T &a,
const T &
b,
const T &c,
const T &d,
const float parameter)
752 BLI_assert(0.0f <= parameter && parameter <= 1.0f);
787 int points_num,
int8_t order,
bool cyclic,
int resolution,
KnotsMode knots_mode);
818 BasisCache &basis_cache);
855 const IndexMask &points_to_copy,
856 const AttributeFilter &attribute_filter);
859 const IndexMask &curves_to_copy,
860 const AttributeFilter &attribute_filter);
870inline int CurvesGeometry::points_num()
const
874inline int CurvesGeometry::curves_num()
const
887inline bool CurvesGeometry::is_single_type(
const CurveType type)
const
892inline bool CurvesGeometry::has_curve_with_type(
const CurveType type)
const
900 types.begin(), types.end(), [&](
CurveType type) { return this->has_curve_with_type(type); });
903inline const std::array<int, CURVE_TYPES_NUM> &CurvesGeometry::curve_type_counts()
const
907 if (this->
runtime->check_type_counts) {
911 this->
runtime->check_type_counts =
false;
914 return this->
runtime->type_counts;
923inline int CurvesGeometry::evaluated_points_num()
const
929inline Span<int> CurvesGeometry::bezier_evaluated_offsets_for_curve(
const int curve_index)
const
935 return offsets.
slice(range);
938inline IndexRange CurvesGeometry::lengths_range_for_curve(
const int curve_index,
939 const bool cyclic)
const
943 const int start = points.start() + curve_index;
947inline Span<float> CurvesGeometry::evaluated_lengths_for_curve(
const int curve_index,
948 const bool cyclic)
const
950 const IndexRange range = this->lengths_range_for_curve(curve_index, cyclic);
951 return this->
runtime->evaluated_length_cache.data().as_span().slice(range);
954inline float CurvesGeometry::evaluated_length_total_for_curve(
const int curve_index,
955 const bool cyclic)
const
958 if (lengths.is_empty()) {
961 return lengths.last();
995 const int resolution)
997 return evaluated_size - !cyclic !=
int64_t(
segments_num(num_curve_points, cyclic)) * resolution;
Low-level operations for curves that cannot be defined in the C++ header yet.
ATTR_WARN_UNUSED_RESULT const BMVert * v
VArray< T > typed() const
constexpr int64_t start() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr const T * data() 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< Vector< float3 > > evaluated_tangent_cache
SharedCache< EvaluatedOffsets > evaluated_offsets_cache
SharedCache< Vector< float3 > > evaluated_normal_cache
std::unique_ptr< bake::BakeMaterialsList > bake_materials
SharedCache< Bounds< float3 > > bounds_cache
SharedCache< Vector< float3 > > evaluated_position_cache
const ImplicitSharingInfo * curve_offsets_sharing_info
std::array< int, CURVE_TYPES_NUM > type_counts
VArray< int8_t > handle_types_left() const
void reverse_curves(const IndexMask &curves_to_reverse)
void blend_read(BlendDataReader &reader)
void remove_attributes_based_on_types()
MutableSpan< float3 > positions_for_write()
void translate(const float3 &translation)
Array< int > point_to_curve_map() const
MutableSpan< MDeformVert > deform_verts_for_write()
OffsetIndices< int > points_by_curve() const
VArray< int8_t > normal_mode() const
MutableSpan< int8_t > handle_types_right_for_write()
VArray< int8_t > handle_types_right() const
void ensure_can_interpolate_to_evaluated() const
IndexRange curves_range() const
void update_curve_types()
MutableSpan< int8_t > curve_types_for_write()
MutableSpan< int > resolution_for_write()
const std::array< int, CURVE_TYPES_NUM > & curve_type_counts() const
MutableSpan< float3 > handle_positions_left_for_write()
MutableAttributeAccessor attributes_for_write()
MutableSpan< float3 > handle_positions_right_for_write()
MutableSpan< int8_t > nurbs_knots_modes_for_write()
Span< float > evaluated_lengths_for_curve(int curve_index, bool cyclic) const
MutableSpan< float > tilt_for_write()
VArray< float > tilt() const
void blend_write(BlendWriter &writer, ID &id, const BlendWriteData &write_data)
Span< float3 > evaluated_tangents() const
void tag_normals_changed()
Span< MDeformVert > deform_verts() const
MutableSpan< int8_t > nurbs_orders_for_write()
Span< float > nurbs_weights() const
MutableSpan< float2 > surface_uv_coords_for_write()
Span< float3 > handle_positions_left() const
VArray< int > resolution() const
int evaluated_points_num() const
Span< int > bezier_evaluated_offsets_for_curve(int curve_index) const
void interpolate_to_evaluated(int curve_index, GSpan src, GMutableSpan dst) const
IndexRange points_range() const
Span< int > offsets() const
VArray< int8_t > nurbs_knots_modes() const
Span< float3 > evaluated_normals() const
std::optional< Bounds< float3 > > bounds_min_max() const
Span< float3 > positions() const
OffsetIndices< int > evaluated_points_by_curve() const
bool has_curve_with_type(CurveType type) const
MutableSpan< float > nurbs_weights_for_write()
void tag_topology_changed()
GVArray adapt_domain(const GVArray &varray, AttrDomain from, AttrDomain to) const
void resize(int points_num, int curves_num)
BlendWriteData blend_write_prepare()
Span< float3 > handle_positions_right() const
void remove_curves(const IndexMask &curves_to_delete, const AttributeFilter &attribute_filter)
MutableSpan< int8_t > normal_mode_for_write()
void tag_positions_changed()
VArray< T > adapt_domain(const VArray< T > &varray, AttrDomain from, AttrDomain to) const
void fill_curve_types(CurveType type)
AttributeAccessor attributes() const
float evaluated_length_total_for_curve(int curve_index, bool cyclic) const
IndexMask indices_for_curve_type(CurveType type, IndexMaskMemory &memory) const
void count_memory(MemoryCounter &memory) const
bool is_single_type(CurveType type) const
MutableSpan< int > offsets_for_write()
Span< float2 > surface_uv_coords() const
void remove_points(const IndexMask &points_to_delete, const AttributeFilter &attribute_filter)
void transform(const float4x4 &matrix)
void ensure_evaluated_lengths() const
Span< float3 > evaluated_positions() const
VArray< int8_t > curve_types() const
VArray< bool > cyclic() const
CurvesGeometry & operator=(const CurvesGeometry &other)
void calculate_bezier_auto_handles()
MutableSpan< bool > cyclic_for_write()
VArray< int8_t > nurbs_orders() const
MutableSpan< int8_t > handle_types_left_for_write()
local_group_size(16, 16) .push_constant(Type b
static bool is_cyclic(const Nurb *nu)
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)
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_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)
int calculate_evaluated_num(int points_num, int8_t order, bool cyclic, int resolution, KnotsMode knots_mode)
bool check_valid_num_and_order(int points_num, int8_t order, bool cyclic, KnotsMode knots_mode)
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, bool cyclic, Span< float > knots, BasisCache &basis_cache)
int knots_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)
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)
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)
constexpr bool is_same_any_v
CurvesGeometryRuntimeHandle * runtime
Vector< int > all_bezier_offsets
Vector< int > evaluated_offsets
Vector< CustomDataLayer, 16 > curve_layers
Vector< CustomDataLayer, 16 > point_layers
Vector< int > start_indices