Blender
V3.3
|
#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 LinkNode * | mesh_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). | |
LinkNode * | BM_mesh_calc_path_region_vert (BMesh *bm, BMElem *ele_src, BMElem *ele_dst, bool(*filter_fn)(BMVert *, void *user_data), void *user_data) |
LinkNode * | BM_mesh_calc_path_region_edge (BMesh *bm, BMElem *ele_src, BMElem *ele_dst, bool(*filter_fn)(BMEdge *, void *user_data), void *user_data) |
LinkNode * | BM_mesh_calc_path_region_face (BMesh *bm, BMElem *ele_src, BMElem *ele_dst, bool(*filter_fn)(BMFace *, void *user_data), void *user_data) |
Find the region defined by the path(s) between 2 elements. (path isn't ordered).
Definition in file bmesh_path_region.c.
#define USE_EDGE_CHAIN |
Special handling of vertices with 2 edges (act as if the edge-chain is a single edge).
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.
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 | ||
) |
Definition at line 403 of file bmesh_path_region.c.
References bm, BM_EDGE, BM_EDGES_OF_MESH, BM_elem_flag_disable, BM_elem_flag_set, BM_ELEM_TAG, BM_ITER_MESH_INDEX, BM_mesh_elem_hflag_enable_all(), BM_VERT, e, mesh_calc_path_region_elem(), NULL, and user_data.
Referenced by mouse_mesh_shortest_path_edge().
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 | ||
) |
Definition at line 435 of file bmesh_path_region.c.
References bm, BM_elem_flag_disable, BM_elem_flag_set, BM_ELEM_TAG, BM_FACE, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH_INDEX, BM_mesh_elem_hflag_enable_all(), BM_VERT, mesh_calc_path_region_elem(), BMLoop::next, NULL, user_data, and BMLoop::v.
Referenced by mouse_mesh_shortest_path_face().
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 | ||
) |
Definition at line 380 of file bmesh_path_region.c.
References bm, BM_elem_flag_set, BM_elem_index_set, BM_ELEM_TAG, BM_ITER_MESH_INDEX, BM_VERT, BM_VERTS_OF_MESH, BMesh::elem_index_dirty, mesh_calc_path_region_elem(), NULL, user_data, and v.
Referenced by mouse_mesh_shortest_path_vert().
Takes a vertex with 2 edge users and assigns the vertices at each end-point,
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().
Definition at line 67 of file bmesh_path_region.c.
References BM_elem_index_get, and v.
Referenced by bm_vert_region_test_chain().
Definition at line 75 of file bmesh_path_region.c.
References BM_vert_is_edge_pair_manifold(), bm_vert_pair_ends(), bm_vert_region_test(), and v.
Referenced by mesh_calc_path_region_elem().
|
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.
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().