Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_sort.h"
#include "BLI_stack.h"
#include "BKE_bvhutils.h"
#include "atomic_ops.h"
#include "bmesh.h"
#include "bmesh_intersect_edges.h"
Go to the source code of this file.
Classes | |
struct | EDBMSplitBestFaceData |
struct | EDBMSplitElem |
struct | EDBMSplitData |
Macros | |
#define | KDOP_TREE_TYPE 4 |
#define | KDOP_AXIS_LEN 14 |
#define | BLI_STACK_PAIR_LEN (2 * KDOP_TREE_TYPE) |
#define | EDGE_ACT_TO_TEST 1 |
#define | EDGE_REMAIN_TO_TEST 2 |
Functions | |
Weld Linked Wire Edges into Linked Faces | |
Used with the merge vertices option. | |
static bool | bm_vert_pair_share_best_splittable_face_cb (BMFace *f, BMLoop *l_a, BMLoop *l_b, void *userdata) |
static bool | bm_vert_pair_share_splittable_face_cb (BMFace *UNUSED(f), BMLoop *l_a, BMLoop *l_b, void *userdata) |
static BMFace * | bm_vert_pair_best_face_get (BMVert *v_a, BMVert *v_b, BMEdge **edgenet, const int edgenet_len, const float epsilon) |
Auto-Merge & Split Selection | |
#define | INTERSECT_EDGES |
static void | bm_vert_pair_elem_setup_ex (BMVert *v, struct EDBMSplitElem *r_pair_elem) |
static void | bm_edge_pair_elem_setup (BMEdge *e, float lambda, int *r_data_cut_edges_len, struct EDBMSplitElem *r_pair_elem) |
static bool | bm_edgexvert_isect_impl (BMVert *v, BMEdge *e, const float co[3], const float dir[3], float lambda, float data_dist_sq, int *data_cut_edges_len, struct EDBMSplitElem r_pair[2]) |
static bool | bm_vertxvert_isect_cb (void *userdata, int index_a, int index_b, int thread) |
static bool | bm_vertxvert_self_isect_cb (void *userdata, int index_a, int index_b, int thread) |
static bool | bm_edgexvert_isect_cb (void *userdata, int index_a, int index_b, int thread) |
static bool | bm_edgexedge_isect_impl (struct EDBMSplitData *data, BMEdge *e_a, BMEdge *e_b, const float co_a[3], const float dir_a[3], const float co_b[3], const float dir_b[3], float lambda_a, float lambda_b, struct EDBMSplitElem r_pair[2]) |
static bool | bm_edgexedge_isect_cb (void *userdata, int index_a, int index_b, int thread) |
static bool | bm_edgexedge_self_isect_cb (void *userdata, int index_a, int index_b, int thread) |
static void | bm_elemxelem_bvhtree_overlap (const BVHTree *tree1, const BVHTree *tree2, BVHTree_OverlapCallback callback, struct EDBMSplitData *data, BLI_Stack **pair_stack) |
static int | sort_cmp_by_lambda_cb (const void *index1_v, const void *index2_v, void *keys_v) |
bool | BM_mesh_intersect_edges (BMesh *bm, const char hflag, const float dist, const bool split_faces, GHash *r_targetmap) |
#define BLI_STACK_PAIR_LEN (2 * KDOP_TREE_TYPE) |
Definition at line 26 of file bmesh_intersect_edges.c.
#define EDGE_ACT_TO_TEST 1 |
#define EDGE_REMAIN_TO_TEST 2 |
#define INTERSECT_EDGES |
Definition at line 467 of file bmesh_intersect_edges.c.
#define KDOP_AXIS_LEN 14 |
Definition at line 25 of file bmesh_intersect_edges.c.
#define KDOP_TREE_TYPE 4 |
Definition at line 24 of file bmesh_intersect_edges.c.
|
static |
Definition at line 212 of file bmesh_intersect_edges.c.
References atomic_fetch_and_add_int32(), e, EDBMSplitElem::edge, BMVert::head, BMHeader::index, and EDBMSplitElem::lambda.
Referenced by bm_edgexedge_isect_impl(), and bm_edgexvert_isect_impl().
Definition at line 388 of file bmesh_intersect_edges.c.
References BLI_stack_push_r(), BM_edge_at_index(), BM_edge_share_vert_check(), bm_edgexedge_isect_impl(), BMVert::co, copy_v3_v3(), data, isect_ray_ray_epsilon_v3(), sub_v3_v3v3(), BMEdge::v1, and BMEdge::v2.
Referenced by bm_edgexedge_self_isect_cb(), and BM_mesh_intersect_edges().
|
static |
Definition at line 329 of file bmesh_intersect_edges.c.
References bm_edge_pair_elem_setup(), data, IN_RANGE_INCL, len_squared_v3(), len_squared_v3v3(), madd_v3_v3v3fl(), square_f(), BMEdge::v1, and BMEdge::v2.
Referenced by bm_edgexedge_isect_cb().
|
static |
Definition at line 422 of file bmesh_intersect_edges.c.
References bm_edgexedge_isect_cb().
Referenced by BM_mesh_intersect_edges().
Definition at line 304 of file bmesh_intersect_edges.c.
References BLI_stack_push_r(), BM_edge_at_index(), bm_edgexvert_isect_impl(), BM_vert_at_index(), BMVert::co, copy_v3_v3(), data, e, EDBMSplitElem::lambda, ray_point_factor_v3_ex(), sub_v3_v3v3(), and v.
Referenced by BM_mesh_intersect_edges().
|
static |
Definition at line 231 of file bmesh_intersect_edges.c.
References bm_edge_pair_elem_setup(), bm_vert_pair_elem_setup_ex(), closest(), BMVert::co, e, IN_RANGE_INCL, len_squared_v3(), len_squared_v3v3(), madd_v3_v3v3fl(), square_f(), and v.
Referenced by bm_edgexvert_isect_cb().
|
static |
Definition at line 433 of file bmesh_intersect_edges.c.
References BLI_bvhtree_overlap_ex(), BLI_bvhtree_overlap_thread_num(), BLI_stack_new, BVH_OVERLAP_USE_THREADING, callback, data, and NULL.
Referenced by BM_mesh_intersect_edges().
bool BM_mesh_intersect_edges | ( | BMesh * | bm, |
const char | hflag, | ||
const float | dist, | ||
const bool | split_faces, | ||
GHash * | r_targetmap | ||
) |
The weld_verts operator works best when all keys in the same group of collapsed vertices point to the same vertex. That is, if the pairs of vertices are: [1, 2], [2, 3] and [3, 4], They are better adjusted to: [1, 4], [2, 4] and [3, 4].
va---vb--- / va_dest
---v---v_other \ v_other_dest
Definition at line 469 of file bmesh_intersect_edges.c.
References as_int(), BLI_assert, BLI_bvhtree_balance(), BLI_bvhtree_free(), BLI_bvhtree_insert(), BLI_bvhtree_new(), BLI_ghash_insert(), BLI_ghash_lookup(), BLI_ghash_lookup_p(), BLI_qsort_r(), BLI_stack_count(), BLI_stack_free(), BLI_STACK_PAIR_LEN, BLI_stack_pop_n_reverse(), bm, BM_CREATE_NOP, BM_DISK_EDGE_NEXT, BM_EDGE, BM_edge_create(), BM_edge_exists(), BM_edge_is_wire(), BM_edge_other_vert(), BM_edge_split(), BM_EDGES_OF_MESH, bm_edgexedge_isect_cb(), bm_edgexedge_self_isect_cb(), bm_edgexvert_isect_cb(), BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_HIDDEN, BM_elem_index_get, BM_elem_index_set, BM_ELEM_TAG, bm_elemxelem_bvhtree_overlap(), BM_face_normal_update(), BM_face_split_edgenet(), BM_ITER_MESH, BM_ITER_MESH_INDEX, BM_mesh_elem_table_ensure(), BM_VERT, bm_vert_pair_best_face_get(), BM_vert_pair_share_face_check(), BM_VERTS_OF_MESH, bm_vertxvert_isect_cb(), bm_vertxvert_self_isect_cb(), BMVert::co, copy_v3_v3(), count, data, EDBMSplitData::dist_sq, e, EDBMSplitElem::edge, EDGE_ACT_TO_TEST, EDGE_REMAIN_TO_TEST, EDBMSplitElem::elem, BMesh::elem_index_dirty, BMVert::head, BMElem::head, BMHeader::htype, BMHeader::index, KDOP_AXIS_LEN, KDOP_TREE_TYPE, EDBMSplitElem::lambda, len_squared_v3v3(), MEM_freeN, MEM_mallocN, MEM_reallocN, NULL, EDBMSplitData::pair_stack, sort_cmp_by_lambda_cb(), square_f(), SWAP, v, BMEdge::v1, BMEdge::v2, and EDBMSplitElem::vert.
Referenced by EDBM_automerge_and_split().
|
static |
Definition at line 123 of file bmesh_intersect_edges.c.
References BLI_assert, BM_edge_in_face(), BM_ITER_ELEM, bm_vert_pair_share_best_splittable_face_cb(), bm_vert_pair_share_splittable_face_cb(), BM_vert_pair_shared_face_cb(), BM_VERTS_OF_FACE, BMVert::co, copy_v3_v3(), data, blender::math::dot(), dot_v3v3(), EDBMSplitBestFaceData::edgenet, EDBMSplitBestFaceData::edgenet_len, blender::robust_pred::epsilon, max, min, NULL, EDBMSplitBestFaceData::r_best_face, and sub_v3_v3v3().
Referenced by BM_mesh_intersect_edges().
|
static |
Definition at line 207 of file bmesh_intersect_edges.c.
References v, and EDBMSplitElem::vert.
Referenced by bm_edgexvert_isect_impl(), and bm_vertxvert_isect_cb().
|
static |
Definition at line 48 of file bmesh_intersect_edges.c.
References EDBMSplitBestFaceData::best_edgenet_range_on_face_normal, BLI_assert, BM_edge_other_vert(), BM_face_point_inside_test(), BMVert::co, copy_v3_v3(), data, blender::math::dot(), dot_v3v3(), ELEM, l_b, max, min, BMFace::no, NULL, SWAP, BMLoop::v, BMEdge::v1, and BMEdge::v2.
Referenced by bm_vert_pair_best_face_get().
|
static |
Definition at line 93 of file bmesh_intersect_edges.c.
References BMVert::co, copy_v3_v3(), data, float(), IN_RANGE, isect_ray_ray_v3(), l_b, BMLoop::next, NULL, BMLoop::prev, sub_v3_v3v3(), and BMLoop::v.
Referenced by bm_vert_pair_best_face_get().
Definition at line 280 of file bmesh_intersect_edges.c.
References BLI_stack_push_r(), BM_vert_at_index(), bm_vert_pair_elem_setup_ex(), and data.
Referenced by BM_mesh_intersect_edges(), and bm_vertxvert_self_isect_cb().
|
static |
Definition at line 294 of file bmesh_intersect_edges.c.
References bm_vertxvert_isect_cb().
Referenced by BM_mesh_intersect_edges().
|
static |
Definition at line 452 of file bmesh_intersect_edges.c.
References EDBMSplitElem::lambda.
Referenced by BM_mesh_intersect_edges().