Blender
V3.3
|
#include <limits.h>
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_linklist.h"
#include "BLI_linklist_stack.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_utildefines_stack.h"
#include "bmesh.h"
#include "bmesh_bisect_plane.h"
#include "BLI_strict_flags.h"
Go to the source code of this file.
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) ((short *)(&(v)->head.index))[0] /* Direction -1/0/1 */ |
#define | BM_VERT_SKIP(v) ((short *)(&(v)->head.index))[1] /* Skip Vert 0/1 */ |
#define | BM_VERT_DIST(v) ((v)->no[0]) /* Distance from the plane. */ |
#define | BM_VERT_SORTVAL(v) ((v)->no[1]) /* Temp value for sorting. */ |
#define | BM_VERT_LOOPINDEX(v) |
Functions | |
Math Functions | |
static short | 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 | vert_is_center_enable (BMVert *v) |
BLI_INLINE void | vert_is_center_disable (BMVert *v) |
BLI_INLINE bool | vert_is_center_test (BMVert *v) |
BLI_INLINE bool | vert_pair_adjacent_in_orig_face (BMVert *v_a, BMVert *v_b, const uint f_len_orig) |
BLI_INLINE void | edge_is_cut_enable (BMEdge *e) |
BLI_INLINE void | edge_is_cut_disable (BMEdge *e) |
BLI_INLINE bool | edge_is_cut_test (BMEdge *e) |
BLI_INLINE void | face_in_stack_enable (BMFace *f) |
BLI_INLINE void | face_in_stack_disable (BMFace *f) |
BLI_INLINE bool | face_in_stack_test (BMFace *f) |
BMesh Face Bisect | |
static int | bm_vert_sortval_cb (const void *v_a_v, const void *v_b_v) |
static void | 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 | 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) |
Cut the geometry in half using a plane.
Definition in file bmesh_bisect_plane.c.
Definition at line 63 of file bmesh_bisect_plane.c.
Definition at line 65 of file bmesh_bisect_plane.c.
Definition at line 67 of file bmesh_bisect_plane.c.
Definition at line 64 of file bmesh_bisect_plane.c.
Definition at line 66 of file bmesh_bisect_plane.c.
|
static |
Definition at line 147 of file bmesh_bisect_plane.c.
References axis_dominant_v3_to_m3(), BLI_array_alloca, BLI_assert, bm, BM_FACE_FIRST_LOOP, BM_face_is_normal_valid(), BM_face_split(), BM_face_vert_share_loop(), BM_loop_is_adjacent(), BM_VERT_DIR, BM_VERT_LOOPINDEX, BM_VERT_SKIP, BM_VERT_SORTVAL, bm_vert_sortval_cb(), BMO_edge_flag_enable, BMO_face_flag_enable, BMVert::co, cross_v3_v3v3(), dot_v3v3(), BMLoop::e, equals_v3v3(), BMLoop::f, float(), is_inside(), l_b, BMFace::len, LIKELY, mul_v2_m3v3(), BMLoop::next, BMFace::no, normalize_v3(), NULL, BMLoop::prev, STACK_DECLARE, STACK_INIT, STACK_PUSH, STACK_SIZE, sub_v3_v3v3(), UNLIKELY, BMLoop::v, v, vert_is_center_test(), vert_pair_adjacent_in_orig_face(), and void.
Referenced by BM_mesh_bisect_plane().
void BM_mesh_bisect_plane | ( | BMesh * | bm, |
const float | plane[4], | ||
bool | use_snap_center, | ||
bool | use_tag, | ||
short | oflag_center, | ||
short | oflag_new, | ||
float | eps | ||
) |
use_snap_center | Snap verts onto the plane. |
use_tag | Only bisect tagged edges and faces. |
oflag_center | Operator flag, enabled for geometry on the axis (existing and created) |
Definition at line 400 of file bmesh_bisect_plane.c.
References BLI_LINKSTACK_DECLARE, BLI_LINKSTACK_FREE, BLI_LINKSTACK_INIT, BLI_LINKSTACK_POP, BLI_LINKSTACK_PUSH, bm, BM_edge_split(), BM_EDGES_OF_MESH, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_TAG, bm_face_bisect_verts(), BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_ELEM_INDEX, BM_ITER_MESH, BM_ITER_MESH_INDEX, BM_LOOPS_OF_VERT, BM_mesh_elem_hflag_disable_all(), BM_VERT, BM_VERT_DIR, BM_VERT_DIST, BM_VERTS_OF_EDGE, BM_VERTS_OF_MESH, BMO_edge_flag_enable, BMO_vert_flag_enable, closest_to_plane_v3(), BMVert::co, e, edge_is_cut_enable(), edge_is_cut_test(), BMesh::elem_index_dirty, eps, BMLoop::f, face_in_stack_disable(), face_in_stack_enable(), face_in_stack_test(), MEM_freeN, MEM_mallocN, plane_point_test_v3(), BMLoop::radial_next, BMesh::totedge, v, vert_is_center_disable(), vert_is_center_enable(), and vert_is_center_test().
Referenced by BKE_mesh_mirror_bisect_on_mirror_plane_for_modifier(), and bmo_bisect_plane_exec().
Definition at line 133 of file bmesh_bisect_plane.c.
References BM_VERT_SORTVAL.
Referenced by bm_face_bisect_verts().
BLI_INLINE void edge_is_cut_disable | ( | BMEdge * | e | ) |
Definition at line 104 of file bmesh_bisect_plane.c.
References BM_elem_flag_disable, BM_ELEM_TAG, and e.
BLI_INLINE void edge_is_cut_enable | ( | BMEdge * | e | ) |
Enable when the edge can be cut.
Definition at line 100 of file bmesh_bisect_plane.c.
References BM_elem_flag_enable, BM_ELEM_TAG, and e.
Referenced by BM_mesh_bisect_plane().
BLI_INLINE bool edge_is_cut_test | ( | BMEdge * | e | ) |
Definition at line 108 of file bmesh_bisect_plane.c.
References BM_elem_flag_test, BM_ELEM_TAG, and e.
Referenced by BM_mesh_bisect_plane().
BLI_INLINE void face_in_stack_disable | ( | BMFace * | f | ) |
Definition at line 118 of file bmesh_bisect_plane.c.
References BM_elem_flag_enable, and BM_ELEM_TAG.
Referenced by BM_mesh_bisect_plane().
BLI_INLINE void face_in_stack_enable | ( | BMFace * | f | ) |
Enable when the faces are added to the stack.
Definition at line 114 of file bmesh_bisect_plane.c.
References BM_elem_flag_disable, and BM_ELEM_TAG.
Referenced by BM_mesh_bisect_plane().
BLI_INLINE bool face_in_stack_test | ( | BMFace * | f | ) |
Definition at line 122 of file bmesh_bisect_plane.c.
References BM_elem_flag_test, and BM_ELEM_TAG.
Referenced by BM_mesh_bisect_plane().
|
static |
Definition at line 36 of file bmesh_bisect_plane.c.
References eps, and plane_point_side_v3().
Referenced by BM_mesh_bisect_plane().
BLI_INLINE void vert_is_center_disable | ( | BMVert * | v | ) |
Definition at line 84 of file bmesh_bisect_plane.c.
References BM_elem_flag_disable, BM_ELEM_TAG, and v.
Referenced by BM_mesh_bisect_plane().
BLI_INLINE void vert_is_center_enable | ( | BMVert * | v | ) |
Enable when vertex is in the center and its faces have been added to the stack.
Definition at line 80 of file bmesh_bisect_plane.c.
References BM_elem_flag_enable, BM_ELEM_TAG, and v.
Referenced by BM_mesh_bisect_plane().
BLI_INLINE bool vert_is_center_test | ( | BMVert * | v | ) |
Definition at line 88 of file bmesh_bisect_plane.c.
References BM_elem_flag_test, BM_ELEM_TAG, and v.
Referenced by bm_face_bisect_verts(), and BM_mesh_bisect_plane().
BLI_INLINE bool vert_pair_adjacent_in_orig_face | ( | BMVert * | v_a, |
BMVert * | v_b, | ||
const uint | f_len_orig | ||
) |
Definition at line 93 of file bmesh_bisect_plane.c.
References blender::math::abs(), BM_VERT_LOOPINDEX, and ELEM.
Referenced by bm_face_bisect_verts().