Blender  V3.3
Classes | Typedefs | Functions | Variables
blender::geometry Namespace Reference

Classes

struct  AddCurvesOnMeshInputs
 
struct  AddCurvesOnMeshOutputs
 
struct  MeshToVolumeResolution
 
struct  RealizeInstancesOptions
 
class  ReverseUVSampler
 
struct  NeighborCurve
 
struct  WeldGroup
 
struct  WeldGroupEdge
 
struct  WeldVert
 
struct  WeldEdge
 
struct  WeldLoop
 
struct  WeldPoly
 
struct  WeldMesh
 
struct  WeldLoopOfPolyIter
 
struct  WeldVertexCluster
 
struct  CuboidConfig
 
struct  CurveFromEdgesOutput
 
struct  OrderedAttributes
 
struct  AttributeFallbacksArray
 
struct  PointCloudRealizeInfo
 
struct  RealizePointCloudTask
 
struct  MeshElementStartIndices
 
struct  MeshRealizeInfo
 
struct  RealizeMeshTask
 
struct  RealizeCurveInfo
 
struct  CurvesElementStartIndices
 
struct  RealizeCurveTask
 
struct  AllPointCloudsInfo
 
struct  AllMeshesInfo
 
struct  AllCurvesInfo
 
struct  GatherTasks
 
struct  GatherOffsets
 
struct  GatherTasksInfo
 
struct  InstanceContext
 
struct  AttributesForInterpolation
 
struct  GenericAttributes
 

Typedefs

using NeighborCurves = Vector< NeighborCurve, max_neighbors >
 

Functions

AddCurvesOnMeshOutputs add_curves_on_mesh (bke::CurvesGeometry &curves, const AddCurvesOnMeshInputs &inputs)
 
float3 compute_surface_point_normal (const MLoopTri &looptri, const float3 &bary_coord, const Span< float3 > corner_normals)
 
bke::CurvesGeometry fillet_curves_poly (const bke::CurvesGeometry &src_curves, IndexMask curve_selection, const VArray< float > &radius, const VArray< int > &counts, bool limit_radius)
 
bke::CurvesGeometry fillet_curves_bezier (const bke::CurvesGeometry &src_curves, IndexMask curve_selection, const VArray< float > &radius, bool limit_radius)
 
Meshcreate_cuboid_mesh (const float3 &size, int verts_x, int verts_y, int verts_z, const bke::AttributeIDRef &uv_id)
 
Meshcreate_cuboid_mesh (const float3 &size, int verts_x, int verts_y, int verts_z)
 
bke::CurvesGeometry mesh_to_curve_convert (const Mesh &mesh, const IndexMask selection)
 
bke::CurvesGeometry create_curve_from_vert_indices (const Mesh &mesh, Span< int > vert_indices, Span< int > curve_offsets, IndexRange cyclic_curves)
 
PointCloudpoint_merge_by_distance (const PointCloud &src_points, const float merge_distance, const IndexMask selection)
 
Curvesresample_to_count (const CurveComponent &src_component, const fn::Field< bool > &selection_field, const fn::Field< int > &count_field)
 
Curvesresample_to_length (const CurveComponent &src_component, const fn::Field< bool > &selection_field, const fn::Field< float > &segment_length_field)
 
Curvesresample_to_evaluated (const CurveComponent &src_component, const fn::Field< bool > &selection_field)
 
bool try_curves_conversion_in_place (IndexMask selection, CurveType dst_type, FunctionRef< bke::CurvesGeometry &()> get_writable_curves_fn)
 
bke::CurvesGeometry convert_curves (const bke::CurvesGeometry &src_curves, IndexMask selection, CurveType dst_type)
 
bke::CurvesGeometry subdivide_curves (const bke::CurvesGeometry &src_curves, IndexMask selection, const VArray< int > &cuts)
 
static void initialize_straight_curve_positions (const float3 &p1, const float3 &p2, MutableSpan< float3 > r_positions)
 
static Array< NeighborCurvesfind_curve_neighbors (const Span< float3 > root_positions, const KDTree_3d &old_roots_kdtree)
 
template<typename T , typename GetValueF >
void interpolate_from_neighbors (const Span< NeighborCurves > neighbors_per_curve, const T &fallback, const GetValueF &get_value_from_neighbor, MutableSpan< T > r_interpolated_values)
 
static void interpolate_position_without_interpolation (CurvesGeometry &curves, const int old_curves_num, const Span< float3 > root_positions_cu, const Span< float > new_lengths_cu, const Span< float3 > new_normals_su, const float4x4 &surface_to_curves_normal_mat)
 
static void interpolate_position_with_interpolation (CurvesGeometry &curves, const Span< float3 > root_positions_cu, const Span< NeighborCurves > neighbors_per_curve, const int old_curves_num, const Span< float > new_lengths_cu, const Span< float3 > new_normals_su, const bke::CurvesSurfaceTransforms &transforms, const ReverseUVSampler &reverse_uv_sampler, const Span< float3 > corner_normals_su)
 
static IndexRange curve_dst_offsets (const IndexRange points, const int curve_index)
 
template<typename T >
static void threaded_slice_fill (const Span< T > src, const Span< int > offsets, MutableSpan< T > dst)
 
template<typename T >
static void duplicate_fillet_point_data (const bke::CurvesGeometry &src_curves, const bke::CurvesGeometry &dst_curves, const IndexMask curve_selection, const Span< int > point_offsets, const Span< T > src, MutableSpan< T > dst)
 
static void duplicate_fillet_point_data (const bke::CurvesGeometry &src_curves, const bke::CurvesGeometry &dst_curves, const IndexMask selection, const Span< int > point_offsets, const GSpan src, GMutableSpan dst)
 
static void calculate_result_offsets (const bke::CurvesGeometry &src_curves, const IndexMask selection, const Span< IndexRange > unselected_ranges, const VArray< float > &radii, const VArray< int > &counts, const Span< bool > cyclic, MutableSpan< int > dst_curve_offsets, MutableSpan< int > dst_point_offsets)
 
static void calculate_directions (const Span< float3 > positions, MutableSpan< float3 > directions)
 
static void calculate_angles (const Span< float3 > directions, MutableSpan< float > angles)
 
static float limit_radius (const float3 &position_prev, const float3 &position, const float3 &position_next, const float angle_prev, const float angle, const float angle_next, const float radius_prev, const float radius, const float radius_next)
 
static void limit_radii (const Span< float3 > positions, const Span< float > angles, const Span< float > radii, const bool cyclic, MutableSpan< float > radii_clamped)
 
static void calculate_fillet_positions (const Span< float3 > src_positions, const Span< float > angles, const Span< float > radii, const Span< float3 > directions, const Span< int > dst_offsets, MutableSpan< float3 > dst)
 
static void calculate_bezier_handles_bezier_mode (const Span< float3 > src_handles_l, const Span< float3 > src_handles_r, const Span< int8_t > src_types_l, const Span< int8_t > src_types_r, const Span< float > angles, const Span< float > radii, const Span< float3 > directions, const Span< int > dst_offsets, const Span< float3 > dst_positions, MutableSpan< float3 > dst_handles_l, MutableSpan< float3 > dst_handles_r, MutableSpan< int8_t > dst_types_l, MutableSpan< int8_t > dst_types_r)
 
static void calculate_bezier_handles_poly_mode (const Span< float3 > src_handles_l, const Span< float3 > src_handles_r, const Span< int8_t > src_types_l, const Span< int8_t > src_types_r, const Span< int > dst_offsets, const Span< float3 > dst_positions, MutableSpan< float3 > dst_handles_l, MutableSpan< float3 > dst_handles_r, MutableSpan< int8_t > dst_types_l, MutableSpan< int8_t > dst_types_r)
 
static bke::CurvesGeometry fillet_curves (const bke::CurvesGeometry &src_curves, const IndexMask curve_selection, const VArray< float > &radius_input, const VArray< int > &counts, const bool limit_radius, const bool use_bezier_mode)
 
static void calculate_vertices (const CuboidConfig &config, MutableSpan< MVert > verts)
 
static void define_quad (MutableSpan< MPoly > polys, MutableSpan< MLoop > loops, const int poly_index, const int loop_index, const int vert_1, const int vert_2, const int vert_3, const int vert_4)
 
static void calculate_polys (const CuboidConfig &config, MutableSpan< MPoly > polys, MutableSpan< MLoop > loops)
 
static void calculate_uvs (const CuboidConfig &config, Mesh *mesh, const bke::AttributeIDRef &uv_id)
 
template<typename T >
static void copy_with_map (const VArray< T > &src, Span< int > map, MutableSpan< T > dst)
 
static CurveFromEdgesOutput edges_to_curve_point_indices (Span< MVert > verts, Span< std::pair< int, int >> edges)
 
static Vector< std::pair< int, int > > get_selected_edges (const Mesh &mesh, const IndexMask selection)
 
static void copy_transformed_positions (const Span< float3 > src, const float4x4 &transform, MutableSpan< float3 > dst)
 
static void threaded_copy (const GSpan src, GMutableSpan dst)
 
static void threaded_fill (const GPointer value, GMutableSpan dst)
 
