Blender  V3.3
Macros | Functions
bmesh_path_region.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_utildefines_stack.h"
#include "bmesh.h"
#include "bmesh_path_region.h"

Go to the source code of this file.

Macros

#define USE_EDGE_CHAIN
 

Functions

static bool bm_vert_pair_ends (BMVert *v_pivot, BMVert *v_end_pair[2])
 
static LinkNodemesh_calc_path_region_elem (BMesh *bm, BMElem *ele_src, BMElem *ele_dst, const char path_htype)
 
Vertex in Region Checks
static bool bm_vert_region_test (BMVert *v, int *const depths[2], const int pass)
 
static bool bm_vert_region_test_chain (BMVert *v, int *const depths[2], const int pass)
 
Main Functions (exposed externally).
LinkNodeBM_mesh_calc_path_region_vert (BMesh *bm, BMElem *ele_src, BMElem *ele_dst, bool(*filter_fn)(BMVert *, void *user_data), void *user_data)
 
LinkNodeBM_mesh_calc_path_region_edge (BMesh *bm, BMElem *ele_src, BMElem *ele_dst, bool(*filter_fn)(BMEdge *, void *user_data), void *user_data)
 
LinkNodeBM_mesh_calc_path_region_face (BMesh *bm, BMElem *ele_src, BMElem *ele_dst, bool(*filter_fn)(BMFace *, void *user_data), void *user_data)
 

Detailed Description

Find the region defined by the path(s) between 2 elements. (path isn't ordered).

Definition in file bmesh_path_region.c.

Macro Definition Documentation

◆ USE_EDGE_CHAIN

#define USE_EDGE_CHAIN

Special handling of vertices with 2 edges (act as if the edge-chain is a single edge).

Note
Regarding manifold edge stepping: BM_vert_is_edge_pair_manifold usage. Logic to skip a chain of vertices is not applied at boundaries because it gives strange behavior from a user perspective especially with boundary quads, see: T52701

Restrict walking over a vertex chain to cases where the edges share the same faces. This is more typical of what a user would consider a vertex chain.

Definition at line 31 of file bmesh_path_region.c.

Function Documentation

◆ BM_mesh_calc_path_region_edge()

LinkNode* BM_mesh_calc_path_region_edge ( BMesh bm,
BMElem ele_src,
BMElem ele_dst,
bool(*)(BMEdge *, void *user_data filter_fn,
void user_data 
)

◆ BM_mesh_calc_path_region_face()

LinkNode* BM_mesh_calc_path_region_face ( BMesh bm,
BMElem ele_src,
BMElem ele_dst,
bool(*)(BMFace *, void *user_data filter_fn,
void user_data 
)

◆ BM_mesh_calc_path_region_vert()

LinkNode* BM_mesh_calc_path_region_vert ( BMesh bm,
BMElem ele_src,
BMElem ele_dst,
bool(*)(BMVert *, void *user_data filter_fn,
void user_data 
)

◆ bm_vert_pair_ends()

static bool bm_vert_pair_ends ( BMVert v_pivot,
BMVert v_end_pair[2] 
)
static

Takes a vertex with 2 edge users and assigns the vertices at each end-point,

Returns
Success when v_end_pair values are set or false if the edges loop back on themselves.

Definition at line 39 of file bmesh_path_region.c.

References BLI_assert, BM_DISK_EDGE_NEXT, BM_edge_other_vert(), BM_vert_is_edge_pair_manifold(), BMVert::e, and e.

Referenced by bm_vert_region_test_chain(), and mesh_calc_path_region_elem().

◆ bm_vert_region_test()

static bool bm_vert_region_test ( BMVert v,
int *const  depths[2],
const int  pass 
)
static

Definition at line 67 of file bmesh_path_region.c.

References BM_elem_index_get, and v.

Referenced by bm_vert_region_test_chain().

◆ bm_vert_region_test_chain()

static bool bm_vert_region_test_chain ( BMVert v,
int *const  depths[2],
const int  pass 
)
static

◆ mesh_calc_path_region_elem()

static LinkNode* mesh_calc_path_region_elem ( BMesh bm,
BMElem ele_src,
BMElem ele_dst,
const char  path_htype 
)
static

Main logic for calculating region between 2 elements.

This method works walking (breadth first) over all vertices, keeping track of topological distance from the source.

This is done in both directions, after that each vertices 'depth' is added to check if its less than the number of passes needed to complete the search. When it is, we know the path is one of possible paths that have the minimum topological distance.

Note
Only verts without BM_ELEM_TAG will be walked over.

Definition at line 111 of file bmesh_path_region.c.

References BLI_array_alloca, BLI_assert, BLI_linklist_prepend(), bm, BM_DISK_EDGE_NEXT, BM_EDGE, BM_edge_other_vert(), BM_EDGES_OF_MESH, BM_elem_flag_test, BM_elem_index_get, BM_ELEM_TAG, BM_FACE, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH, BM_mesh_elem_index_ensure(), BM_VERT, BM_vert_is_edge_pair_manifold(), bm_vert_pair_ends(), bm_vert_region_test_chain(), BM_VERTS_OF_MESH, copy_vn_i(), BMVert::e, e, ELEM, BMElem::head, BMHeader::htype, BMFace::len, MEM_freeN, MEM_mallocN, BMLoop::next, NULL, STACK_CLEAR, STACK_DECLARE, STACK_INIT, STACK_POP, STACK_PUSH, STACK_SIZE, STACK_SWAP, BMesh::totvert, BMLoop::v, and v.

Referenced by BM_mesh_calc_path_region_edge(), BM_mesh_calc_path_region_face(), and BM_mesh_calc_path_region_vert().