Blender V4.3
bmesh_intersect_edges.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_math_geom.h"
#include "BLI_math_vector.h"
#include "BLI_sort.h"
#include "BLI_stack.h"
#include "BLI_vector.hh"
#include "BKE_bvhutils.hh"
#include "atomic_ops.h"
#include "bmesh.hh"
#include "bmesh_intersect_edges.hh"

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 *, BMLoop *l_a, BMLoop *l_b, void *userdata)
 
static BMFacebm_vert_pair_best_face_get (BMVert *v_a, BMVert *v_b, BMEdge **edgenet, const int edgenet_len, const float epsilon)
 

Auto-Merge & Split Selection

Used after transform operations.

#define INTERSECT_EDGES
 
static void bm_vert_pair_elem_setup_ex (BMVert *v, EDBMSplitElem *r_pair_elem)
 
static void bm_edge_pair_elem_setup (BMEdge *e, float lambda, int *r_data_cut_edges_len, 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, 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 (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, 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, 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)
 

Macro Definition Documentation

◆ BLI_STACK_PAIR_LEN

#define BLI_STACK_PAIR_LEN   (2 * KDOP_TREE_TYPE)

Definition at line 29 of file bmesh_intersect_edges.cc.

Referenced by BM_mesh_intersect_edges().

◆ EDGE_ACT_TO_TEST

#define EDGE_ACT_TO_TEST   1

Referenced by BM_mesh_intersect_edges().

◆ EDGE_REMAIN_TO_TEST

#define EDGE_REMAIN_TO_TEST   2

Referenced by BM_mesh_intersect_edges().

◆ INTERSECT_EDGES

#define INTERSECT_EDGES

Definition at line 473 of file bmesh_intersect_edges.cc.

◆ KDOP_AXIS_LEN

#define KDOP_AXIS_LEN   14

Definition at line 28 of file bmesh_intersect_edges.cc.

Referenced by BM_mesh_intersect_edges().

◆ KDOP_TREE_TYPE

#define KDOP_TREE_TYPE   4

Definition at line 27 of file bmesh_intersect_edges.cc.

Referenced by BM_mesh_intersect_edges().

Function Documentation

◆ bm_edge_pair_elem_setup()

static void bm_edge_pair_elem_setup ( BMEdge * e,
float lambda,
int * r_data_cut_edges_len,
EDBMSplitElem * r_pair_elem )
static

◆ bm_edgexedge_isect_cb()

static bool bm_edgexedge_isect_cb ( void * userdata,
int index_a,
int index_b,
int thread )
static

◆ bm_edgexedge_isect_impl()

static bool bm_edgexedge_isect_impl ( 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,
EDBMSplitElem r_pair[2] )
static

◆ bm_edgexedge_self_isect_cb()

static bool bm_edgexedge_self_isect_cb ( void * userdata,
int index_a,
int index_b,
int thread )
static

Definition at line 428 of file bmesh_intersect_edges.cc.

References bm_edgexedge_isect_cb().

Referenced by BM_mesh_intersect_edges().

◆ bm_edgexvert_isect_cb()

static bool bm_edgexvert_isect_cb ( void * userdata,
int index_a,
int index_b,
int thread )
static

◆ bm_edgexvert_isect_impl()

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,
EDBMSplitElem r_pair[2] )
static

◆ bm_elemxelem_bvhtree_overlap()

static void bm_elemxelem_bvhtree_overlap ( const BVHTree * tree1,
const BVHTree * tree2,
BVHTree_OverlapCallback callback,
EDBMSplitData * data,
BLI_Stack ** pair_stack )
static

◆ 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 475 of file bmesh_intersect_edges.cc.

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, EDBMSplitData::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, e, EDBMSplitElem::edge, EDGE_ACT_TO_TEST, EDGE_REMAIN_TO_TEST, EDBMSplitElem::elem, BMesh::elem_index_dirty, BMElem::head, BMVert::head, BMHeader::htype, BMHeader::index, KDOP_AXIS_LEN, KDOP_TREE_TYPE, EDBMSplitElem::lambda, len_squared_v3v3(), MEM_freeN(), MEM_mallocN, MEM_reallocN, sort_cmp_by_lambda_cb(), square_f(), v, BMEdge::v1, BMEdge::v2, and EDBMSplitElem::vert.

Referenced by EDBM_automerge_and_split().

◆ bm_vert_pair_best_face_get()

◆ bm_vert_pair_elem_setup_ex()

static void bm_vert_pair_elem_setup_ex ( BMVert * v,
EDBMSplitElem * r_pair_elem )
static

Definition at line 210 of file bmesh_intersect_edges.cc.

References v, and EDBMSplitElem::vert.

Referenced by bm_edgexvert_isect_impl(), and bm_vertxvert_isect_cb().

◆ bm_vert_pair_share_best_splittable_face_cb()

static bool bm_vert_pair_share_best_splittable_face_cb ( BMFace * f,
BMLoop * l_a,
BMLoop * l_b,
void * userdata )
static

◆ bm_vert_pair_share_splittable_face_cb()

static bool bm_vert_pair_share_splittable_face_cb ( BMFace * ,
BMLoop * l_a,
BMLoop * l_b,
void * userdata )
static

◆ bm_vertxvert_isect_cb()

static bool bm_vertxvert_isect_cb ( void * userdata,
int index_a,
int index_b,
int thread )
static

◆ bm_vertxvert_self_isect_cb()

static bool bm_vertxvert_self_isect_cb ( void * userdata,
int index_a,
int index_b,
int thread )
static

Definition at line 297 of file bmesh_intersect_edges.cc.

References bm_vertxvert_isect_cb().

Referenced by BM_mesh_intersect_edges().

◆ sort_cmp_by_lambda_cb()

static int sort_cmp_by_lambda_cb ( const void * index1_v,
const void * index2_v,
void * keys_v )
static

Definition at line 458 of file bmesh_intersect_edges.cc.

Referenced by BM_mesh_intersect_edges().