static void copy_generic_attributes_to_result (const Span< std::optional< GVArraySpan >> src_attributes, const AttributeFallbacksArray &attribute_fallbacks, const OrderedAttributes &ordered_attributes, const FunctionRef< IndexRange(eAttrDomain)> &range_fn, MutableSpan< GSpanAttributeWriter > dst_attribute_writers)
 
static void create_result_ids (const RealizeInstancesOptions &options, Span< int > stored_ids, const int task_id, MutableSpan< int > dst_ids)
 
static fn::Field< int > get_count_input_max_one (const fn::Field< int > &count_field)
 
static fn::Field< int > get_count_input_from_length (const fn::Field< float > &length_field)
 
static bool interpolate_attribute_to_curves (const bke::AttributeIDRef &attribute_id, const std::array< int, CURVE_TYPES_NUM > &type_counts)
 
static bool interpolate_attribute_to_poly_curve (const bke::AttributeIDRef &attribute_id)
 
static void retrieve_attribute_spans (const Span< bke::AttributeIDRef > ids, const CurveComponent &src_component, CurveComponent &dst_component, Vector< GSpan > &src, Vector< GMutableSpan > &dst, Vector< bke::GSpanAttributeWriter > &dst_attributes)
 
static void gather_point_attributes_to_interpolate (const CurveComponent &src_component, CurveComponent &dst_component, AttributesForInterpolation &result)
 
static Curvesresample_to_uniform (const CurveComponent &src_component, const fn::Field< bool > &selection_field, const fn::Field< int > &count_field)
 
static int2 uv_to_cell_key (const float2 &uv, const int resolution)
 
static bool is_nurbs_to_bezier_one_to_one (const KnotsMode knots_mode)
 
static bool conversion_can_change_point_num (const CurveType dst_type)
 
template<typename T >
static void scale_input_assign (const Span< T > src, const int scale, const int offset, MutableSpan< T > dst)
 
template<typename T >
static void bezier_generic_to_nurbs (const Span< T > src, MutableSpan< T > dst)
 
static void bezier_generic_to_nurbs (const GSpan src, GMutableSpan dst)
 
static void bezier_positions_to_nurbs (const Span< float3 > src_positions, const Span< float3 > src_handles_l, const Span< float3 > src_handles_r, MutableSpan< float3 > dst_positions)
 
static void catmull_rom_to_bezier_handles (const Span< float3 > src_positions, const bool cyclic, MutableSpan< float3 > dst_handles_l, MutableSpan< float3 > dst_handles_r)
 
static void catmull_rom_to_nurbs_positions (const Span< float3 > src_positions, const bool cyclic, MutableSpan< float3 > dst_positions)
 
template<typename T >
static void nurbs_to_bezier_assign (const Span< T > src, const MutableSpan< T > dst, const KnotsMode knots_mode)
 
static void nurbs_to_bezier_assign (const GSpan src, const KnotsMode knots_mode, GMutableSpan dst)
 
static Vector< float3create_nurbs_to_bezier_handles (const Span< float3 > nurbs_positions, const KnotsMode knots_mode)
 
static void create_nurbs_to_bezier_positions (const Span< float3 > nurbs_positions, const Span< float3 > handle_positions, const KnotsMode knots_mode, MutableSpan< float3 > bezier_positions)
 
static int to_bezier_size (const CurveType src_type, const bool cyclic, const KnotsMode knots_mode, const int src_size)
 
static int to_nurbs_size (const CurveType src_type, const int src_size)
 
static void retrieve_curve_sizes (const bke::CurvesGeometry &curves, MutableSpan< int > sizes)
 
static void retrieve_generic_point_attributes (const bke::AttributeAccessor &src_attributes, bke::MutableAttributeAccessor &dst_attributes, GenericAttributes &attributes)
 
static bke::CurvesGeometry convert_curves_to_bezier (const bke::CurvesGeometry &src_curves, const IndexMask selection)
 
static bke::CurvesGeometry convert_curves_to_nurbs (const bke::CurvesGeometry &src_curves, const IndexMask selection)
 
static bke::CurvesGeometry convert_curves_trivial (const bke::CurvesGeometry &src_curves, const IndexMask selection, const CurveType dst_type)
 
static IndexRange curve_dst_offsets (const IndexRange points, const int curve_index)
 
static void calculate_result_offsets (const bke::CurvesGeometry &src_curves, const IndexMask selection, const Span< IndexRange > unselected_ranges, const VArray< int > &cuts, const Span< bool > cyclic, MutableSpan< int > dst_curve_offsets, MutableSpan< int > dst_point_offsets)
 
template<typename T >
static void linear_interpolation (const T &a, const T &b, MutableSpan< T > dst)
 
template<typename T >
static void subdivide_attribute_linear (const bke::CurvesGeometry &src_curves, const bke::CurvesGeometry &dst_curves, const IndexMask selection, const Span< int > point_offsets, const Span< T > src, MutableSpan< T > dst)
 
static void subdivide_attribute_linear (const bke::CurvesGeometry &src_curves, const bke::CurvesGeometry &dst_curves, const IndexMask selection, const Span< int > point_offsets, const GSpan src, GMutableSpan dst)
 
template<typename T >
static void subdivide_attribute_catmull_rom (const bke::CurvesGeometry &src_curves, const bke::CurvesGeometry &dst_curves, const IndexMask selection, const Span< int > point_offsets, const Span< bool > cyclic, const Span< T > src, MutableSpan< T > dst)
 
static void subdivide_attribute_catmull_rom (const bke::CurvesGeometry &src_curves, const bke::CurvesGeometry &dst_curves, const IndexMask selection, const Span< int > point_offsets, const Span< bool > cyclic, const GSpan src, GMutableSpan dst)
 
static void subdivide_bezier_segment (const float3 &position_prev, const float3 &handle_prev, const float3 &handle_next, const float3 &position_next, const HandleType type_prev, const HandleType type_next, const IndexRange segment_points, MutableSpan< float3 > dst_positions, MutableSpan< float3 > dst_handles_l, MutableSpan< float3 > dst_handles_r, MutableSpan< int8_t > dst_types_l, MutableSpan< int8_t > dst_types_r, const bool is_last_cyclic_segment)
 
static void subdivide_bezier_positions (const Span< float3 > src_positions, const Span< int8_t > src_types_l, const Span< int8_t > src_types_r, const Span< float3 > src_handles_l, const Span< float3 > src_handles_r, const Span< int > evaluated_offsets, const bool cyclic, MutableSpan< float3 > dst_positions, MutableSpan< int8_t > dst_types_l, MutableSpan< int8_t > dst_types_r, MutableSpan< float3 > dst_handles_l, MutableSpan< float3 > dst_handles_r)
 
Merge Map Creation
std::optional< Mesh * > mesh_merge_by_distance_all (const Mesh &mesh, IndexMask selection, float merge_distance)
 
std::optional< Mesh * > mesh_merge_by_distance_connected (const Mesh &mesh, Span< bool > selection, float merge_distance, bool only_loose_edges)
 
Realize Instances
GeometrySet realize_instances (GeometrySet geometry_set, const RealizeInstancesOptions &options)
 
static void remove_id_attribute_from_instances (GeometrySet &geometry_set)
 
Vert API
static Vector< WeldVertweld_vert_ctx_alloc_and_setup (Span< int > vert_dest_map, const int vert_kill_len)
 
static void weld_vert_groups_setup (Span< WeldVert > wvert, Span< int > vert_dest_map, MutableSpan< int > r_vert_groups_map, Array< int > &r_vert_groups_buffer, Array< WeldGroup > &r_vert_groups)
 
Edge API
static Vector< WeldEdgeweld_edge_ctx_alloc (Span< MEdge > medge, Span< int > vert_dest_map, MutableSpan< int > r_edge_dest_map, MutableSpan< int > r_edge_ctx_map)
 
static void weld_edge_ctx_setup (MutableSpan< WeldGroup > r_vlinks, MutableSpan< int > r_edge_dest_map, MutableSpan< WeldEdge > r_wedge, int *r_edge_kiil_len)
 
static void weld_edge_groups_setup (const int medge_len, const int edge_kill_len, MutableSpan< WeldEdge > wedge, Span< int > wedge_map, MutableSpan< int > r_edge_groups_map, Array< int > &r_edge_groups_buffer, Array< WeldGroupEdge > &r_edge_groups)
 
Poly and Loop API
static bool weld_iter_loop_of_poly_begin (WeldLoopOfPolyIter &iter, const WeldPoly &wp, Span< WeldLoop > wloop, Span< MLoop > mloop, Span< int > loop_map, int *group_buffer)
 
static bool weld_iter_loop_of_poly_next (WeldLoopOfPolyIter &iter)
 
static void weld_poly_loop_ctx_alloc (Span< MPoly > mpoly, Span< MLoop > mloop, Span< int > vert_dest_map, Span< int > edge_dest_map, WeldMesh *r_weld_mesh)
 
static void weld_poly_split_recursive (Span< int > vert_dest_map, int ctx_verts_len, WeldPoly *r_wp, WeldMesh *r_weld_mesh, int *r_poly_kill, int *r_loop_kill)
 
