Blender V4.3
bmesh_boolean.cc File Reference
#include <functional>
#include "BLI_array.hh"
#include "BLI_math_mpq.hh"
#include "BLI_mesh_boolean.hh"
#include "BLI_mesh_intersect.hh"
#include "bmesh.hh"
#include "bmesh_boolean.hh"
#include "bmesh_edgesplit.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 
namespace  blender::meshintersect
 

Functions

bool BM_mesh_boolean (BMesh *, blender::Span< std::array< BMLoop *, 3 > > looptris, int(*test_fn)(BMFace *, void *), void *, const int, const bool, const bool, const bool, const int)
 
bool BM_mesh_boolean_knife (BMesh *, blender::Span< std::array< BMLoop *, 3 > > looptris, int(*test_fn)(BMFace *, void *), void *, const int, const bool, const bool, const bool, const bool)
 

Detailed Description

Main functions for boolean on a BMesh (used by the tool and modifier)

Definition in file bmesh_boolean.cc.

Function Documentation

◆ BM_mesh_boolean()

bool BM_mesh_boolean ( BMesh * bm,
blender::Span< std::array< BMLoop *, 3 > > looptris,
int(* test_fn )(BMFace *, void *),
void * user_data,
const int nshapes,
const bool use_self,
const bool keep_hidden,
const bool hole_tolerant,
const int boolean_mode )

Perform the boolean operation specified by boolean_mode on the mesh bm. The inputs to the boolean operation are either one sub-mesh (if use_self is true), or two sub-meshes. The sub-meshes are specified by providing a test_fn which takes a face and the supplied user_data and says with 'side' of the boolean operation that face is for: 0 for the first side (side A), 1 for the second side (side B), and -1 if the face is to be ignored completely in the boolean operation.

If use_self is true, all operations do the same: the sub-mesh is self-intersected and all pieces inside that result are removed. Otherwise, the operations can be one of BMESH_ISECT_BOOLEAN_ISECT, BMESH_ISECT_BOOLEAN_UNION, or BMESH_ISECT_BOOLEAN_DIFFERENCE.

(The actual library function called to do the boolean is internally capable of handling n-ary operands, so maybe in the future we can expose that functionality to users.)

Definition at line 465 of file bmesh_boolean.cc.

References UNUSED_VARS.

Referenced by blender::ed::sculpt_paint::trim::apply_trim(), and edbm_intersect_boolean_exec().

◆ BM_mesh_boolean_knife()

bool BM_mesh_boolean_knife ( BMesh * bm,
blender::Span< std::array< BMLoop *, 3 > > looptris,
int(* test_fn )(BMFace *, void *),
void * user_data,
const int nshapes,
const bool use_self,
const bool use_separate_all,
const bool hole_tolerant,
const bool keep_hidden )

Perform a Knife Intersection operation on the mesh bm. There are either one or two operands, the same as described above for BM_mesh_boolean(). If use_separate_all is true, each edge that is created from the intersection should be used to separate all its incident faces. TODO: implement that. TODO: need to ensure that "selected/non-selected" flag of original faces gets propagated to the intersection result faces.

Definition at line 487 of file bmesh_boolean.cc.

References UNUSED_VARS.

Referenced by edbm_intersect_exec().