Blender V5.0
blender::geometry::boolean Namespace Reference

Classes

struct  BooleanOpParameters

Enumerations

enum class  Solver { MeshArr = 0 , Float = 1 , Manifold = 2 }
enum class  Operation { Intersect = 0 , Union = 1 , Difference = 2 }
enum class  BooleanError {
  NoError = 0 , NonManifold = 1 , ResultTooBig = 2 , SolverNotAvailable = 3 ,
  UnknownError = 4
}

Functions

Meshmesh_boolean (Span< const Mesh * > meshes, Span< float4x4 > transforms, Span< Array< short > > material_remaps, BooleanOpParameters op_params, Solver solver, Vector< int > *r_intersecting_edges, BooleanError *r_error)
Meshmesh_boolean_manifold (Span< const Mesh * > meshes, Span< float4x4 > transforms, Span< Array< short > > material_remaps, BooleanOpParameters op_params, Vector< int > *r_intersecting_edges, BooleanError *r_error)
Float Boolean
static int face_boolean_operand (BMFace *f, void *)
static BMeshmesh_bm_concat (Span< const Mesh * > meshes, Span< float4x4 > transforms, Span< Array< short > > material_remaps, Array< std::array< BMLoop *, 3 > > &r_looptris)
static int operation_to_float_mode (const Operation operation)
static Meshmesh_boolean_float (Span< const Mesh * > meshes, Span< float4x4 > transforms, Span< Array< short > > material_remaps, const int boolean_mode, Vector< int > *)

Enumeration Type Documentation

◆ BooleanError

Enumerator
NoError 
NonManifold 
ResultTooBig 
SolverNotAvailable 
UnknownError 

Definition at line 35 of file GEO_mesh_boolean.hh.

◆ Operation

Enumerator
Intersect 
Union 
Difference 

Definition at line 29 of file GEO_mesh_boolean.hh.

◆ Solver

Specifies which solver to use.

Enumerator
MeshArr 

The exact solver based on the Mesh Arrangements for Solid Geometry paper, by Zhou, Grinspun, Zorin, and Jacobson.

Float 

The original BMesh floating point solver.

Manifold 

The Manifold library fast robust floating point solver.

Definition at line 17 of file GEO_mesh_boolean.hh.

Function Documentation

◆ face_boolean_operand()

int blender::geometry::boolean::face_boolean_operand ( BMFace * f,
void *  )
static

Function use to say what operand a face is part of, based on the BM_FACE_TAG which is set in bm_mesh_create.

Definition at line 915 of file geometry/intern/mesh_boolean.cc.

References BM_elem_flag_test, BM_FACE_TAG, and face_boolean_operand().

Referenced by face_boolean_operand(), and mesh_boolean_float().

◆ mesh_bm_concat()

◆ mesh_boolean()

Mesh * blender::geometry::boolean::mesh_boolean ( Span< const Mesh * > meshes,
Span< float4x4 > transforms,
Span< Array< short > > material_remaps,
BooleanOpParameters op_params,
Solver solver,
Vector< int > * r_intersecting_edges,
BooleanError * r_error )

Do a mesh boolean operation directly on meshes. Boolean operations operate on the volumes enclosed by the operands. If is only one operand, the non-float versions will do self-intersection and remove internal faces. If there are more than two meshes, the first mesh is operand 0 and the rest of the meshes are operand 1 (i.e., as if all of operands 1, ... are joined into one mesh. The exact solvers assume that the meshes are PWN (piecewise winding number, which approximately means that the meshes are enclosed watertight volumes, and all edges are manifold, though there are allowable exceptions to that last condition). If the meshes don't satisfy those conditions, all solvers will try to use ray-shooting to determine whether particular faces survive or not. This may or may not work in the way the user hopes.

Parameters
meshesThe meshes that are operands of the boolean operation.
transformsAn array of transform matrices used to transform the input meshes to bring them into the transform space of the result.
material_remapsAn array of maps from material slot numbers in the corresponding mesh to the material slot in the first mesh. It is OK for material_remaps or any of its constituent arrays to be empty. A -1 value means that the original index should be used with no mapping.
op_paramsSpecifies the boolean operation and assumptions we can make.
solverwhich solver to use
r_intersecting_edgesVector to store indices of edges on the resulting mesh in. These 'new' edges are the result of the intersections.
r_errorReturn place for error code to be stored.

Definition at line 1190 of file geometry/intern/mesh_boolean.cc.

References BLI_assert_unreachable, blender::geometry::boolean::BooleanOpParameters::boolean_mode, Float, Intersect, Manifold, mesh_boolean(), mesh_boolean_float(), mesh_boolean_manifold(), MeshArr, blender::geometry::boolean::BooleanOpParameters::no_self_intersections, NoError, operation_to_float_mode(), blender::Span< T >::size(), SolverNotAvailable, Union, and blender::geometry::boolean::BooleanOpParameters::watertight.

Referenced by blender::ed::sculpt_paint::trim::apply_trim(), mesh_boolean(), and blender::nodes::node_geo_boolean_cc::node_geo_exec().

◆ mesh_boolean_float()

◆ mesh_boolean_manifold()

Mesh * blender::geometry::boolean::mesh_boolean_manifold ( Span< const Mesh * > meshes,
Span< float4x4 > transforms,
Span< Array< short > > material_remaps,
BooleanOpParameters op_params,
Vector< int > * r_intersecting_edges,
BooleanError * r_error )

Referenced by mesh_boolean().

◆ operation_to_float_mode()