static void weld_poly_loop_ctx_setup (Span< MLoop > mloop, const int mvert_len, Span< int > vert_dest_map, const int remain_edge_ctx_len, MutableSpan< WeldGroup > r_vlinks, WeldMesh *r_weld_mesh)
 
Mesh API
static void weld_mesh_context_create (const Mesh &mesh, MutableSpan< int > vert_dest_map, const int vert_kill_len, WeldMesh *r_weld_mesh)
 
CustomData
static void customdata_weld (const CustomData *source, CustomData *dest, const int *src_indices, int count, int dest_index)
 
Mesh Vertex Merging
static Meshcreate_merged_mesh (const Mesh &mesh, MutableSpan< int > vert_dest_map, const int removed_vertex_count)
 
Gather Realize Tasks
static void gather_realize_tasks_recursive (GatherTasksInfo &gather_info, const GeometrySet &geometry_set, const float4x4 &base_transform, const InstanceContext &base_instance_context)
 
static Vector< std::pair< int, GSpan > > prepare_attribute_fallbacks (GatherTasksInfo &gather_info, const InstancesComponent &instances_component, const OrderedAttributes &ordered_attributes)
 
static void foreach_geometry_in_reference (const InstanceReference &reference, const float4x4 &base_transform, const uint32_t id, FunctionRef< void(const GeometrySet &geometry_set, const float4x4 &transform, uint32_t id)> fn)
 
static void gather_realize_tasks_for_instances (GatherTasksInfo &gather_info, const InstancesComponent &instances_component, const float4x4 &base_transform, const InstanceContext &base_instance_context)
 
Point Cloud
static OrderedAttributes gather_generic_pointcloud_attributes_to_propagate (const GeometrySet &in_geometry_set, const RealizeInstancesOptions &options, bool &r_create_id)
 
static void gather_pointclouds_to_realize (const GeometrySet &geometry_set, VectorSet< const PointCloud * > &r_pointclouds)
 
static AllPointCloudsInfo preprocess_pointclouds (const GeometrySet &geometry_set, const RealizeInstancesOptions &options)
 
static void execute_realize_pointcloud_task (const RealizeInstancesOptions &options, const RealizePointCloudTask &task, const OrderedAttributes &ordered_attributes, MutableSpan< GSpanAttributeWriter > dst_attribute_writers, MutableSpan< int > all_dst_ids, MutableSpan< float3 > all_dst_positions)
 
static void execute_realize_pointcloud_tasks (const RealizeInstancesOptions &options, const AllPointCloudsInfo &all_pointclouds_info, const Span< RealizePointCloudTask > tasks, const OrderedAttributes &ordered_attributes, GeometrySet &r_realized_geometry)
 
Mesh
static OrderedAttributes gather_generic_mesh_attributes_to_propagate (const GeometrySet &in_geometry_set, const RealizeInstancesOptions &options, bool &r_create_id)
 
static void gather_meshes_to_realize (const GeometrySet &geometry_set, VectorSet< const Mesh * > &r_meshes)
 
static AllMeshesInfo preprocess_meshes (const GeometrySet &geometry_set, const RealizeInstancesOptions &options)
 
static void execute_realize_mesh_task (const RealizeInstancesOptions &options, const RealizeMeshTask &task, const OrderedAttributes &ordered_attributes, Mesh &dst_mesh, MutableSpan< GSpanAttributeWriter > dst_attribute_writers, MutableSpan< int > all_dst_vertex_ids)
 
static void execute_realize_mesh_tasks (const RealizeInstancesOptions &options, const AllMeshesInfo &all_meshes_info, const Span< RealizeMeshTask > tasks, const OrderedAttributes &ordered_attributes, const VectorSet< Material * > &ordered_materials, GeometrySet &r_realized_geometry)
 
Curves
static OrderedAttributes gather_generic_curve_attributes_to_propagate (const GeometrySet &in_geometry_set, const RealizeInstancesOptions &options, bool &r_create_id)
 
static void gather_curves_to_realize (const GeometrySet &geometry_set, VectorSet< const Curves * > &r_curves)
 
static AllCurvesInfo preprocess_curves (const GeometrySet &geometry_set, const RealizeInstancesOptions &options)
 
static void execute_realize_curve_task (const RealizeInstancesOptions &options, const AllCurvesInfo &all_curves_info, const RealizeCurveTask &task, const OrderedAttributes &ordered_attributes, bke::CurvesGeometry &dst_curves, MutableSpan< GSpanAttributeWriter > dst_attribute_writers, MutableSpan< int > all_dst_ids, MutableSpan< float3 > all_handle_left, MutableSpan< float3 > all_handle_right, MutableSpan< float > all_radii, MutableSpan< int > all_resolutions)
 
static void execute_realize_curve_tasks (const RealizeInstancesOptions &options, const AllCurvesInfo &all_curves_info, const Span< RealizeCurveTask > tasks, const OrderedAttributes &ordered_attributes, GeometrySet &r_realized_geometry)
 

Variables

static constexpr int max_neighbors = 5
 

Detailed Description

The code below uses a suffix naming convention to indicate the coordinate space: cu: Local space of the curves object that is being edited. su: Local space of the surface object.

Typedef Documentation

◆ NeighborCurves

Definition at line 29 of file add_curves_on_mesh.cc.

Function Documentation

◆ add_curves_on_mesh()

AddCurvesOnMeshOutputs blender::geometry::add_curves_on_mesh ( bke::CurvesGeometry curves,
const AddCurvesOnMeshInputs inputs 
)

◆ bezier_generic_to_nurbs() [1/2]

static void blender::geometry::bezier_generic_to_nurbs ( const GSpan  src,
GMutableSpan  dst 
)
static

Definition at line 67 of file set_curve_type.cc.

References blender::attribute_math::convert_to_static_type(), and src.

◆ bezier_generic_to_nurbs() [2/2]

template<typename T >
static void blender::geometry::bezier_generic_to_nurbs ( const Span< T src,
MutableSpan< T dst 
)
static

The Bezier control point and its handles become three control points on the NURBS curve, so each attribute value is duplicated three times.

Definition at line 58 of file set_curve_type.cc.

References src.

◆ bezier_positions_to_nurbs()

static void blender::geometry::bezier_positions_to_nurbs ( const Span< float3 src_positions,
const Span< float3 src_handles_l,
const Span< float3 src_handles_r,
MutableSpan< float3 dst_positions 
)
static

Definition at line 75 of file set_curve_type.cc.

References blender::Span< T >::index_range().

Referenced by catmull_rom_to_nurbs_positions().

◆ calculate_angles()

static void blender::geometry::calculate_angles ( const Span< float3 directions,
MutableSpan< float angles 
)
static

◆ calculate_bezier_handles_bezier_mode()

static void blender::geometry::calculate_bezier_handles_bezier_mode ( const Span< float3 src_handles_l,
const Span< float3 src_handles_r,
const Span< int8_t src_types_l,
const Span< int8_t src_types_r,
const Span< float angles,
const Span< float radii,
const Span< float3 directions,
const Span< int >  dst_offsets,
const Span< float3 dst_positions,
MutableSpan< float3 dst_handles_l,
MutableSpan< float3 dst_handles_r,
MutableSpan< int8_t dst_types_l,
MutableSpan< int8_t dst_types_r 
)
static

Set handles for the "Bezier" mode where we rely on setting the inner handles to approximate a circular arc. The outer (previous and next) handles outside the result fillet segment are set to vector handles.

Definition at line 284 of file fillet_curves.cc.

References blender::Span< T >::index_range(), blender::IndexRange::last(), and blender::threading::parallel_for().

◆ calculate_bezier_handles_poly_mode()

static void blender::geometry::calculate_bezier_handles_poly_mode ( const Span< float3 src_handles_l,
const Span< float3 src_handles_r,
const Span< int8_t src_types_l,
const Span< int8_t src_types_r,
const Span< int >  dst_offsets,
const Span< float3 dst_positions,
MutableSpan< float3 dst_handles_l,
MutableSpan< float3 dst_handles_r,
MutableSpan< int8_t dst_types_l,
MutableSpan< int8_t dst_types_r 
)
static

In the poly fillet mode, all the inner handles are set to vector handles, along with the "outer" (previous and next) handles at each fillet.

Definition at line 349 of file fillet_curves.cc.

References blender::Span< T >::index_range(), blender::IndexRange::last(), and blender::threading::parallel_for().

◆ calculate_directions()

static void blender::geometry::calculate_directions ( const Span< float3 positions,
MutableSpan< float3 directions 
)
static

◆ calculate_fillet_positions()

static void blender::geometry::calculate_fillet_positions ( const Span< float3 src_positions,
const Span< float angles,
const Span< float radii,
const Span< float3 directions,
const Span< int >  dst_offsets,
MutableSpan< float3 dst 
)
static

◆ calculate_polys()

static void blender::geometry::calculate_polys ( const CuboidConfig config,
MutableSpan< MPoly polys,
MutableSpan< MLoop loops 
)
static

◆ calculate_result_offsets() [1/2]

