Blender  V2.93
BKE_editmesh_bvh.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 struct BMBVHTree;
31 struct BMEditMesh;
32 struct BMFace;
33 struct BMLoop;
34 struct BMVert;
35 struct BMesh;
36 struct BVHTree;
37 
38 typedef struct BMBVHTree BMBVHTree;
39 
40 typedef bool (*BMBVHTree_FaceFilter)(struct BMFace *f, void *userdata);
41 
43  int flag,
44  const float (*cos_cage)[3],
45  const bool cos_cage_free);
47  struct BMLoop *(*looptris)[3],
48  int looptris_tot,
49  int flag,
50  const float (*cos_cage)[3],
51  const bool cos_cage_free,
52  bool (*test_fn)(struct BMFace *, void *user_data),
53  void *user_data);
55  struct BMLoop *(*looptris)[3],
56  int looptris_tot,
57  int flag,
58  const float (*cos_cage)[3],
59  const bool cos_cage_free);
62 
64  const float co[3],
65  const float dir[3],
66  const float radius,
67  float *r_dist,
68  float r_hitout[3],
69  float r_cagehit[3]);
70 
72  const float co[3],
73  const float dir[3],
74  const float radius,
75  float *r_dist,
76  float r_hitout[3],
77  float r_cagehit[3],
78  BMBVHTree_FaceFilter filter_cb,
79  void *filter_userdata);
80 
81 /* find a vert closest to co in a sphere of radius dist_max */
83  const float co[3],
84  const float dist_max);
86  const float co[3],
87  const float dist_max);
88 
89 struct BVHTreeOverlap *BKE_bmbvh_overlap(const BMBVHTree *bmtree_a,
90  const BMBVHTree *bmtree_b,
91  unsigned int *r_overlap_tot);
92 
93 struct BVHTreeOverlap *BKE_bmbvh_overlap_self(const BMBVHTree *bmtree,
94  unsigned int *r_overlap_tot);
95 
97 enum {
99  BMBVH_RETURN_ORIG = (1 << 0),
104 };
105 
106 #ifdef __cplusplus
107 }
108 #endif
bool(* BMBVHTree_FaceFilter)(struct BMFace *f, void *userdata)
struct BVHTreeOverlap * BKE_bmbvh_overlap(const BMBVHTree *bmtree_a, const BMBVHTree *bmtree_b, unsigned int *r_overlap_tot)
Definition: editmesh_bvh.c:571
BMBVHTree * BKE_bmbvh_new(struct BMesh *bm, struct BMLoop *(*looptris)[3], int looptris_tot, int flag, const float(*cos_cage)[3], const bool cos_cage_free)
Definition: editmesh_bvh.c:161
struct BMVert * BKE_bmbvh_find_vert_closest(BMBVHTree *tree, const float co[3], const float dist_max)
Definition: editmesh_bvh.c:441
@ BMBVH_RETURN_ORIG
@ BMBVH_RESPECT_HIDDEN
@ BMBVH_RESPECT_SELECT
struct BMFace * BKE_bmbvh_ray_cast(BMBVHTree *tree, const float co[3], const float dir[3], const float radius, float *r_dist, float r_hitout[3], float r_cagehit[3])
Definition: editmesh_bvh.c:306
BMBVHTree * BKE_bmbvh_new_ex(struct BMesh *bm, struct BMLoop *(*looptris)[3], int looptris_tot, int flag, const float(*cos_cage)[3], const bool cos_cage_free, bool(*test_fn)(struct BMFace *, void *user_data), void *user_data)
struct BVHTree * BKE_bmbvh_tree_get(BMBVHTree *tree)
Definition: editmesh_bvh.c:197
struct BMFace * BKE_bmbvh_ray_cast_filter(BMBVHTree *tree, 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: editmesh_bvh.c:364
struct BMFace * BKE_bmbvh_find_face_closest(BMBVHTree *tree, const float co[3], const float dist_max)
Definition: editmesh_bvh.c:500
void BKE_bmbvh_free(BMBVHTree *tree)
Definition: editmesh_bvh.c:186
BMBVHTree * BKE_bmbvh_new_from_editmesh(struct BMEditMesh *em, int flag, const float(*cos_cage)[3], const bool cos_cage_free)
Definition: editmesh_bvh.c:47
struct BVHTreeOverlap * BKE_bmbvh_overlap_self(const BMBVHTree *bmtree, unsigned int *r_overlap_tot)
Definition: editmesh_bvh.c:597
ATTR_WARN_UNUSED_RESULT BMesh * bm
void * user_data
void * tree
float co[3]
Definition: bmesh_class.h:99