Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_kdopbvh.h"
#include "BLI_math.h"
#include "BKE_editmesh.h"
#include "BKE_editmesh_bvh.h"
Go to the source code of this file.
Classes | |
struct | BMBVHTree |
struct | RayCastUserData |
struct | RayCastUserData_Filter |
struct | VertSearchUserData |
struct | FaceSearchUserData |
struct | BMBVHTree_OverlapData |
Functions | |
BMBVHTree * | BKE_bmbvh_new_from_editmesh (BMEditMesh *em, int flag, const float(*cos_cage)[3], const bool cos_cage_free) |
BMBVHTree * | BKE_bmbvh_new_ex (BMesh *bm, BMLoop *(*looptris)[3], int looptris_tot, int flag, const float(*cos_cage)[3], const bool cos_cage_free, bool(*test_fn)(BMFace *, void *user_data), void *user_data) |
static bool | bm_face_is_select (BMFace *f, void *UNUSED(user_data)) |
static bool | bm_face_is_not_hidden (BMFace *f, void *UNUSED(user_data)) |
BMBVHTree * | BKE_bmbvh_new (BMesh *bm, BMLoop *(*looptris)[3], int looptris_tot, int flag, const float(*cos_cage)[3], const bool cos_cage_free) |
void | BKE_bmbvh_free (BMBVHTree *bmtree) |
BVHTree * | BKE_bmbvh_tree_get (BMBVHTree *bmtree) |
static void | bmbvh_tri_from_face (const float *cos[3], const BMLoop **ltri, const float(*cos_cage)[3]) |
static BMFace * | bmbvh_ray_cast_handle_hit (BMBVHTree *bmtree, struct RayCastUserData *bmcb_data, const BVHTreeRayHit *hit, float *r_dist, float r_hitout[3], float r_cagehit[3]) |
static void | bmbvh_ray_cast_cb (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) |
BMFace * | BKE_bmbvh_ray_cast (BMBVHTree *bmtree, const float co[3], const float dir[3], const float radius, float *r_dist, float r_hitout[3], float r_cagehit[3]) |
static void | bmbvh_ray_cast_cb_filter (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) |
BMFace * | BKE_bmbvh_ray_cast_filter (BMBVHTree *bmtree, const float co[3], const float dir[3], const float radius, float *r_dist, float r_hitout[3], float r_cagehit[3], BMBVHTree_FaceFilter filter_cb, void *filter_userdata) |
static void | bmbvh_find_vert_closest_cb (void *userdata, int index, const float co[3], BVHTreeNearest *hit) |
BMVert * | BKE_bmbvh_find_vert_closest (BMBVHTree *bmtree, const float co[3], const float dist_max) |
static void | bmbvh_find_face_closest_cb (void *userdata, int index, const float co[3], BVHTreeNearest *hit) |
struct BMFace * | BKE_bmbvh_find_face_closest (BMBVHTree *bmtree, const float co[3], const float dist_max) |
static bool | bmbvh_overlap_cb (void *userdata, int index_a, int index_b, int UNUSED(thread)) |
BVHTreeOverlap * | BKE_bmbvh_overlap (const BMBVHTree *bmtree_a, const BMBVHTree *bmtree_b, unsigned int *r_overlap_tot) |
static bool | bmbvh_overlap_self_cb (void *userdata, int index_a, int index_b, int thread) |
BVHTreeOverlap * | BKE_bmbvh_overlap_self (const BMBVHTree *bmtree, unsigned int *r_overlap_tot) |
struct BMFace* BKE_bmbvh_find_face_closest | ( | BMBVHTree * | bmtree, |
const float | co[3], | ||
const float | dist_max | ||
) |
Definition at line 484 of file editmesh_bvh.c.
References BLI_assert, BLI_bvhtree_find_nearest(), BMBVHTree::bm, BM_VERT, bmbvh_find_face_closest_cb(), BMBVHTree::cos_cage, FaceSearchUserData::cos_cage, FaceSearchUserData::dist_max_sq, BVHTreeNearest::dist_sq, BMesh::elem_index_dirty, BMLoop::f, float(), BVHTreeNearest::index, BMBVHTree::looptris, FaceSearchUserData::looptris, NULL, and BMBVHTree::tree.
Referenced by edbm_face_split_by_edges_exec().
Find a vert closest to co in a sphere of radius dist_max.
Definition at line 425 of file editmesh_bvh.c.
References BLI_assert, BLI_bvhtree_find_nearest(), BMBVHTree::bm, BM_VERT, bmbvh_find_vert_closest_cb(), BMBVHTree::cos_cage, VertSearchUserData::cos_cage, VertSearchUserData::dist_max_sq, BVHTreeNearest::dist_sq, BMesh::elem_index_dirty, float(), BVHTreeNearest::index, VertSearchUserData::index_tri, BMBVHTree::looptris, VertSearchUserData::looptris, NULL, BMBVHTree::tree, and BMLoop::v.
Definition at line 170 of file editmesh_bvh.c.
References BLI_bvhtree_free(), BMBVHTree::cos_cage, BMBVHTree::cos_cage_free, MEM_freeN, and BMBVHTree::tree.
Referenced by calcEdgeSlide_mval_range(), edbm_face_split_by_edges_exec(), blender::draw::statvis_calc_intersect(), and blender::draw::statvis_calc_thickness().
BMBVHTree* BKE_bmbvh_new | ( | BMesh * | bm, |
BMLoop *(*) | looptris[3], | ||
int | looptris_tot, | ||
int | flag, | ||
const float(*) | cos_cage[3], | ||
const bool | cos_cage_free | ||
) |
Definition at line 145 of file editmesh_bvh.c.
References BKE_bmbvh_new_ex(), bm, bm_face_is_not_hidden(), bm_face_is_select(), BMBVH_RESPECT_HIDDEN, BMBVH_RESPECT_SELECT, bool, NULL, and user_data.
Referenced by BKE_bmbvh_new_from_editmesh(), and edbm_face_split_by_edges_exec().
BMBVHTree* BKE_bmbvh_new_ex | ( | BMesh * | bm, |
BMLoop *(*) | looptris[3], | ||
int | looptris_tot, | ||
int | flag, | ||
const float(*) | cos_cage[3], | ||
const bool | cos_cage_free, | ||
bool(*)(BMFace *, void *user_data) | test_fn, | ||
void * | user_data | ||
) |
Definition at line 39 of file editmesh_bvh.c.
References BLI_assert, BLI_bvhtree_balance(), BLI_bvhtree_insert(), BLI_bvhtree_new(), BMBVHTree::bm, bm, BM_elem_index_get, BM_mesh_elem_index_ensure(), BM_VERT, BMBVH_RESPECT_HIDDEN, BMBVH_RESPECT_SELECT, BMVert::co, copy_v3_v3(), KDL::cos(), BMBVHTree::cos_cage, BMBVHTree::cos_cage_free, blender::robust_pred::epsilon, BMBVHTree::flag, BMBVHTree::looptris, BMBVHTree::looptris_tot, MEM_callocN, NULL, BMesh::totface, BMBVHTree::tree, user_data, and v.
Referenced by BKE_bmbvh_new().
BMBVHTree* BKE_bmbvh_new_from_editmesh | ( | BMEditMesh * | em, |
int | flag, | ||
const float(*) | cos_cage[3], | ||
const bool | cos_cage_free | ||
) |
Definition at line 31 of file editmesh_bvh.c.
References BKE_bmbvh_new(), BMEditMesh::bm, BMEditMesh::looptris, and BMEditMesh::tottri.
Referenced by calcEdgeSlide_mval_range(), blender::draw::statvis_calc_intersect(), and blender::draw::statvis_calc_thickness().
BVHTreeOverlap* BKE_bmbvh_overlap | ( | const BMBVHTree * | bmtree_a, |
const BMBVHTree * | bmtree_b, | ||
unsigned int * | r_overlap_tot | ||
) |
Overlap indices reference the looptri's.
Definition at line 552 of file editmesh_bvh.c.
References BLI_bvhtree_get_epsilon(), BLI_bvhtree_overlap(), bmbvh_overlap_cb(), data, max_ff(), and BMBVHTree::tree.
BVHTreeOverlap* BKE_bmbvh_overlap_self | ( | const BMBVHTree * | bmtree, |
unsigned int * | r_overlap_tot | ||
) |
Overlap indices reference the looptri's.
Definition at line 575 of file editmesh_bvh.c.
References BLI_bvhtree_get_epsilon(), BLI_bvhtree_overlap(), bmbvh_overlap_self_cb(), data, and BMBVHTree::tree.
Referenced by blender::draw::statvis_calc_intersect().
BMFace* BKE_bmbvh_ray_cast | ( | BMBVHTree * | bmtree, |
const float | co[3], | ||
const float | dir[3], | ||
const float | radius, | ||
float * | r_dist, | ||
float | r_hitout[3], | ||
float | r_cagehit[3] | ||
) |
Definition at line 290 of file editmesh_bvh.c.
References BLI_assert, BLI_bvhtree_ray_cast(), BMBVHTree::bm, BM_VERT, bmbvh_ray_cast_cb(), bmbvh_ray_cast_handle_hit(), BMBVHTree::cos_cage, RayCastUserData::cos_cage, BVHTreeRayHit::dist, BMesh::elem_index_dirty, float(), BVHTreeRayHit::index, BMBVHTree::looptris, RayCastUserData::looptris, NULL, and BMBVHTree::tree.
Referenced by edge_ray_cast(), and blender::draw::statvis_calc_thickness().
BMFace* BKE_bmbvh_ray_cast_filter | ( | BMBVHTree * | bmtree, |
const float | co[3], | ||
const float | dir[3], | ||
const float | radius, | ||
float * | r_dist, | ||
float | r_hitout[3], | ||
float | r_cagehit[3], | ||
BMBVHTree_FaceFilter | filter_cb, | ||
void * | filter_userdata | ||
) |
Definition at line 348 of file editmesh_bvh.c.
References BLI_assert, BLI_bvhtree_ray_cast(), BMBVHTree::bm, BM_VERT, bmbvh_ray_cast_cb_filter(), bmbvh_ray_cast_handle_hit(), RayCastUserData_Filter::bmcb_data, BMBVHTree::cos_cage, RayCastUserData::cos_cage, BVHTreeRayHit::dist, BMesh::elem_index_dirty, RayCastUserData_Filter::filter_cb, RayCastUserData_Filter::filter_userdata, float(), BVHTreeRayHit::index, BMBVHTree::looptris, RayCastUserData::looptris, NULL, and BMBVHTree::tree.
Definition at line 181 of file editmesh_bvh.c.
References BMBVHTree::tree.
Definition at line 140 of file editmesh_bvh.c.
References BM_elem_flag_test, and BM_ELEM_HIDDEN.
Referenced by BKE_bmbvh_new().
Definition at line 135 of file editmesh_bvh.c.
References BM_elem_flag_test, and BM_ELEM_SELECT.
Referenced by BKE_bmbvh_new().
|
static |
Definition at line 460 of file editmesh_bvh.c.
References bmbvh_tri_from_face(), closest_on_tri_to_point_v3(), copy_v3_v3(), FaceSearchUserData::cos_cage, FaceSearchUserData::dist_max_sq, BVHTreeNearest::dist_sq, BMLoop::f, BVHTreeNearest::index, len_squared_v3v3(), FaceSearchUserData::looptris, BVHTreeNearest::no, BMFace::no, and UNPACK3.
Referenced by BKE_bmbvh_find_face_closest().
|
static |
Definition at line 400 of file editmesh_bvh.c.
References bmbvh_tri_from_face(), BVHTreeNearest::co, copy_v3_v3(), VertSearchUserData::cos_cage, VertSearchUserData::dist_max_sq, BVHTreeNearest::dist_sq, BVHTreeNearest::index, VertSearchUserData::index_tri, len_squared_v3v3(), VertSearchUserData::looptris, BVHTreeNearest::no, BMVert::no, and BMLoop::v.
Referenced by BKE_bmbvh_find_vert_closest().
Definition at line 520 of file editmesh_bvh.c.
References BMVert::co, data, ELEM, isect_tri_tri_v3(), len_squared_v3v3(), BMBVHTree::looptris, UNLIKELY, UNPACK3, and BMLoop::v.
Referenced by BKE_bmbvh_overlap(), and bmbvh_overlap_self_cb().
Definition at line 567 of file editmesh_bvh.c.
References bmbvh_overlap_cb().
Referenced by BKE_bmbvh_overlap_self().
|
static |
Definition at line 250 of file editmesh_bvh.c.
References bmbvh_tri_from_face(), BVHTreeRayHit::co, copy_v2_v2(), copy_v3_v3(), RayCastUserData::cos_cage, BVHTreeRay::direction, BVHTreeRayHit::dist, BMLoop::f, BVHTreeRayHit::index, BVHTreeRay::isect_precalc, isect_ray_tri_epsilon_v3(), isect_ray_tri_v3(), isect_ray_tri_watertight_v3(), RayCastUserData::looptris, madd_v3_v3v3fl(), BVHTreeRayHit::no, BMFace::no, BVHTreeRay::origin, BVHTreeRay::radius, and RayCastUserData::uv.
Referenced by BKE_bmbvh_ray_cast(), and bmbvh_ray_cast_cb_filter().
|
static |
Definition at line 335 of file editmesh_bvh.c.
References bmbvh_ray_cast_cb(), RayCastUserData_Filter::bmcb_data, BMLoop::f, RayCastUserData_Filter::filter_cb, RayCastUserData_Filter::filter_userdata, and RayCastUserData::looptris.
Referenced by BKE_bmbvh_ray_cast_filter().
|
static |
Definition at line 222 of file editmesh_bvh.c.
References BMBVH_RETURN_ORIG, BVHTreeRayHit::co, BMVert::co, copy_v3_v3(), BVHTreeRayHit::dist, BMLoop::f, BMBVHTree::flag, BVHTreeRayHit::index, interp_v3_v3v3v3_uv(), BMBVHTree::looptris, RayCastUserData::uv, BMLoop::v, and v.
Referenced by BKE_bmbvh_ray_cast(), and BKE_bmbvh_ray_cast_filter().
|
static |
Return the coords from a triangle.
Definition at line 192 of file editmesh_bvh.c.
References BM_elem_index_get, BMVert::co, KDL::cos(), NULL, BMLoop::v, and v.
Referenced by bmbvh_find_face_closest_cb(), bmbvh_find_vert_closest_cb(), and bmbvh_ray_cast_cb().