static void blender::geometry::calculate_result_offsets ( const bke::CurvesGeometry src_curves,
const IndexMask  selection,
const Span< IndexRange unselected_ranges,
const VArray< float > &  radii,
const VArray< int > &  counts,
const Span< bool cyclic,
MutableSpan< int >  dst_curve_offsets,
MutableSpan< int >  dst_point_offsets 
)
static

◆ calculate_result_offsets() [2/2]

static void blender::geometry::calculate_result_offsets ( const bke::CurvesGeometry src_curves,
const IndexMask  selection,
const Span< IndexRange unselected_ranges,
const VArray< int > &  cuts,
const Span< bool cyclic,
MutableSpan< int >  dst_curve_offsets,
MutableSpan< int >  dst_point_offsets 
)
static

◆ calculate_uvs()

static void blender::geometry::calculate_uvs ( const CuboidConfig config,
Mesh mesh,
const bke::AttributeIDRef uv_id 
)
static

◆ calculate_vertices()

static void blender::geometry::calculate_vertices ( const CuboidConfig config,
MutableSpan< MVert verts 
)
static

◆ catmull_rom_to_bezier_handles()

static void blender::geometry::catmull_rom_to_bezier_handles ( const Span< float3 src_positions,
const bool  cyclic,
MutableSpan< float3 dst_handles_l,
MutableSpan< float3 dst_handles_r 
)
static

◆ catmull_rom_to_nurbs_positions()

static void blender::geometry::catmull_rom_to_nurbs_positions ( const Span< float3 src_positions,
const bool  cyclic,
MutableSpan< float3 dst_positions 
)
static

◆ compute_surface_point_normal()

float3 blender::geometry::compute_surface_point_normal ( const MLoopTri looptri,
const float3 bary_coord,
const Span< float3 corner_normals 
)

◆ conversion_can_change_point_num()

static bool blender::geometry::conversion_can_change_point_num ( const CurveType  dst_type)
static

As an optimization, just change the types on a mutable curves data-block when the conversion is simple. This could be expanded to more cases where the number of points doesn't change in the future, though that might require properly initializing some attributes, or removing others.

Definition at line 33 of file set_curve_type.cc.

References CURVE_TYPE_CATMULL_ROM, CURVE_TYPE_POLY, and ELEM.

Referenced by try_curves_conversion_in_place().

◆ convert_curves()

bke::CurvesGeometry blender::geometry::convert_curves ( const bke::CurvesGeometry src_curves,
IndexMask  selection,
CurveType  dst_type 
)

◆ convert_curves_to_bezier()

static bke::CurvesGeometry blender::geometry::convert_curves_to_bezier ( const bke::CurvesGeometry src_curves,
const IndexMask  selection 
)
static

◆ convert_curves_to_nurbs()

static bke::CurvesGeometry blender::geometry::convert_curves_to_nurbs ( const bke::CurvesGeometry src_curves,
const IndexMask  selection 
)
static

◆ convert_curves_trivial()

static bke::CurvesGeometry blender::geometry::convert_curves_trivial ( const bke::CurvesGeometry src_curves,
const IndexMask  selection,
const CurveType  dst_type 
)
static

◆ copy_generic_attributes_to_result()

static void blender::geometry::copy_generic_attributes_to_result ( const Span< std::optional< GVArraySpan >>  src_attributes,
const AttributeFallbacksArray attribute_fallbacks,
const OrderedAttributes ordered_attributes,
const FunctionRef< IndexRange(eAttrDomain)> &  range_fn,
MutableSpan< GSpanAttributeWriter dst_attribute_writers 
)
static

◆ copy_transformed_positions()

static void blender::geometry::copy_transformed_positions ( const Span< float3 src,
const float4x4 transform,
MutableSpan< float3 dst 
)
static

◆ copy_with_map()

template<typename T >
static void blender::geometry::copy_with_map ( const VArray< T > &  src,
Span< int >  map,
MutableSpan< T dst 
)
static

◆ create_cuboid_mesh() [1/2]

Mesh * blender::geometry::create_cuboid_mesh ( const float3 size,
int  verts_x,
int  verts_y,
int  verts_z 
)

Definition at line 421 of file mesh_primitive_cuboid.cc.

References create_cuboid_mesh(), and size().

◆ create_cuboid_mesh() [2/2]

Mesh * blender::geometry::create_cuboid_mesh ( const float3 size,
int  verts_x,
int  verts_y,
int  verts_z,
const bke::AttributeIDRef uv_id 
)

◆ create_curve_from_vert_indices()

bke::CurvesGeometry blender::geometry::create_curve_from_vert_indices ( const Mesh mesh,
Span< int >  vert_indices,
Span< int >  curve_offsets,
IndexRange  cyclic_curves 
)

◆ create_merged_mesh()

static Mesh* blender::geometry::create_merged_mesh ( const Mesh mesh,
MutableSpan< int >  vert_dest_map,
const int  removed_vertex_count 
)
static

Definition at line 1359 of file mesh_merge_by_distance.cc.

References BKE_mesh_new_nomain_from_template(), BLI_assert, count, CustomData_copy_data(), customdata_weld(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), e, blender::geometry::WeldLoopOfPolyIter::e, MLoop::e, Mesh::edata, blender::geometry::WeldMesh::edge_groups, blender::geometry::WeldMesh::edge_groups_buffer, blender::geometry::WeldMesh::edge_groups_map, blender::geometry::WeldMesh::edge_kill_len, ELEM_MERGED, MEdge::flag, blender::geometry::WeldGroupEdge::group, blender::geometry::WeldLoopOfPolyIter::group_len, Mesh::ldata, blender::geometry::WeldGroup::len, blender::geometry::WeldMesh::loop_kill_len, blender::geometry::WeldMesh::loop_map, MPoly::loopstart, blender::geometry::WeldMesh::max_poly_len, ME_LOOSEEDGE, mesh, Mesh::mloop, Mesh::mpoly, blender::geometry::WeldGroup::ofs, OUT_OF_CONTEXT, Mesh::pdata, blender::geometry::WeldPoly::poly_dst, blender::geometry::WeldMesh::poly_kill_len, blender::geometry::WeldMesh::poly_map, result, Mesh::totedge, Mesh::totloop, MPoly::totloop, Mesh::totpoly, Mesh::totvert, blender::geometry::WeldLoopOfPolyIter::type, v, blender::geometry::WeldLoopOfPolyIter::v, MLoop::v, blender::geometry::WeldGroupEdge::v1, MEdge::v1, blender::geometry::WeldGroupEdge::v2, MEdge::v2, Mesh::vdata, blender::geometry::WeldMesh::vert_groups, blender::geometry::WeldMesh::vert_groups_buffer, blender::geometry::WeldMesh::vert_kill_len, weld_iter_loop_of_poly_begin(), weld_iter_loop_of_poly_next(), weld_mesh_context_create(), blender::geometry::WeldMesh::wloop, blender::geometry::WeldMesh::wpoly, and blender::geometry::WeldMesh::wpoly_new_len.

Referenced by mesh_merge_by_distance_all(), and mesh_merge_by_distance_connected().

◆ create_nurbs_to_bezier_handles()

static Vector<float3> blender::geometry::create_nurbs_to_bezier_handles ( const Span< float3 nurbs_positions,
const KnotsMode  knots_mode 
)
static

◆ create_nurbs_to_bezier_positions()

static void blender::geometry::create_nurbs_to_bezier_positions ( const Span< float3 nurbs_positions,
const Span< float3 handle_positions,
const KnotsMode  knots_mode,
MutableSpan< float3 bezier_positions 
)
static

◆ create_result_ids()

static void blender::geometry::create_result_ids ( const RealizeInstancesOptions options,
Span< int >  stored_ids,
const int  task_id,
MutableSpan< int >  dst_ids 
)
static

◆ curve_dst_offsets() [1/2]

static IndexRange blender::geometry::curve_dst_offsets ( const IndexRange  points,
const int  curve_index 
)
static

Return a range used to retrieve values from an array of values stored per point, but with an extra element at the end of each curve. This is useful for offsets within curves, where it is convenient to store the first 0 and have the last offset be the total result curve size.

Definition at line 22 of file fillet_curves.cc.

References blender::IndexRange::size(), and blender::IndexRange::start().

◆ curve_dst_offsets() [2/2]

static IndexRange blender::geometry::curve_dst_offsets ( const IndexRange  points,
const int  curve_index 
)
static

Return a range used to retrieve values from an array of values stored per point, but with an extra element at the end of each curve. This is useful for offsets within curves, where it is convenient to store the first 0 and have the last offset be the total result curve size.

Definition at line 19 of file subdivide_curves.cc.

References blender::IndexRange::size(), and blender::IndexRange::start().

◆ customdata_weld()

static void blender::geometry::customdata_weld ( const CustomData source,
CustomData dest,
const int *  src_indices,
int  count,
int  dest_index 
)
static

◆ define_quad()

static void blender::geometry::define_quad ( MutableSpan< MPoly polys,
MutableSpan< MLoop loops,
const int  poly_index,
const int  loop_index,
const int  vert_1,
const int  vert_2,
const int  vert_3,
const int  vert_4 
)
static

Definition at line 111 of file mesh_primitive_cuboid.cc.

References MPoly::loopstart, MPoly::totloop, and MLoop::v.

