Blender V5.3
bmesh_bisect_plane.cc File Reference
#include <algorithm>
#include "MEM_guardedalloc.h"
#include "BLI_array.hh"
#include "BLI_linklist_stack.hh"
#include "BLI_math_geom_c.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_set.hh"
#include "BLI_utildefines.hh"
#include "BLI_utildefines_stack.hh"
#include "bmesh.hh"
#include "bmesh_bisect_plane.hh"
#include "BLI_strict_flags.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.

Macros

BMesh Element Accessors

Wrappers to hide internal data-structure abuse, later we may want to move this into some hash lookup to a separate struct, but for now we can store in #BMesh data.

#define BM_VERT_DIR(v)
#define BM_VERT_SKIP(v)
#define BM_VERT_DIST(v)
#define BM_VERT_SORTVAL(v)
#define BM_VERT_LOOPINDEX(v)

Functions

Math Functions
static short blender::plane_point_test_v3 (const float plane[4], const float co[3], const float eps, float *r_depth)
BMesh Flag Accessors

Hide flag access (for more readable code since same flag is used differently for vert/edge-face).

BLI_INLINE void blender::vert_is_center_enable (BMVert *v)
BLI_INLINE void blender::vert_is_center_disable (BMVert *v)
BLI_INLINE bool blender::vert_is_center_test (BMVert *v)
BLI_INLINE bool blender::vert_pair_adjacent_in_orig_face (BMVert *v_a, BMVert *v_b, const uint f_len_orig)
BLI_INLINE void blender::edge_is_cut_enable (BMEdge *e)
BLI_INLINE void blender::edge_is_cut_disable (BMEdge *e)
BLI_INLINE bool blender::edge_is_cut_test (BMEdge *e)
BLI_INLINE void blender::face_in_stack_enable (BMFace *f)
BLI_INLINE void blender::face_in_stack_disable (BMFace *f)
BLI_INLINE bool blender::face_in_stack_test (BMFace *f)
BMesh Face Bisect
static void blender::bm_face_bisect_verts (BMesh *bm, BMFace *f, const float plane[4], const short oflag_center, const short oflag_new)
Public BMesh Bisect Function
void blender::BM_mesh_bisect_plane (BMesh *bm, const float plane[4], const bool use_snap_center, const bool use_tag, const short oflag_center, const short oflag_new, const float eps)

Detailed Description

Cut the geometry in half using a plane.

Implementation
This simply works by splitting tagged edges who's verts span either side of the plane, then splitting faces along their dividing verts. The only complex case is when a ngon spans the axis multiple times, in this case we need to do some extra checks to correctly bisect the ngon. see: #bm_face_bisect_verts

Definition in file bmesh_bisect_plane.cc.

Macro Definition Documentation

◆ BM_VERT_DIR

#define BM_VERT_DIR ( v)
Value:
((short *)(&(v)->head.index))[0]

Definition at line 69 of file bmesh_bisect_plane.cc.

Referenced by blender::bm_face_bisect_verts(), and blender::BM_mesh_bisect_plane().

◆ BM_VERT_DIST

#define BM_VERT_DIST ( v)
Value:
((v)->no[0])

Definition at line 71 of file bmesh_bisect_plane.cc.

Referenced by blender::BM_mesh_bisect_plane().

◆ BM_VERT_LOOPINDEX

#define BM_VERT_LOOPINDEX ( v)
Value:
(*((uint *)(&(v)->no[2])))

Definition at line 73 of file bmesh_bisect_plane.cc.

Referenced by blender::bm_face_bisect_verts(), and blender::vert_pair_adjacent_in_orig_face().

◆ BM_VERT_SKIP

#define BM_VERT_SKIP ( v)
Value:
((short *)(&(v)->head.index))[1]

Definition at line 70 of file bmesh_bisect_plane.cc.

Referenced by blender::bm_face_bisect_verts().

◆ BM_VERT_SORTVAL

#define BM_VERT_SORTVAL ( v)
Value:
((v)->no[1])

Definition at line 72 of file bmesh_bisect_plane.cc.

Referenced by blender::bm_face_bisect_verts().