Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BLI_sort_utils.h"
#include "BLI_utildefines.h"
#include "BLI_linklist_stack.h"
#include "BLI_utildefines_stack.h"
#include "BLI_buffer.h"
#include "BLI_kdopbvh.h"
#include "bmesh.h"
#include "intern/bmesh_private.h"
#include "bmesh_intersect.h"
#include "tools/bmesh_edgesplit.h"
#include "BLI_strict_flags.h"
Go to the source code of this file.
Classes | |
struct | ISectEpsilon |
struct | ISectState |
struct | LinkBase |
struct | vert_sort_t |
struct | LoopFilterWrap |
struct | RaycastData |
Macros | |
#define | USE_SPLICE |
#define | USE_NET |
#define | USE_SEPARATE |
#define | USE_DISSOLVE |
#define | USE_NET_ISLAND_CONNECT |
#define | USE_BVH |
#define | KEY_SET(k, i0, i1, i2, i3) |
#define | KEY_EDGE_TRI_ORDER(k) |
#define | VERT_VISIT_A _FLAG_WALK |
#define | VERT_VISIT_B _FLAG_WALK_ALT |
#define | STACK_PUSH_TEST_A(ele) |
#define | STACK_PUSH_TEST_B(ele) |
Enumerations | |
enum | ISectType { IX_NONE = -1 , IX_EDGE_TRI_EDGE0 , IX_EDGE_TRI_EDGE1 , IX_EDGE_TRI_EDGE2 , IX_EDGE_TRI , IX_TOT } |
Functions | |
static void | tri_v3_scale (float v1[3], float v2[3], float v3[3], const float t) |
static BMEdge * | bm_vert_other_edge (BMVert *v, BMEdge *e) |
static bool | ghash_insert_link (GHash *gh, void *key, void *val, bool use_test, MemArena *mem_arena) |
static void | edge_verts_sort (const float co[3], struct LinkBase *v_ls_base) |
static void | edge_verts_add (struct ISectState *s, BMEdge *e, BMVert *v, const bool use_test) |
static void | face_edges_add (struct ISectState *s, const int f_index, BMEdge *e, const bool use_test) |
static void | face_edges_split (BMesh *bm, BMFace *f, struct LinkBase *e_ls_base, bool use_island_connect, bool use_partial_connect, MemArena *mem_arena_edgenet) |
static void | vert_dissolve_add (struct ISectState *s, BMVert *v) |
static enum ISectType | intersect_line_tri (const float p0[3], const float p1[3], const float *t_cos[3], const float t_nor[3], float r_ix[3], const struct ISectEpsilon *e) |
static BMVert * | bm_isect_edge_tri (struct ISectState *s, BMVert *e_v0, BMVert *e_v1, BMVert *t[3], const int t_index, const float *t_cos[3], const float t_nor[3], enum ISectType *r_side) |
static bool | bm_loop_filter_fn (const BMLoop *l, void *user_data) |
static void | bm_isect_tri_tri (struct ISectState *s, int a_index, int b_index, BMLoop **a, BMLoop **b, bool no_shared) |
static void | raycast_callback (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *UNUSED(hit)) |
static int | isect_bvhtree_point_v3 (BVHTree *tree, const float **looptris, const float co[3]) |
bool | BM_mesh_intersect (BMesh *bm, struct BMLoop *(*looptris)[3], const int looptris_tot, int(*test_fn)(BMFace *f, void *user_data), void *user_data, const bool use_self, const bool use_separate, const bool use_dissolve, const bool use_island_connect, const bool use_partial_connect, const bool use_edge_tag, const int boolean_mode, const float eps) |
Cut meshes along intersections.
Boolean-like modeling operation (without calculating inside/outside).
Supported:
Unsupported:
Definition in file bmesh_intersect.c.
#define KEY_EDGE_TRI_ORDER | ( | k | ) |
#define STACK_PUSH_TEST_A | ( | ele | ) |
#define STACK_PUSH_TEST_B | ( | ele | ) |
#define USE_BVH |
Definition at line 63 of file bmesh_intersect.c.
#define USE_DISSOLVE |
Definition at line 56 of file bmesh_intersect.c.
#define USE_NET |
Definition at line 52 of file bmesh_intersect.c.
#define USE_NET_ISLAND_CONNECT |
Definition at line 58 of file bmesh_intersect.c.
#define USE_SEPARATE |
Definition at line 54 of file bmesh_intersect.c.
#define USE_SPLICE |
Definition at line 50 of file bmesh_intersect.c.
#define VERT_VISIT_A _FLAG_WALK |
#define VERT_VISIT_B _FLAG_WALK_ALT |
enum ISectType |
Enumerator | |
---|---|
IX_NONE | |
IX_EDGE_TRI_EDGE0 | |
IX_EDGE_TRI_EDGE1 | |
IX_EDGE_TRI_EDGE2 | |
IX_EDGE_TRI | |
IX_TOT |
Definition at line 92 of file bmesh_intersect.c.
|
static |
Definition at line 331 of file bmesh_intersect.c.
References ARRAY_SIZE, BLI_assert, BLI_ghash_insert(), BLI_ghash_lookup(), BLI_memarena_alloc(), bm, ISectState::bm, BM_edge_exists(), BM_elem_index_get, BM_vert_create(), BMVert::co, e, edge_verts_add(), ISectState::edgetri_cache, ISectEpsilon::eps_sq, ISectState::epsilon, intersect_line_tri(), IX_EDGE_TRI, IX_EDGE_TRI_EDGE0, IX_EDGE_TRI_EDGE1, IX_EDGE_TRI_EDGE2, IX_NONE, IX_TOT, KEY_EDGE_TRI_ORDER, KEY_SET, len_squared_v3v3(), ISectState::mem_arena, NULL, SWAP, t, UNPACK3, UNPACK3_EX, UNPACK4, and vert_dissolve_add().
Referenced by bm_isect_tri_tri().
|
static |
Return true if we have any intersections.
Definition at line 495 of file bmesh_intersect.c.
References Freestyle::a, ARRAY_SIZE, usdtokens::b(), BLI_gset_add(), BLI_gset_insert(), ISectState::bm, BM_edge_create(), BM_edge_exists(), BM_edge_in_face(), BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_TEST, BM_elem_index_get, BM_face_share_edge_check(), bm_isect_edge_tri(), copy_v3_v3(), e, edge_verts_add(), ELEM, ISectEpsilon::eps, ISectEpsilon::eps2x, ISectEpsilon::eps2x_sq, blender::robust_pred::epsilon, ISectState::epsilon, face_edges_add(), interp_v3_v3v3(), isect_point_tri_v3(), len_squared_v3v3(), line_point_factor_v3(), normal_tri_v3(), NULL, STACK_DECLARE, STACK_INIT, STACK_PUSH_TEST_A, STACK_PUSH_TEST_B, STACK_SIZE, tri_v3_scale(), UNLIKELY, UNPACK2, UNPACK3, UNPACK3_EX, v, VERT_VISIT_A, VERT_VISIT_B, and ISectState::wire_edges.
Referenced by BM_mesh_intersect().
Definition at line 468 of file bmesh_intersect.c.
References BM_elem_flag_test, BM_ELEM_TAG, data, BMLoop::e, BMLoop::f, l, BMLoop::radial_next, UNLIKELY, and user_data.
Referenced by BM_mesh_intersect().
bool BM_mesh_intersect | ( | BMesh * | bm, |
struct BMLoop *(*) | looptris[3], | ||
int | looptris_tot, | ||
int(*)(BMFace *f, void *user_data) | test_fn, | ||
void * | user_data, | ||
bool | use_self, | ||
bool | use_separate, | ||
bool | use_dissolve, | ||
bool | use_island_connect, | ||
bool | use_partial_connect, | ||
bool | use_edge_tag, | ||
int | boolean_mode, | ||
float | eps | ||
) |
Intersect tessellated faces leaving the resulting edges tagged.
test_fn | Return value: -1: skip, 0: tree_a, 1: tree_b (use_self == false) |
boolean_mode | -1: no-boolean, 0: intersection... see BMESH_ISECT_BOOLEAN_ISECT. |
Definition at line 936 of file bmesh_intersect.c.
References BLI_assert, BLI_bvhtree_balance(), BLI_bvhtree_free(), BLI_bvhtree_insert(), BLI_bvhtree_new(), BLI_bvhtree_overlap_ex(), BLI_ghash_free(), BLI_ghash_int_new(), BLI_ghash_len(), BLI_ghash_new(), BLI_ghash_ptr_new(), BLI_ghashIterator_getKey(), BLI_ghashIterator_getValue(), BLI_ghashutil_inthash_v4_cmp, BLI_ghashutil_inthash_v4_p, BLI_gset_add(), BLI_gset_free(), BLI_gset_haskey(), BLI_gset_insert(), BLI_gset_len(), BLI_gset_ptr_new(), BLI_gset_remove(), BLI_gsetIterator_getKey(), BLI_memarena_clear(), BLI_memarena_free(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, bm, ISectState::bm, BM_DISK_EDGE_NEXT, BM_EDGE, BM_edge_exists(), BM_edge_kill(), BM_edge_other_vert(), BM_edge_split(), BM_EDGES_OF_MESH, BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_elem_index_get, BM_ELEM_TAG, BM_FACE, BM_face_calc_point_in_face(), BM_face_kill_loose(), BM_face_normal_flip(), bm_isect_tri_tri(), BM_ITER_MESH_MUTABLE, bm_loop_filter_fn(), BM_mesh_calc_face_groups(), BM_mesh_edgesplit(), BM_mesh_elem_hflag_disable_all(), BM_mesh_elem_index_ensure(), BM_mesh_elem_table_ensure(), BM_select_history_clear(), BM_VERT, BM_vert_collapse_edge(), BM_vert_in_edge(), BM_vert_is_edge_pair(), BM_vert_kill(), bm_vert_other_edge(), BM_vert_pair_share_face_check(), BM_vert_splice(), BM_vert_splice_check_double(), BMESH_ISECT_BOOLEAN_DIFFERENCE, BMESH_ISECT_BOOLEAN_ISECT, BMESH_ISECT_BOOLEAN_NONE, BMESH_ISECT_BOOLEAN_UNION, BVH_OVERLAP_RETURN_PAIRS, BVH_OVERLAP_USE_THREADING, clamp_f(), BMVert::co, copy_v3_v3(), KDL::cos(), BMVert::e, e, ISectState::edge_verts, edge_verts_sort(), ISectState::edgetri_cache, ELEM, eps, ISectEpsilon::eps, ISectEpsilon::eps2x, ISectEpsilon::eps2x_sq, ISectEpsilon::eps_margin, ISectEpsilon::eps_margin_sq, ISectEpsilon::eps_sq, ISectState::epsilon, BMLoop::f, ISectState::face_edges, face_edges_split(), faces, BMesh::ftable, GHASH_ITER, GSET_ITER, isect_bvhtree_point_v3(), BMEdge::l, BMFace::len, len_squared_v3v3(), line_point_factor_v3(), LinkBase::list, LinkBase::list_len, BMFace::mat_nr, ISectState::mem_arena, MEM_freeN, MEM_mallocN, node, NULL, POINTER_AS_INT, BMLoop::radial_next, STACK_DECLARE, STACK_INIT, STACK_PUSH_RET, STACK_SIZE, SWAP, LoopFilterWrap::test_fn, BMesh::totface, UNLIKELY, UNPACK2, UNPACK3, UNUSED_VARS, UNUSED_VARS_NDEBUG, USE_NET, USE_SPLICE, user_data, v, ISectState::vert_dissolve, void, and ISectState::wire_edges.
Referenced by BMD_mesh_intersection(), edbm_intersect_boolean_exec(), and edbm_intersect_exec().
Definition at line 80 of file bmesh_intersect.c.
References BLI_assert, BM_DISK_EDGE_NEXT, BM_vert_in_edge(), BM_vert_is_edge_pair(), BMVert::e, e, and v.
Referenced by BM_mesh_intersect().
|
static |
Definition at line 186 of file bmesh_intersect.c.
References BLI_assert, BM_EDGE, BM_VERT, e, ISectState::edge_verts, ghash_insert_link(), BMVert::head, BMHeader::htype, ISectState::mem_arena, and v.
Referenced by bm_isect_edge_tri(), and bm_isect_tri_tri().
Definition at line 162 of file bmesh_intersect.c.
References BLI_array_alloca, BLI_assert, BLI_sortutil_cmp_float(), BM_VERT, BMVert::co, BMVert::head, BMHeader::htype, len_squared_v3v3(), LinkBase::list, LinkBase::list_len, node, v, vert_sort_t::v, and vert_sort_t::val.
Referenced by BM_mesh_intersect().
|
static |
Definition at line 193 of file bmesh_intersect.c.
References BLI_assert, ISectState::bm, BM_EDGE, BM_edge_in_face(), BM_elem_index_get, e, ISectState::face_edges, BMesh::ftable, ghash_insert_link(), BMVert::head, BMHeader::htype, ISectState::mem_arena, and POINTER_FROM_INT.
Referenced by bm_isect_tri_tri().
|
static |
Definition at line 204 of file bmesh_intersect.c.
References BLI_array_alloca, BLI_assert, bm, BM_elem_index_get, BM_FACE, BM_face_split_edgenet(), BM_face_split_edgenet_connect_islands(), BMFace::head, BMHeader::htype, LinkBase::list, LinkBase::list_len, node, NULL, and UNUSED_VARS.
Referenced by BM_mesh_intersect().
|
static |
Definition at line 129 of file bmesh_intersect.c.
References BLI_ghash_ensure_p(), BLI_linklist_index(), BLI_memarena_alloc(), LinkNode::link, LinkBase::list, LinkBase::list_len, mem_arena, LinkNode::next, and NULL.
Referenced by edge_verts_add(), and face_edges_add().
|
static |
Definition at line 251 of file bmesh_intersect.c.
References BLI_assert, BLI_linklist_index(), BLI_linklist_prepend_arena(), BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_TAG, BM_VERT, BMVert::head, BMHeader::htype, ISectState::mem_arena, v, and ISectState::vert_dissolve.
Referenced by bm_isect_edge_tri().
|
static |
Definition at line 878 of file bmesh_intersect.c.
References BLI_buffer_declare_static, BLI_buffer_free, BLI_BUFFER_NOP, BLI_bvhtree_ray_cast(), BLI_sortutil_cmp_float(), BVH_RAYCAST_DIST_MAX, BLI_Buffer::count, BLI_Buffer::data, BVHTreeRayHit::dist, eps, BVHTreeRayHit::index, RaycastData::looptris, raycast_callback(), tree, and RaycastData::z_buffer.
Referenced by BM_mesh_intersect().
|
static |
Definition at line 840 of file bmesh_intersect.c.
References BLI_buffer_append, isect_ray_tri_epsilon_v3(), isect_ray_tri_watertight_v3(), RaycastData::looptris, NULL, print_v3(), RaycastData::ray, USE_KDOPBVH_WATERTIGHT, v1, v2, and RaycastData::z_buffer.
Referenced by cast_ray_highpoly(), and isect_bvhtree_point_v3().
Definition at line 67 of file bmesh_intersect.c.
References interp_v3_v3v3(), mid_v3_v3v3v3(), t, v1, and v2.
Referenced by bm_isect_tri_tri().
|
static |
Definition at line 251 of file bmesh_intersect.c.
Referenced by bm_isect_edge_tri().