Referenced by calculate_polys().

◆ duplicate_fillet_point_data() [1/2]

template<typename T >
static void blender::geometry::duplicate_fillet_point_data ( const bke::CurvesGeometry src_curves,
const bke::CurvesGeometry dst_curves,
const IndexMask  curve_selection,
const Span< int >  point_offsets,
const Span< T src,
MutableSpan< T dst 
)
static

◆ duplicate_fillet_point_data() [2/2]

static void blender::geometry::duplicate_fillet_point_data ( const bke::CurvesGeometry src_curves,
const bke::CurvesGeometry dst_curves,
const IndexMask  selection,
const Span< int >  point_offsets,
const GSpan  src,
GMutableSpan  dst 
)
static

◆ edges_to_curve_point_indices()

static CurveFromEdgesOutput blender::geometry::edges_to_curve_point_indices ( Span< MVert verts,
Span< std::pair< int, int >>  edges 
)
static

◆ execute_realize_curve_task()

static void blender::geometry::execute_realize_curve_task ( const RealizeInstancesOptions options,
const AllCurvesInfo all_curves_info,
const RealizeCurveTask task,
const OrderedAttributes ordered_attributes,
bke::CurvesGeometry dst_curves,
MutableSpan< GSpanAttributeWriter dst_attribute_writers,
MutableSpan< int >  all_dst_ids,
MutableSpan< float3 all_handle_left,
MutableSpan< float3 all_handle_right,
MutableSpan< float all_radii,
MutableSpan< int >  all_resolutions 
)
static

◆ execute_realize_curve_tasks()

static void blender::geometry::execute_realize_curve_tasks ( const RealizeInstancesOptions options,
const AllCurvesInfo all_curves_info,
const Span< RealizeCurveTask tasks,
const OrderedAttributes ordered_attributes,
GeometrySet r_realized_geometry 
)
static

◆ execute_realize_mesh_task()

static void blender::geometry::execute_realize_mesh_task ( const RealizeInstancesOptions options,
const RealizeMeshTask task,
const OrderedAttributes ordered_attributes,
Mesh dst_mesh,
MutableSpan< GSpanAttributeWriter dst_attribute_writers,
MutableSpan< int >  all_dst_vertex_ids 
)
static

◆ execute_realize_mesh_tasks()

static void blender::geometry::execute_realize_mesh_tasks ( const RealizeInstancesOptions options,
const AllMeshesInfo all_meshes_info,
const Span< RealizeMeshTask tasks,
const OrderedAttributes ordered_attributes,
const VectorSet< Material * > &  ordered_materials,
GeometrySet r_realized_geometry 
)
static

◆ execute_realize_pointcloud_task()

static void blender::geometry::execute_realize_pointcloud_task ( const RealizeInstancesOptions options,
const RealizePointCloudTask task,
const OrderedAttributes ordered_attributes,
MutableSpan< GSpanAttributeWriter dst_attribute_writers,
MutableSpan< int >  all_dst_ids,
MutableSpan< float3 all_dst_positions 
)
static

◆ execute_realize_pointcloud_tasks()

static void blender::geometry::execute_realize_pointcloud_tasks ( const RealizeInstancesOptions options,
const AllPointCloudsInfo all_pointclouds_info,
const Span< RealizePointCloudTask tasks,
const OrderedAttributes ordered_attributes,
GeometrySet r_realized_geometry 
)
static

◆ fillet_curves()

static bke::CurvesGeometry blender::geometry::fillet_curves ( const bke::CurvesGeometry src_curves,
const IndexMask  curve_selection,
const VArray< float > &  radius_input,
const VArray< int > &  counts,
const bool  limit_radius,
const bool  use_bezier_mode 
)
static

◆ fillet_curves_bezier()

bke::CurvesGeometry blender::geometry::fillet_curves_bezier ( const bke::CurvesGeometry src_curves,
IndexMask  curve_selection,
const VArray< float > &  radius,
bool  limit_radius 
)

◆ fillet_curves_poly()

bke::CurvesGeometry blender::geometry::fillet_curves_poly ( const bke::CurvesGeometry src_curves,
IndexMask  curve_selection,
const VArray< float > &  radius,
const VArray< int > &  counts,
bool  limit_radius 
)

◆ find_curve_neighbors()

static Array<NeighborCurves> blender::geometry::find_curve_neighbors ( const Span< float3 root_positions,
const KDTree_3d &  old_roots_kdtree 
)
static

◆ foreach_geometry_in_reference()

static void blender::geometry::foreach_geometry_in_reference ( const InstanceReference reference,
const float4x4 base_transform,
const uint32_t  id,
FunctionRef< void(const GeometrySet &geometry_set, const float4x4 &transform, uint32_t id)>  fn 
)
static

◆ gather_curves_to_realize()

static void blender::geometry::gather_curves_to_realize ( const GeometrySet geometry_set,
VectorSet< const Curves * > &  r_curves 
)
static

◆ gather_generic_curve_attributes_to_propagate()

static OrderedAttributes blender::geometry::gather_generic_curve_attributes_to_propagate ( const GeometrySet in_geometry_set,
const RealizeInstancesOptions options,
bool r_create_id 
)
static

◆ gather_generic_mesh_attributes_to_propagate()

static OrderedAttributes blender::geometry::gather_generic_mesh_attributes_to_propagate ( const GeometrySet in_geometry_set,
const RealizeInstancesOptions options,
bool r_create_id 
)
static

◆ gather_generic_pointcloud_attributes_to_propagate()

static OrderedAttributes blender::geometry::gather_generic_pointcloud_attributes_to_propagate ( const GeometrySet in_geometry_set,
const RealizeInstancesOptions options,
bool r_create_id 
)
static

◆ gather_meshes_to_realize()

static void blender::geometry::gather_meshes_to_realize ( const GeometrySet geometry_set,
VectorSet< const Mesh * > &  r_meshes 
)
static

◆ gather_point_attributes_to_interpolate()

static void blender::geometry::gather_point_attributes_to_interpolate ( const CurveComponent src_component,
CurveComponent dst_component,
AttributesForInterpolation result 
)
static

◆ gather_pointclouds_to_realize()

static void blender::geometry::gather_pointclouds_to_realize ( const GeometrySet geometry_set,
VectorSet< const PointCloud * > &  r_pointclouds 
)
static

◆ gather_realize_tasks_for_instances()

static void blender::geometry::gather_realize_tasks_for_instances ( GatherTasksInfo gather_info,
const InstancesComponent instances_component,
const float4x4 base_transform,
const InstanceContext base_instance_context 
)
static

◆ gather_realize_tasks_recursive()

static void blender::geometry::gather_realize_tasks_recursive ( GatherTasksInfo gather_info,
const GeometrySet geometry_set,
const float4x4 base_transform,
const InstanceContext base_instance_context 
)
static

Gather tasks for all geometries in the #geometry_set.

Definition at line 517 of file realize_instances.cc.

References component(), blender::geometry::CurvesElementStartIndices::curve, blender::geometry::GatherTasks::curve_tasks, blender::geometry::GatherTasksInfo::curves, blender::geometry::InstanceContext::curves, curves, blender::geometry::GatherOffsets::curves_offsets, blender::geometry::MeshElementStartIndices::edge, blender::geometry::GatherTasks::first_edit_data, blender::geometry::GatherTasks::first_volume, gather_realize_tasks_for_instances(), GEO_COMPONENT_TYPE_CURVE, GEO_COMPONENT_TYPE_EDIT, GEO_COMPONENT_TYPE_INSTANCES, GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_POINT_CLOUD, GEO_COMPONENT_TYPE_VOLUME, GeometrySet::get_components_for_read(), MeshComponent::get_for_read(), PointCloudComponent::get_for_read(), CurveComponent::get_for_read(), blender::geometry::InstanceContext::id, blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_of(), blender::geometry::MeshElementStartIndices::loop, mesh, blender::geometry::GatherOffsets::mesh_offsets, blender::geometry::GatherTasks::mesh_tasks, blender::geometry::GatherTasksInfo::meshes, blender::geometry::InstanceContext::meshes, blender::geometry::AllPointCloudsInfo::order, blender::geometry::AllMeshesInfo::order, blender::geometry::AllCurvesInfo::order, blender::geometry::CurvesElementStartIndices::point, blender::geometry::GatherOffsets::pointcloud_offset, blender::geometry::GatherTasks::pointcloud_tasks, blender::geometry::GatherTasksInfo::pointclouds, blender::geometry::InstanceContext::pointclouds, blender::geometry::MeshElementStartIndices::poly, blender::geometry::GatherTasksInfo::r_offsets, blender::geometry::GatherTasksInfo::r_tasks, blender::geometry::AllPointCloudsInfo::realize_info, blender::geometry::AllMeshesInfo::realize_info, blender::geometry::AllCurvesInfo::realize_info, Mesh::totedge, Mesh::totloop, PointCloud::totpoint, Mesh::totpoly, Mesh::totvert, type, GeometryComponent::user_add(), and blender::geometry::MeshElementStartIndices::vertex.

Referenced by gather_realize_tasks_for_instances(), and realize_instances().

◆ get_count_input_from_length()

