33#ifndef MATH_STANDALONE
56#define PYBVH_FIND_GENERIC_DISTANCE_DOC \
57 " :arg distance: Maximum distance threshold.\n" \
58 " :type distance: float\n"
60#define PYBVH_FIND_GENERIC_RETURN_DOC \
61 " :return: Returns a tuple: (position, normal, index, distance),\n" \
62 " Values will all be None if no hit is found.\n" \
63 " :rtype: tuple[:class:`Vector` | None, :class:`Vector` | None, int | None, float | None]\n"
65#define PYBVH_FIND_GENERIC_RETURN_LIST_DOC \
66 " :return: Returns a list of tuples (position, normal, index, distance)\n" \
67 " :rtype: list[tuple[:class:`Vector`, :class:`Vector`, int, float]]\n"
69#define PYBVH_FROM_GENERIC_EPSILON_DOC \
70 " :arg epsilon: Increase the threshold for detecting overlap and raycast hits.\n" \
71 " :type epsilon: float\n"
76#define PYBVH_MAX_DIST_STR "1.84467e+19"
112 float (*orig_normal)[3])
117 result->epsilon = epsilon;
121 result->coords_len = coords_len;
122 result->tris_len = tris_len;
124 result->orig_index = orig_index;
125 result->orig_normal = orig_normal;
127 return (PyObject *)
result;
144 PyLong_FromLong(hit->
index),
145 PyFloat_FromDouble(hit->
dist));
150 PyObject *py_retval = PyTuple_New(4);
159 PyObject *py_retval = PyTuple_New(4);
167static PyObject *py_bvhtree_raycast_to_py_and_check(
const BVHTreeRayHit *hit)
171 py_retval = PyTuple_New(4);
173 if (hit->
index != -1) {
198 PyLong_FromLong(nearest->
index),
204 PyObject *py_retval = PyTuple_New(4);
213 PyObject *py_retval = PyTuple_New(4);
221static PyObject *py_bvhtree_nearest_to_py_and_check(
const BVHTreeNearest *nearest)
225 py_retval = PyTuple_New(4);
227 if (nearest->
index != -1) {
252 Py_TYPE(
self)->tp_free((PyObject *)
self);
267 const uint *tri =
self->tris[index];
268 const float *tri_co[3] = {coords[tri[0]], coords[tri[1]], coords[tri[2]]};
271 if (
self->epsilon == 0.0f) {
279 if (dist >= 0 && dist < hit->dist) {
280 hit->
index =
self->orig_index ?
self->orig_index[index] : index;
283 if (
self->orig_normal) {
300 const uint *tri =
self->tris[index];
301 const float *tri_co[3] = {coords[tri[0]], coords[tri[1]], coords[tri[2]]};
302 float nearest_tmp[3], dist_sq;
307 if (dist_sq < nearest->dist_sq) {
308 nearest->
index =
self->orig_index ?
self->orig_index[index] : index;
311 if (
self->orig_normal) {
322 py_bvhtree_ray_cast_doc,
323 ".. method:: ray_cast(origin, direction, distance=sys.float_info.max, /)\n"
325 " Cast a ray onto the mesh.\n"
327 " :arg origin: Start location of the ray in object space.\n"
328 " :type origin: :class:`Vector`\n"
329 " :arg direction: Direction of the ray in object space.\n"
334 const char *error_prefix =
"ray_cast";
335 float co[3], direction[3];
341 PyObject *py_co, *py_direction;
343 if (!PyArg_ParseTuple(args,
"OO|f:ray_cast", &py_co, &py_direction, &max_dist)) {
373 py_bvhtree_find_nearest_doc,
377 " Find the nearest element (typically face index) to a point.\n"
379 " :arg co: Find nearest element to this point.\n"
384 const char *error_prefix =
"find_nearest";
394 if (!PyArg_ParseTuple(args,
"O|f:find_nearest", &py_co, &max_dist)) {
404 nearest.
dist_sq = max_dist * max_dist;
433 const uint *tri =
self->tris[index];
434 const float *tri_co[3] = {coords[tri[0]], coords[tri[1]], coords[tri[2]]};
435 float nearest_tmp[3], dist_sq;
440 if (dist_sq < data->dist_sq) {
442 nearest.
index =
self->orig_index ?
self->orig_index[index] : index;
445 if (
self->orig_normal) {
458 py_bvhtree_find_nearest_range_doc,
462 " Find the nearest elements (typically face index) to a point in the distance range.\n"
464 " :arg co: Find nearest elements to this point.\n"
469 const char *error_prefix =
"find_nearest_range";
477 if (!PyArg_ParseTuple(args,
"O|f:find_nearest_range", &py_co, &max_dist)) {
486 PyObject *
ret = PyList_New(0);
510 return (memcmp(a,
b,
sizeof(*a)) != 0);
523 const uint *tri_a = tree_a->
tris[index_a];
524 const uint *tri_b = tree_b->
tris[index_b];
525 const float *tri_a_co[3] = {
527 const float *tri_b_co[3] = {
530 int verts_shared = 0;
532 if (tree_a == tree_b) {
541 if (verts_shared >= 2) {
552 py_bvhtree_overlap_doc,
553 ".. method:: overlap(other_tree, /)\n"
555 " Find overlapping indices between 2 trees.\n"
557 " :arg other_tree: Other tree to perform overlap test on.\n"
558 " :type other_tree: :class:`BVHTree`\n"
559 " :return: Returns a list of unique index pairs,"
560 " the first index referencing this tree, the second referencing the **other_tree**.\n"
561 " :rtype: list[tuple[int, int]]\n");
566 uint overlap_len = 0;
570 PyErr_SetString(PyExc_ValueError,
"Expected a BVHTree argument");
575 data.tree_pair[1] = other;
583 if (overlap ==
nullptr) {
588 GSet *pair_test = use_unique ?
594 for (
i = 0;
i < overlap_len;
i++) {
597 if (
self->orig_index) {
610 item = PyTuple_New(2);
612 item, PyLong_FromLong(overlap[
i].indexA), PyLong_FromLong(overlap[
i].indexB));
614 PyList_Append(
ret, item);
638 C_BVHTree_FromPolygons_doc,
639 ".. classmethod:: FromPolygons(vertices, polygons, *, all_triangles=False, epsilon=0.0)\n"
641 " BVH tree constructed geometry passed in as arguments.\n"
643 " :arg vertices: float triplets each representing ``(x, y, z)``\n"
644 " :type vertices: Sequence[Sequence[float]]\n"
645 " :arg polygons: Sequence of polygons, each containing indices to the vertices argument.\n"
646 " :type polygons: Sequence[Sequence[int]]\n"
647 " :arg all_triangles: Use when all **polygons** are triangles for more efficient "
652 const char *error_prefix =
"BVHTree.FromPolygons";
653 const char *keywords[] = {
"vertices",
"polygons",
"all_triangles",
"epsilon",
nullptr};
655 PyObject *py_coords, *py_tris;
656 PyObject *py_coords_fast =
nullptr, *py_tris_fast =
nullptr;
661 float (*coords)[3] =
nullptr;
662 uint(*tris)[3] =
nullptr;
663 uint coords_len, tris_len;
664 float epsilon = 0.0f;
665 bool all_triangles =
false;
668 int *orig_index =
nullptr;
669 float (*orig_normal)[3] =
nullptr;
674 if (!PyArg_ParseTupleAndKeywords(args,
676 "OO|$O&f:BVHTree.FromPolygons",
687 if (!(py_coords_fast = PySequence_Fast(py_coords, error_prefix)) ||
688 !(py_tris_fast = PySequence_Fast(py_tris, error_prefix)))
690 Py_XDECREF(py_coords_fast);
695 PyObject **py_coords_fast_items = PySequence_Fast_ITEMS(py_coords_fast);
696 coords_len =
uint(PySequence_Fast_GET_SIZE(py_coords_fast));
699 for (
i = 0;
i < coords_len;
i++) {
700 PyObject *py_vert = py_coords_fast_items[
i];
709 if (valid ==
false) {
712 else if (all_triangles) {
714 PyObject **py_tris_fast_items = PySequence_Fast_ITEMS(py_tris_fast);
715 tris_len =
uint(PySequence_Fast_GET_SIZE(py_tris_fast));
718 for (
i = 0;
i < tris_len;
i++) {
719 PyObject *py_tricoords = py_tris_fast_items[
i];
720 PyObject *py_tricoords_fast;
721 PyObject **py_tricoords_fast_items;
725 if (!(py_tricoords_fast = PySequence_Fast(py_tricoords, error_prefix))) {
730 if (PySequence_Fast_GET_SIZE(py_tricoords_fast) != 3) {
732 PyErr_Format(PyExc_ValueError,
733 "%s: non triangle found at index %d with length of %d",
736 PySequence_Fast_GET_SIZE(py_tricoords_fast));
741 py_tricoords_fast_items = PySequence_Fast_ITEMS(py_tricoords_fast);
743 for (j = 0; j < 3; j++) {
746 PyErr_Format(PyExc_ValueError,
747 "%s: index %d must be less than %d",
763 const uint polys_len =
uint(PySequence_Fast_GET_SIZE(py_tris_fast));
768 } *plink_first =
nullptr, **p_plink_prev = &plink_first, *plink =
nullptr;
775 for (
i = 0;
i < polys_len;
i++) {
776 PyObject *py_tricoords = PySequence_Fast_GET_ITEM(py_tris_fast,
i);
777 PyObject *py_tricoords_fast;
778 PyObject **py_tricoords_fast_items;
779 uint py_tricoords_len;
782 if (!(py_tricoords_fast = PySequence_Fast(py_tricoords, error_prefix))) {
787 py_tricoords_len =
uint(PySequence_Fast_GET_SIZE(py_tricoords_fast));
788 py_tricoords_fast_items = PySequence_Fast_ITEMS(py_tricoords_fast);
791 poly_arena,
sizeof(*plink) + (
sizeof(
int) *
size_t(py_tricoords_len))));
793 plink->len = py_tricoords_len;
794 *p_plink_prev = plink;
795 p_plink_prev = &plink->next;
797 for (j = 0; j < py_tricoords_len; j++) {
800 PyErr_Format(PyExc_ValueError,
801 "%s: index %d must be less than %d",
813 if (py_tricoords_len >= 3) {
814 tris_len += (py_tricoords_len - 2);
817 *p_plink_prev =
nullptr;
827 for (plink = plink_first, poly_index = 0,
i = 0; plink; plink = plink->next, poly_index++) {
828 if (plink->len == 3) {
830 memcpy(tri, plink->poly,
sizeof(
uint[3]));
831 orig_index[
i] = poly_index;
832 normal_tri_v3(orig_normal[poly_index], coords[tri[0]], coords[tri[1]], coords[tri[2]]);
835 else if (plink->len > 3) {
836 float (*proj_coords)[2] =
static_cast<float (*)[2]
>(
838 float *normal = orig_normal[poly_index];
839 const float *co_prev;
840 const float *co_curr;
841 float axis_mat[3][3];
842 uint(*tris_offset)[3] = &tris[
i];
847 co_prev = coords[plink->poly[plink->len - 1]];
848 for (j = 0; j < plink->len; j++) {
849 co_curr = coords[plink->poly[j]];
857 for (j = 0; j < plink->len; j++) {
858 mul_v2_m3v3(proj_coords[j], axis_mat, coords[plink->poly[j]]);
865 uint *tri = tris_offset[j];
867 tri[0] = plink->poly[tri[0]];
868 tri[1] = plink->poly[tri[1]];
869 tri[2] = plink->poly[tri[2]];
871 orig_index[
i] = poly_index;
878 zero_v3(orig_normal[poly_index]);
899 for (
i = 0;
i < tris_len;
i++) {
913 tree, epsilon, coords, coords_len, tris, tris_len, orig_index, orig_normal);
926#ifndef MATH_STANDALONE
930 C_BVHTree_FromBMesh_doc,
931 ".. classmethod:: FromBMesh(bmesh, *, epsilon=0.0)\n"
933 " BVH tree based on :class:`BMesh` data.\n"
935 " :arg bmesh: BMesh data.\n"
939 const char *keywords[] = {
"bmesh",
"epsilon",
nullptr};
943 float (*coords)[3] =
nullptr;
944 uint(*tris)[3] =
nullptr;
945 uint coords_len, tris_len;
946 float epsilon = 0.0f;
950 if (!PyArg_ParseTupleAndKeywords(args,
952 "O!|$f:BVHTree.FromBMesh",
965 coords_len =
uint(
bm->totvert);
979 int *orig_index =
nullptr;
980 float (*orig_normal)[3] =
nullptr;
1000 for (
i = 0;
i < tris_len;
i++) {
1019 tree, epsilon, coords, coords_len, tris, tris_len, orig_index, orig_normal);
1028 const bool use_deform,
1029 const bool use_cage,
1036 *r_free_mesh =
false;
1045 "%s(...): cage arg is unsupported when dependency graph evaluation mode is RENDER",
1051 if (mesh ==
nullptr) {
1052 PyErr_Format(PyExc_ValueError,
1053 "%s(...): Cannot get a mesh from object '%s'",
1059 *r_free_mesh =
true;
1062 if (ob_eval !=
nullptr) {
1069 if (mesh ==
nullptr) {
1070 PyErr_Format(PyExc_ValueError,
1071 "%s(...): Cannot get a mesh from object '%s'",
1079 PyErr_Format(PyExc_ValueError,
1080 "%s(...): Cannot get evaluated data from given dependency graph / object pair",
1090 "%s(...): cage arg is unsupported when dependency graph evaluation mode is RENDER",
1095 if (mesh ==
nullptr) {
1096 PyErr_Format(PyExc_ValueError,
1097 "%s(...): Cannot get a mesh from object '%s'",
1102 *r_free_mesh =
true;
1107 PyErr_Format(PyExc_ValueError,
1108 "%s(...): cage arg is unsupported when deform=False and dependency graph "
1109 "evaluation mode is not RENDER",
1115 if (mesh ==
nullptr) {
1116 PyErr_Format(PyExc_ValueError,
1117 "%s(...): Cannot get a mesh from object '%s'",
1122 *r_free_mesh =
true;
1128 C_BVHTree_FromObject_doc,
1129 ".. classmethod:: FromObject(object, depsgraph, *, deform=True, render=False, "
1130 "cage=False, epsilon=0.0)\n"
1132 " BVH tree based on :class:`Object` data.\n"
1134 " :arg object: Object data.\n"
1135 " :type object: :class:`Object`\n"
1136 " :arg depsgraph: Depsgraph to use for evaluating the mesh.\n"
1137 " :type depsgraph: :class:`Depsgraph`\n"
1138 " :arg deform: Use mesh with deformations.\n"
1139 " :type deform: bool\n"
1140 " :arg cage: Use modifiers cage.\n"
1145 const char *keywords[] = {
"object",
"depsgraph",
"deform",
"cage",
"epsilon",
nullptr};
1147 PyObject *py_ob, *py_depsgraph;
1152 bool use_deform =
true;
1153 bool use_cage =
false;
1154 bool free_mesh =
false;
1156 float epsilon = 0.0f;
1158 if (!PyArg_ParseTupleAndKeywords(args,
1160 "OO|$O&O&f:BVHTree.FromObject",
1179 if (mesh ==
nullptr) {
1193 memcpy(coords, mesh->vert_positions().data(),
sizeof(
float[3]) *
size_t(mesh->
verts_num));
1197 int *orig_index =
nullptr;
1213 tris[
i][0] =
uint(corner_verts[corner_tris[
i][0]]);
1214 tris[
i][1] =
uint(corner_verts[corner_tris[
i][1]]);
1215 tris[
i][2] =
uint(corner_verts[corner_tris[
i][2]]);
1222 orig_index[
i] = int(tri_faces[
i]);
1239 reinterpret_cast<float (*)[3]
>(orig_normal));
1251# pragma clang diagnostic push
1252# pragma clang diagnostic ignored "-Wcast-function-type"
1254# pragma GCC diagnostic push
1255# pragma GCC diagnostic ignored "-Wcast-function-type"
1263 py_bvhtree_ray_cast_doc},
1267 py_bvhtree_find_nearest_doc},
1268 {
"find_nearest_range",
1271 py_bvhtree_find_nearest_range_doc},
1272 {
"overlap",
reinterpret_cast<PyCFunction
>(
py_bvhtree_overlap), METH_O, py_bvhtree_overlap_doc},
1277 METH_VARARGS | METH_KEYWORDS | METH_CLASS,
1278 C_BVHTree_FromPolygons_doc},
1279#ifndef MATH_STANDALONE
1282 METH_VARARGS | METH_KEYWORDS | METH_CLASS,
1283 C_BVHTree_FromBMesh_doc},
1286 METH_VARARGS | METH_KEYWORDS | METH_CLASS,
1287 C_BVHTree_FromObject_doc},
1289 {
nullptr,
nullptr, 0,
nullptr},
1294# pragma clang diagnostic pop
1296# pragma GCC diagnostic pop
1301 PyVarObject_HEAD_INIT(
nullptr, 0)
1337 (allocfunc)PyType_GenericAlloc,
1338 (newfunc)PyType_GenericNew,
1346 (destructor)
nullptr,
1358 "BVH tree structures for proximity searches and ray casts on geometry.");
1361 "mathutils.bvhtree",
CustomData interface, see also DNA_customdata_types.h.
const CustomData_MeshMasks CD_MASK_BAREMESH
void BKE_id_free(Main *bmain, void *idv)
bool BKE_mesh_face_normals_are_dirty(const Mesh *mesh)
General operations, lookup, etc. for blender objects.
Mesh * BKE_object_get_evaluated_mesh(const Object *object_eval)
GSet * BLI_gset_new_ex(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
bool BLI_gset_add(GSet *gs, void *key)
BVHTree * BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
void BLI_bvhtree_balance(BVHTree *tree)
void BLI_bvhtree_free(BVHTree *tree)
void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints)
int BLI_bvhtree_find_nearest(const BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata)
int BLI_bvhtree_ray_cast(const BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
int BLI_bvhtree_range_query(const BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata)
BVHTreeOverlap * BLI_bvhtree_overlap(const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_num, BVHTree_OverlapCallback callback, void *userdata)
MINLINE float max_ff(float a, float b)
MINLINE float square_f(float a)
void closest_on_tri_to_point_v3(float r[3], const float p[3], const float v1[3], const float v2[3], const float v3[3])
void axis_dominant_v3_to_m3_negate(float r_mat[3][3], const float normal[3])
bool isect_tri_tri_v3(const float t_a0[3], const float t_a1[3], const float t_a2[3], const float t_b0[3], const float t_b1[3], const float t_b2[3], float r_i1[3], float r_i2[3])
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE float normalize_v3(float n[3])
#define BLI_MEMARENA_STD_BUFSIZE
MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void BLI_memarena_free(MemArena *ma) ATTR_NONNULL(1)
void * BLI_memarena_alloc(MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1)
#define BLI_POLYFILL_ARENA_SIZE
void BLI_polyfill_calc_arena(const float(*coords)[2], unsigned int coords_num, int coords_sign, unsigned int(*r_tris)[3], struct MemArena *arena)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
#define BM_elem_index_get(ele)
#define BM_elem_index_set(ele, index)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
BMesh const char void * data
void BM_mesh_calc_tessellation(BMesh *bm, MutableSpan< std::array< BMLoop *, 3 > > looptris)
PyTypeObject BPy_BMesh_Type
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
constexpr void copy_from(Span< T > values) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
PyObject * Vector_CreatePyObject(const float *vec, const int vec_num, PyTypeObject *base_type)
static const Mesh * bvh_get_mesh(const char *funcname, Depsgraph *depsgraph, Scene *scene, Object *ob, const bool use_deform, const bool use_cage, bool *r_free_mesh)
#define PYBVH_FIND_GENERIC_RETURN_DOC
static PyObject * py_bvhtree_raycast_to_py(const BVHTreeRayHit *hit)
static PyObject * py_bvhtree_find_nearest_range(PyBVHTree *self, PyObject *args)
static void py_bvhtree_raycast_to_py_tuple(const BVHTreeRayHit *hit, PyObject *py_retval)
BLI_INLINE bool overlap_cmp(const void *a_v, const void *b_v)
static void py_bvhtree__tp_dealloc(PyBVHTree *self)
PyDoc_STRVAR(py_bvhtree_ray_cast_doc, ".. method:: ray_cast(origin, direction, distance=sys.float_info.max, /)\n" "\n" " Cast a ray onto the mesh.\n" "\n" " :arg origin: Start location of the ray in object space.\n" " :type origin: :class:`Vector`\n" " :arg direction: Direction of the ray in object space.\n" " :type direction: :class:`Vector`\n" PYBVH_FIND_GENERIC_DISTANCE_DOC PYBVH_FIND_GENERIC_RETURN_DOC)
static void py_bvhtree_nearest_point_cb(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
static const char PY_BVH_AXIS_DEFAULT
static PyObject * C_BVHTree_FromPolygons(PyObject *, PyObject *args, PyObject *kwargs)
#define PYBVH_MAX_DIST_STR
static PyObject * C_BVHTree_FromBMesh(PyObject *, PyObject *args, PyObject *kwargs)
#define PYBVH_FROM_GENERIC_EPSILON_DOC
static PyObject * py_bvhtree_nearest_to_py_none()
static PyObject * py_bvhtree_nearest_to_py(const BVHTreeNearest *nearest)
static void py_bvhtree_nearest_point_range_cb(void *userdata, int index, const float co[3], float)
static void py_bvhtree_raycast_cb(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
static PyObject * py_bvhtree_raycast_to_py_none()
BLI_INLINE uint overlap_hash(const void *overlap_v)
static PyMethodDef py_bvhtree_methods[]
static PyObject * bvhtree_CreatePyObject(BVHTree *tree, float epsilon, float(*coords)[3], uint coords_len, uint(*tris)[3], uint tris_len, int *orig_index, float(*orig_normal)[3])
static const char PY_BVH_TREE_TYPE_DEFAULT
PyTypeObject PyBVHTree_Type
static PyObject * py_bvhtree_find_nearest(PyBVHTree *self, PyObject *args)
static PyObject * py_bvhtree_overlap(PyBVHTree *self, PyBVHTree *other)
PyMODINIT_FUNC PyInit_mathutils_bvhtree()
#define PYBVH_FIND_GENERIC_DISTANCE_DOC
#define PYBVH_FIND_GENERIC_RETURN_LIST_DOC
static void py_bvhtree_nearest_to_py_tuple(const BVHTreeNearest *nearest, PyObject *py_retval)
static PyModuleDef bvhtree_moduledef
static const float max_dist_default
static PyObject * py_bvhtree_ray_cast(PyBVHTree *self, PyObject *args)
static PyObject * C_BVHTree_FromObject(PyObject *, PyObject *args, PyObject *kwargs)
static bool py_bvhtree_overlap_cb(void *userdata, int index_a, int index_b, int)
#define PyBVHTree_CheckExact(v)
float bvhtree_sphereray_tri_intersection(const BVHTreeRay *ray, float radius, float m_dist, const float v0[3], const float v1[3], const float v2[3])
Mesh * mesh_create_eval_no_deform_render(Depsgraph *depsgraph, const Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
Mesh * mesh_create_eval_no_deform(Depsgraph *depsgraph, const Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
float bvhtree_ray_tri_intersection(const BVHTreeRay *ray, float m_dist, const float v0[3], const float v1[3], const float v2[3])
Mesh * mesh_get_eval_deform(Depsgraph *depsgraph, const Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
Mesh * mesh_create_eval_final(Depsgraph *depsgraph, const Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
VecBase< float, 3 > float3
void * PyC_RNA_AsPointer(PyObject *value, const char *type_name)
uint32_t PyC_Long_AsU32(PyObject *value)
int PyC_ParseBool(PyObject *o, void *p)
void PyC_Tuple_Fill(PyObject *tuple, PyObject *value)
#define PyTuple_SET_ITEMS(op_arg,...)
PyObject_VAR_HEAD BMesh * bm
PyObject_HEAD BVHTree * tree
BLI_INLINE bool overlap_cmp(const void *a_v, const void *b_v)
BLI_INLINE uint overlap_hash(const void *overlap_v)