static fn::Field<int> blender::geometry::get_count_input_from_length ( const fn::Field< float > &  length_field)
static

Definition at line 30 of file resample_curves.cc.

References count, and max.

Referenced by resample_to_length().

◆ get_count_input_max_one()

static fn::Field<int> blender::geometry::get_count_input_max_one ( const fn::Field< int > &  count_field)
static

Definition at line 18 of file resample_curves.cc.

References max.

Referenced by resample_to_count().

◆ get_selected_edges()

static Vector<std::pair<int, int> > blender::geometry::get_selected_edges ( const Mesh mesh,
const IndexMask  selection 
)
static

Get a separate array of the indices for edges in a selection (a boolean attribute). This helps to make the above algorithm simpler by removing the need to check for selection in many places.

Definition at line 213 of file mesh_to_curve_convert.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), Mesh::medge, mesh, MEdge::v1, and MEdge::v2.

Referenced by mesh_to_curve_convert().

◆ initialize_straight_curve_positions()

static void blender::geometry::initialize_straight_curve_positions ( const float3 p1,
const float3 p2,
MutableSpan< float3 r_positions 
)
static

◆ interpolate_attribute_to_curves()

static bool blender::geometry::interpolate_attribute_to_curves ( const bke::AttributeIDRef attribute_id,
const std::array< int, CURVE_TYPES_NUM > &  type_counts 
)
static

Return true if the attribute should be copied/interpolated to the result curves. Don't output attributes that correspond to curve types that have no curves in the result.

Definition at line 53 of file resample_curves.cc.

References CURVE_TYPE_BEZIER, CURVE_TYPE_NURBS, ELEM, blender::bke::AttributeIDRef::is_named(), and blender::bke::AttributeIDRef::name().

Referenced by gather_point_attributes_to_interpolate().

◆ interpolate_attribute_to_poly_curve()

static bool blender::geometry::interpolate_attribute_to_poly_curve ( const bke::AttributeIDRef attribute_id)
static

Return true if the attribute should be copied to poly curves.

Definition at line 75 of file resample_curves.cc.

References blender::bke::AttributeIDRef::is_named(), and blender::bke::AttributeIDRef::name().

Referenced by gather_point_attributes_to_interpolate().

◆ interpolate_from_neighbors()

template<typename T , typename GetValueF >
void blender::geometry::interpolate_from_neighbors ( const Span< NeighborCurves neighbors_per_curve,
const T fallback,
const GetValueF &  get_value_from_neighbor,
MutableSpan< T r_interpolated_values 
)

◆ interpolate_position_with_interpolation()

static void blender::geometry::interpolate_position_with_interpolation ( CurvesGeometry curves,
const Span< float3 root_positions_cu,
const Span< NeighborCurves neighbors_per_curve,
const int  old_curves_num,
const Span< float new_lengths_cu,
const Span< float3 new_normals_su,
const bke::CurvesSurfaceTransforms transforms,
const ReverseUVSampler reverse_uv_sampler,
const Span< float3 corner_normals_su 
)
static

◆ interpolate_position_without_interpolation()

static void blender::geometry::interpolate_position_without_interpolation ( CurvesGeometry curves,
const int  old_curves_num,
const Span< float3 root_positions_cu,
const Span< float new_lengths_cu,
const Span< float3 new_normals_su,
const float4x4 surface_to_curves_normal_mat 
)
static

◆ is_nurbs_to_bezier_one_to_one()

static bool blender::geometry::is_nurbs_to_bezier_one_to_one ( const KnotsMode  knots_mode)
static

This function answers the question about possible conversion method for NURBS-to-Bezier. In general for 3rd degree NURBS curves there is one-to-one relation with 3rd degree Bezier curves that can be exploit for conversion - Bezier handles sit on NURBS hull segments and in the middle between those handles are Bezier anchor points.

Definition at line 20 of file set_curve_type.cc.

References ELEM, NURBS_KNOT_MODE_ENDPOINT, and NURBS_KNOT_MODE_NORMAL.

Referenced by create_nurbs_to_bezier_handles(), create_nurbs_to_bezier_positions(), and to_bezier_size().

◆ limit_radii()

static void blender::geometry::limit_radii ( const Span< float3 positions,
const Span< float angles,
const Span< float radii,
const bool  cyclic,
MutableSpan< float radii_clamped 
)
static

◆ limit_radius()

static float blender::geometry::limit_radius ( const float3 position_prev,
const float3 position,
const float3 position_next,
const float  angle_prev,
const float  angle,
const float  angle_next,
const float  radius_prev,
const float  radius,
const float  radius_next 
)
static

Find the portion of the previous and next segments used by the current and next point fillets. If more than the total length of the segment would be used, scale the current point's radius just enough to make the two points meet in the middle.

Definition at line 136 of file fillet_curves.cc.

References angle(), blender::math::clamp(), blender::math::distance(), min, and KDL::tan().

Referenced by fillet_curves_bezier(), fillet_curves_poly(), limit_radii(), blender::nodes::node_geo_curve_fillet_cc::node_geo_exec(), SCULPT_geodesic_distances_create(), SCULPT_geodesic_from_vertex(), SCULPT_geodesic_from_vertex_and_symm(), and SCULPT_geodesic_mesh_create().

◆ linear_interpolation()

template<typename T >
static void blender::geometry::linear_interpolation ( const T a,
const T b,
MutableSpan< T dst 
)
inlinestatic

◆ mesh_merge_by_distance_all()

std::optional< Mesh * > blender::geometry::mesh_merge_by_distance_all ( const Mesh mesh,
IndexMask  selection,
float  merge_distance 
)

Merge selected vertices into other selected vertices within the merge_distance. The merged indices favor speed over accuracy, since the results will depend on the order of the vertices.

Returns
#std::nullopt if the mesh should not be changed (no vertices are merged), in order to avoid copying the input. Otherwise returns the new mesh with merged geometry.

Definition at line 1564 of file mesh_merge_by_distance.cc.

References MVert::co, create_merged_mesh(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), mesh, Mesh::mvert, OUT_OF_CONTEXT, blender::IndexMask::size(), Mesh::totvert, and tree.

Referenced by calculate_weld(), and blender::nodes::node_geo_merge_by_distance_cc::mesh_merge_by_distance_all().

◆ mesh_merge_by_distance_connected()

std::optional< Mesh * > blender::geometry::mesh_merge_by_distance_connected ( const Mesh mesh,
Span< bool selection,
float  merge_distance,
bool  only_loose_edges 
)

Merge selected vertices along edges to other selected vertices. Only vertices connected by edges are considered for merging.

Returns
#std::nullopt if the mesh should not be changed (no vertices are merged), in order to avoid copying the input. Otherwise returns the new mesh with merged geometry.

Definition at line 1593 of file mesh_merge_by_distance.cc.

References blender::geometry::WeldVertexCluster::co, copy_v3_v3(), create_merged_mesh(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), blender::Span< T >::is_empty(), len_squared_v3(), madd_v3_v3fl(), ME_LOOSEEDGE, Mesh::medge, blender::geometry::WeldVertexCluster::merged_verts, mesh, Mesh::mvert, OUT_OF_CONTEXT, range_vn_i(), square_f(), sub_v3_v3v3(), SWAP, Mesh::totedge, Mesh::totvert, v, v1, v2, and verts.

Referenced by calculate_weld(), and blender::nodes::node_geo_merge_by_distance_cc::mesh_merge_by_distance_connected().

◆ mesh_to_curve_convert()

bke::CurvesGeometry blender::geometry::mesh_to_curve_convert ( const Mesh mesh,
const IndexMask  selection 
)

Convert the mesh into one or many poly curves. Since curves cannot have branches, intersections of more than three edges will become breaks in curves. Attributes that are not built-in on meshes and not curves are transferred to the result curve.

Definition at line 222 of file mesh_to_curve_convert.cc.

References create_curve_from_vert_indices(), edges_to_curve_point_indices(), get_selected_edges(), mesh, Mesh::mvert, output, and Mesh::totvert.

Referenced by blender::nodes::node_geo_mesh_to_curve_cc::node_geo_exec().

◆ nurbs_to_bezier_assign() [1/2]

static void blender::geometry::nurbs_to_bezier_assign ( const GSpan  src,
const KnotsMode  knots_mode,
GMutableSpan  dst 
)
static

Definition at line 159 of file set_curve_type.cc.

References blender::attribute_math::convert_to_static_type(), and src.

◆ nurbs_to_bezier_assign() [2/2]

template<typename T >
static void blender::geometry::nurbs_to_bezier_assign ( const Span< T src,
const MutableSpan< T dst,
const KnotsMode  knots_mode 
)
static

◆ point_merge_by_distance()

PointCloud * blender::geometry::point_merge_by_distance ( const PointCloud src_points,
const float  merge_distance,
const IndexMask  selection 
)

Merge selected points into other selected points within the merge_distance. The merged indices favor speed over accuracy, since the results will depend on the order of the points.

Definition at line 16 of file point_merge_by_distance.cc.

References blender::bke::AttributeAccessor::all_ids(), blender::Array< T, InlineBufferCapacity, Allocator >::as_mutable_span(), ATTR_DOMAIN_POINT, BKE_pointcloud_new_nomain(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::attribute_math::convert_to_static_type(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), blender::Array< T, InlineBufferCapacity, Allocator >::fill(), blender::IndexRange::first(), blender::Array< T, InlineBufferCapacity, Allocator >::index_range(), blender::IndexMask::index_range(), blender::Array< T, InlineBufferCapacity, Allocator >::last(), blender::bke::AttributeAccessor::lookup(), blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_only_span(), blender::bke::AttributeAccessor::lookup_or_default(), offset, blender::threading::parallel_for(), blender::bke::pointcloud_attributes(), blender::bke::pointcloud_attributes_for_write(), positions, blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove_contained(), blender::IndexMask::size(), src, tree, blender::GVArrayCommon::type(), and blender::bke::GAttributeReader::varray.

Referenced by blender::nodes::node_geo_merge_by_distance_cc::pointcloud_merge_by_distance().

◆ prepare_attribute_fallbacks()

static Vector<std::pair<int, GSpan> > blender::geometry::prepare_attribute_fallbacks ( GatherTasksInfo gather_info,
const InstancesComponent instances_component,
const OrderedAttributes ordered_attributes 
)
static

◆ preprocess_curves()

static AllCurvesInfo blender::geometry::preprocess_curves ( const GeometrySet geometry_set,
const RealizeInstancesOptions options 
)
static

Definition at line 1093 of file realize_instances.cc.

References ATTR_DOMAIN_POINT, attribute, blender::geometry::RealizeCurveInfo::attributes, blender::geometry::AllCurvesInfo::attributes, blender::bke::AttributeAccessor::contains(), blender::geometry::AllCurvesInfo::create_handle_postion_attributes, blender::geometry::AllCurvesInfo::create_id_attribute, blender::geometry::AllCurvesInfo::create_radius_attribute, blender::geometry::AllCurvesInfo::create_resolution_attribute, blender::geometry::RealizeCurveInfo::curves, curves, gather_curves_to_realize(), gather_generic_curve_attributes_to_propagate(), Curves::geometry, blender::GVArrayCommon::get_internal_span(), blender::geometry::RealizeCurveInfo::handle_left, blender::geometry::RealizeCurveInfo::handle_right, blender::geometry::OrderedAttributes::ids, blender::geometry::OrderedAttributes::index_range(), blender::geometry::OrderedAttributes::kinds, blender::bke::AttributeAccessor::lookup(), blender::bke::AttributeAccessor::lookup_or_default(), options, blender::geometry::AllCurvesInfo::order, blender::geometry::RealizeCurveInfo::radius, blender::geometry::AllCurvesInfo::realize_info, blender::geometry::RealizeCurveInfo::resolution, blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size(), blender::geometry::OrderedAttributes::size(), blender::geometry::RealizeCurveInfo::stored_ids, blender::GSpan::typed(), blender::bke::GAttributeReader::varray, and blender::bke::image::partial_update::wrap().

Referenced by realize_instances().

◆ preprocess_meshes()

static AllMeshesInfo blender::geometry::preprocess_meshes ( const GeometrySet geometry_set,
const RealizeInstancesOptions options 
)
static

◆ preprocess_pointclouds()

static AllPointCloudsInfo blender::geometry::preprocess_pointclouds ( const GeometrySet geometry_set,
const RealizeInstancesOptions options 
)
static

◆ realize_instances()

GeometrySet blender::geometry::realize_instances ( GeometrySet  geometry_set,
const RealizeInstancesOptions options 
)

Join all instances into a single geometry component for each geometry type. For example, all mesh instances (including the already realized mesh) are joined into a single mesh. The output geometry set does not contain any instances. If the input did not contain any instances, it is returned directly.

The id attribute has special handling. If there is an id attribute on any component, the output will contain an id attribute as well. The output id is generated by mixing/hashing ids of instances and of the instanced geometry data.

Definition at line 1367 of file realize_instances.cc.

References GeometrySet::add(), blender::geometry::AllPointCloudsInfo::attributes, blender::geometry::AllMeshesInfo::attributes, blender::geometry::AllCurvesInfo::attributes, blender::geometry::AllPointCloudsInfo::create_id_attribute, blender::geometry::AllMeshesInfo::create_id_attribute, blender::geometry::AllCurvesInfo::create_id_attribute, blender::geometry::GatherTasks::curve_tasks, execute_realize_curve_tasks(), execute_realize_mesh_tasks(), execute_realize_pointcloud_tasks(), blender::geometry::GatherTasks::first_edit_data, blender::geometry::GatherTasks::first_volume, gather_realize_tasks_recursive(), GeometrySet::has_instances(), blender::geometry::AllMeshesInfo::materials, blender::geometry::GatherTasks::mesh_tasks, options, blender::geometry::GatherTasks::pointcloud_tasks, preprocess_curves(), preprocess_meshes(), preprocess_pointclouds(), blender::geometry::GatherTasksInfo::r_tasks, remove_id_attribute_from_instances(), and transform().

Referenced by blender::nodes::node_geo_join_geometry_cc::join_component_type(), and blender::nodes::node_geo_realize_instances_cc::node_geo_exec().

◆ remove_id_attribute_from_instances()

static void blender::geometry::remove_id_attribute_from_instances ( GeometrySet geometry_set)
static

Definition at line 1357 of file realize_instances.cc.

References GeometrySet::has(), and GeometrySet::modify_geometry_sets().

Referenced by realize_instances().

◆ resample_to_count()

Curves * blender::geometry::resample_to_count ( const CurveComponent src_component,
const fn::Field< bool > &  selection_field,
const fn::Field< int > &  count_field 
)

Create new curves where the selected curves have been resampled with a number of uniform-length samples defined by the count field. Interpolate attributes to the result, with an accuracy that depends on the curve's resolution parameter.

Note
The values provided by the #count_field are clamped to 1 or greater.

Definition at line 328 of file resample_curves.cc.

References get_count_input_max_one(), and resample_to_uniform().

Referenced by blender::nodes::node_geo_curve_resample_cc::node_geo_exec().

◆ resample_to_evaluated()

Curves * blender::geometry::resample_to_evaluated ( const CurveComponent src_component,
const fn::Field< bool > &  selection_field 
)

◆ resample_to_length()

Curves * blender::geometry::resample_to_length ( const CurveComponent src_component,
const fn::Field< bool > &  selection_field,
const fn::Field< float > &  segment_length_field 
)

Create new curves resampled to make each segment have the length specified by the #segment_length field input, rounded to make the length of each segment the same. The accuracy will depend on the curve's resolution parameter.

Definition at line 335 of file resample_curves.cc.

References get_count_input_from_length(), and resample_to_uniform().

Referenced by blender::nodes::node_geo_curve_resample_cc::node_geo_exec().

◆ resample_to_uniform()

static Curves* blender::geometry::resample_to_uniform ( const CurveComponent src_component,
const fn::Field< bool > &  selection_field,
const fn::Field< int > &  count_field 
)
static

◆ retrieve_attribute_spans()

static void blender::geometry::retrieve_attribute_spans ( const Span< bke::AttributeIDRef ids,
const CurveComponent src_component,
CurveComponent dst_component,
Vector< GSpan > &  src,
Vector< GMutableSpan > &  dst,
Vector< bke::GSpanAttributeWriter > &  dst_attributes 
)
static

◆ retrieve_curve_sizes()

static void blender::geometry::retrieve_curve_sizes ( const bke::CurvesGeometry curves,
MutableSpan< int >  sizes 
)
static

◆ retrieve_generic_point_attributes()

static void blender::geometry::retrieve_generic_point_attributes ( const bke::AttributeAccessor src_attributes,
bke::MutableAttributeAccessor dst_attributes,
GenericAttributes attributes 
)
static

◆ scale_input_assign()

template<typename T >
static void blender::geometry::scale_input_assign ( const Span< T src,
const int  scale,
const int  offset,
MutableSpan< T dst 
)
static

Definition at line 44 of file set_curve_type.cc.

References blender::MutableSpan< T >::index_range(), offset, and src.

Referenced by create_nurbs_to_bezier_positions().

◆ subdivide_attribute_catmull_rom() [1/2]

static void blender::geometry::subdivide_attribute_catmull_rom ( const bke::CurvesGeometry src_curves,
const bke::CurvesGeometry dst_curves,
const IndexMask  selection,
const Span< int >  point_offsets,
const Span< bool cyclic,
const GSpan  src,
GMutableSpan  dst 
)
static

◆ subdivide_attribute_catmull_rom() [2/2]

template<typename T >
static void blender::geometry::subdivide_attribute_catmull_rom ( const bke::CurvesGeometry src_curves,
const bke::CurvesGeometry dst_curves,
const IndexMask  selection,
const Span< int >  point_offsets,
const Span< bool cyclic,
const Span< T src,
MutableSpan< T dst 
)
static

◆ subdivide_attribute_linear() [1/2]

static void blender::geometry::subdivide_attribute_linear ( const bke::CurvesGeometry src_curves,
const bke::CurvesGeometry dst_curves,
const IndexMask  selection,
const Span< int >  point_offsets,
const GSpan  src,
GMutableSpan  dst 
)
static

◆ subdivide_attribute_linear() [2/2]

template<typename T >
static void blender::geometry::subdivide_attribute_linear ( const bke::CurvesGeometry src_curves,
const bke::CurvesGeometry dst_curves,
const IndexMask  selection,
const Span< int >  point_offsets,
const Span< T src,
MutableSpan< T dst 
)
static

◆ subdivide_bezier_positions()

static void blender::geometry::subdivide_bezier_positions ( const Span< float3 src_positions,
const Span< int8_t src_types_l,
const Span< int8_t src_types_r,
const Span< float3 src_handles_l,
const Span< float3 src_handles_r,
const Span< int >  evaluated_offsets,
const bool  cyclic,
MutableSpan< float3 dst_positions,
MutableSpan< int8_t dst_types_l,
MutableSpan< int8_t dst_types_r,
MutableSpan< float3 dst_handles_l,
MutableSpan< float3 dst_handles_r 
)
static

◆ subdivide_bezier_segment()

static void blender::geometry::subdivide_bezier_segment ( const float3 position_prev,
const float3 handle_prev,
const float3 handle_next,
const float3 position_next,
const HandleType  type_prev,
const HandleType  type_next,
const IndexRange  segment_points,
MutableSpan< float3 dst_positions,
MutableSpan< float3 dst_handles_l,
MutableSpan< float3 dst_handles_r,
MutableSpan< int8_t dst_types_l,
MutableSpan< int8_t dst_types_r,
const bool  is_last_cyclic_segment 
)
static

◆ subdivide_curves()

bke::CurvesGeometry blender::geometry::subdivide_curves ( const bke::CurvesGeometry src_curves,
IndexMask  selection,
const VArray< int > &  cuts 
)

Add more points along each segment, with the amount of points to add in each segment described by the #cuts input. The new points are equidistant in parameter space, but not in the actual distances.

Parameters
selectionA selection of curves to consider when subdividing.

Definition at line 297 of file subdivide_curves.cc.

References blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), ATTR_DOMAIN_MASK_POINT, attribute, blender::bke::CurvesGeometry::attributes(), blender::bke::CurvesGeometry::attributes_for_write(), calculate_result_offsets(), blender::bke::curves::copy_only_curve_domain(), blender::bke::CurvesGeometry::curves_num(), blender::bke::CurvesGeometry::curves_range(), blender::bke::CurvesGeometry::cyclic(), blender::IndexMask::extract_ranges_invert(), blender::Array< T, InlineBufferCapacity, Allocator >::fill(), blender::bke::CurvesGeometry::handle_positions_left(), blender::bke::CurvesGeometry::handle_positions_left_for_write(), blender::bke::CurvesGeometry::handle_positions_right(), blender::bke::CurvesGeometry::handle_positions_right_for_write(), blender::bke::CurvesGeometry::handle_types_left(), blender::bke::CurvesGeometry::handle_types_left_for_write(), blender::bke::CurvesGeometry::handle_types_right(), blender::bke::CurvesGeometry::handle_types_right_for_write(), blender::IndexMask::index_range(), blender::Span< T >::last(), blender::bke::CurvesGeometry::offsets(), blender::bke::CurvesGeometry::offsets_for_write(), blender::threading::parallel_for(), blender::bke::CurvesGeometry::points_num(), blender::bke::CurvesGeometry::positions(), blender::bke::CurvesGeometry::positions_for_write(), blender::bke::CurvesGeometry::resize(), blender::bke::retrieve_attributes_for_transfer(), subdivide_attribute_catmull_rom(), and subdivide_attribute_linear().

Referenced by blender::nodes::node_geo_curve_subdivide_cc::node_geo_exec().

◆ threaded_copy()

static void blender::geometry::threaded_copy ( const GSpan  src,
GMutableSpan  dst 
)
static

◆ threaded_fill()

static void blender::geometry::threaded_fill ( const GPointer  value,
GMutableSpan  dst 
)
static

◆ threaded_slice_fill()

template<typename T >
static void blender::geometry::threaded_slice_fill ( const Span< T src,
const Span< int >  offsets,
MutableSpan< T dst 
)
static

Definition at line 28 of file fillet_curves.cc.

References blender::threading::parallel_for(), and src.

◆ to_bezier_size()

static int blender::geometry::to_bezier_size ( const CurveType  src_type,
const bool  cyclic,
const KnotsMode  knots_mode,
const int  src_size 
)
static

Definition at line 252 of file set_curve_type.cc.

References CURVE_TYPE_NURBS, and is_nurbs_to_bezier_one_to_one().

◆ to_nurbs_size()

static int blender::geometry::to_nurbs_size ( const CurveType  src_type,
const int  src_size 
)
static

Definition at line 269 of file set_curve_type.cc.

References CURVE_TYPE_BEZIER, and CURVE_TYPE_CATMULL_ROM.

◆ try_curves_conversion_in_place()

bool blender::geometry::try_curves_conversion_in_place ( IndexMask  selection,
CurveType  dst_type,
FunctionRef< bke::CurvesGeometry &()>  get_writable_curves_fn 
)

Try the conversion to the #dst_type– avoiding the majority of the work done in convert_curves by modifying an existing object in place rather than creating a new one.

Note
This function is necessary because attributes do not have proper support for CoW.
Parameters
get_writable_curves_fnShould return the write-able curves to change directly if possible. This is a function in order to avoid the cost of retrieval when unnecessary.

Definition at line 676 of file set_curve_type.cc.

References conversion_can_change_point_num(), and curves.

Referenced by blender::nodes::node_geo_curve_spline_type_cc::node_geo_exec().

◆ uv_to_cell_key()

static int2 blender::geometry::uv_to_cell_key ( const float2 uv,
const int  resolution 
)
static

◆ weld_edge_ctx_alloc()

static Vector<WeldEdge> blender::geometry::weld_edge_ctx_alloc ( Span< MEdge medge,
Span< int >  vert_dest_map,
MutableSpan< int >  r_edge_dest_map,
MutableSpan< int >  r_edge_ctx_map 
)
static

◆ weld_edge_ctx_setup()

static void blender::geometry::weld_edge_ctx_setup ( MutableSpan< WeldGroup r_vlinks,
MutableSpan< int >  r_edge_dest_map,
MutableSpan< WeldEdge r_wedge,
int *  r_edge_kiil_len 
)
static

◆ weld_edge_groups_setup()

static void blender::geometry::weld_edge_groups_setup ( const int  medge_len,
const int  edge_kill_len,
MutableSpan< WeldEdge wedge,
Span< int >  wedge_map,
MutableSpan< int >  r_edge_groups_map,
Array< int > &  r_edge_groups_buffer,
Array< WeldGroupEdge > &  r_edge_groups 
)
static

◆ weld_iter_loop_of_poly_begin()

static bool blender::geometry::weld_iter_loop_of_poly_begin ( WeldLoopOfPolyIter iter,
const WeldPoly wp,
Span< WeldLoop wloop,
Span< MLoop mloop,
Span< int >  loop_map,
int *  group_buffer 
)
static

◆ weld_iter_loop_of_poly_next()

static bool blender::geometry::weld_iter_loop_of_poly_next ( WeldLoopOfPolyIter iter)
static

◆ weld_mesh_context_create()

static void blender::geometry::weld_mesh_context_create ( const Mesh mesh,
MutableSpan< int >  vert_dest_map,
const int  vert_kill_len,
WeldMesh r_weld_mesh 
)
static

◆ weld_poly_loop_ctx_alloc()

static void blender::geometry::weld_poly_loop_ctx_alloc ( Span< MPoly mpoly,
Span< MLoop mloop,
Span< int >  vert_dest_map,
Span< int >  edge_dest_map,
WeldMesh r_weld_mesh 
)
static

◆ weld_poly_loop_ctx_setup()

static void blender::geometry::weld_poly_loop_ctx_setup ( Span< MLoop mloop,
const int  mvert_len,
Span< int >  vert_dest_map,
const int  remain_edge_ctx_len,
MutableSpan< WeldGroup r_vlinks,
WeldMesh r_weld_mesh 
)
static

◆ weld_poly_split_recursive()

static void blender::geometry::weld_poly_split_recursive ( Span< int >  vert_dest_map,
int  ctx_verts_len,
WeldPoly r_wp,
WeldMesh r_weld_mesh,
int *  r_poly_kill,
int *  r_loop_kill 
)
static

◆ weld_vert_ctx_alloc_and_setup()

static Vector<WeldVert> blender::geometry::weld_vert_ctx_alloc_and_setup ( Span< int >  vert_dest_map,
const int  vert_kill_len 
)
static

◆ weld_vert_groups_setup()

static void blender::geometry::weld_vert_groups_setup ( Span< WeldVert wvert,
Span< int >  vert_dest_map,
MutableSpan< int >  r_vert_groups_map,
Array< int > &  r_vert_groups_buffer,
Array< WeldGroup > &  r_vert_groups 
)
static

Variable Documentation

◆ max_neighbors

constexpr int blender::geometry::max_neighbors = 5
staticconstexpr

Definition at line 28 of file add_curves_on_mesh.cc.

Referenced by find_curve_neighbors().