Blender
V3.3
|
#include <Python.h>
#include "MEM_guardedalloc.h"
#include "BLI_kdtree.h"
#include "BLI_utildefines.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
#include "mathutils.h"
#include "mathutils_kdtree.h"
#include "BLI_strict_flags.h"
Go to the source code of this file.
Classes | |
struct | PyKDTree |
struct | PyKDTree_NearestData |
Macros | |
#define | UINT_IS_NEG(n) ((n) > INT_MAX) |
Functions | |
static void | kdtree_nearest_to_py_tuple (const KDTreeNearest_3d *nearest, PyObject *py_retval) |
static PyObject * | kdtree_nearest_to_py (const KDTreeNearest_3d *nearest) |
static PyObject * | kdtree_nearest_to_py_and_check (const KDTreeNearest_3d *nearest) |
static int | PyKDTree__tp_init (PyKDTree *self, PyObject *args, PyObject *kwargs) |
static void | PyKDTree__tp_dealloc (PyKDTree *self) |
PyDoc_STRVAR (py_kdtree_insert_doc, ".. method:: insert(co, index)\n" "\n" " Insert a point into the KDTree.\n" "\n" " :arg co: Point 3d position.\n" " :type co: float triplet\n" " :arg index: The index of the point.\n" " :type index: int\n") | |
static PyObject * | py_kdtree_insert (PyKDTree *self, PyObject *args, PyObject *kwargs) |
PyDoc_STRVAR (py_kdtree_balance_doc, ".. method:: balance()\n" "\n" " Balance the tree.\n" "\n" ".. note::\n" "\n" " This builds the entire tree, avoid calling after each insertion.\n") | |
static PyObject * | py_kdtree_balance (PyKDTree *self) |
static int | py_find_nearest_cb (void *user_data, int index, const float co[3], float dist_sq) |
PyDoc_STRVAR (py_kdtree_find_doc, ".. method:: find(co, filter=None)\n" "\n" " Find nearest point to ``co``.\n" "\n" " :arg co: 3d coordinates.\n" " :type co: float triplet\n" " :arg filter: function which takes an index and returns True for indices to " "include in the search.\n" " :type filter: callable\n" " :return: Returns (:class:`Vector`, index, distance).\n" " :rtype: :class:`tuple`\n") | |
static PyObject * | py_kdtree_find (PyKDTree *self, PyObject *args, PyObject *kwargs) |
PyDoc_STRVAR (py_kdtree_find_n_doc, ".. method:: find_n(co, n)\n" "\n" " Find nearest ``n`` points to ``co``.\n" "\n" " :arg co: 3d coordinates.\n" " :type co: float triplet\n" " :arg n: Number of points to find.\n" " :type n: int\n" " :return: Returns a list of tuples (:class:`Vector`, index, distance).\n" " :rtype: :class:`list`\n") | |
static PyObject * | py_kdtree_find_n (PyKDTree *self, PyObject *args, PyObject *kwargs) |
PyDoc_STRVAR (py_kdtree_find_range_doc, ".. method:: find_range(co, radius)\n" "\n" " Find all points within ``radius`` of ``co``.\n" "\n" " :arg co: 3d coordinates.\n" " :type co: float triplet\n" " :arg radius: Distance to search for points.\n" " :type radius: float\n" " :return: Returns a list of tuples (:class:`Vector`, index, distance).\n" " :rtype: :class:`list`\n") | |
static PyObject * | py_kdtree_find_range (PyKDTree *self, PyObject *args, PyObject *kwargs) |
PyDoc_STRVAR (py_KDtree_doc, "KdTree(size) -> new kd-tree initialized to hold ``size`` items.\n" "\n" ".. note::\n" "\n" " :class:`KDTree.balance` must have been called before using any of the ``find`` " "methods.\n") | |
PyDoc_STRVAR (py_kdtree_doc, "Generic 3-dimensional kd-tree to perform spatial searches.") | |
PyMODINIT_FUNC | PyInit_mathutils_kdtree (void) |
Variables | |
static PyMethodDef | PyKDTree_methods [] |
PyTypeObject | PyKDTree_Type |
static struct PyModuleDef | kdtree_moduledef |
This file defines the 'mathutils.kdtree' module, a general purpose module to access blenders kdtree for 3d spatial lookups.
Definition in file mathutils_kdtree.c.
#define UINT_IS_NEG | ( | n | ) | ((n) > INT_MAX) |
Definition at line 78 of file mathutils_kdtree.c.
|
static |
Definition at line 47 of file mathutils_kdtree.c.
References kdtree_nearest_to_py_tuple().
Referenced by py_kdtree_find_n(), and py_kdtree_find_range().
|
static |
Definition at line 58 of file mathutils_kdtree.c.
References kdtree_nearest_to_py_tuple(), and PyC_Tuple_Fill().
Referenced by py_kdtree_find().
|
static |
Definition at line 36 of file mathutils_kdtree.c.
References BLI_assert, NULL, PyTuple_SET_ITEMS, and Vector_CreatePyObject().
Referenced by kdtree_nearest_to_py(), and kdtree_nearest_to_py_and_check().
|
static |
Definition at line 168 of file mathutils_kdtree.c.
References data, PyC_ParseBool(), result, UNUSED_VARS, and user_data.
Referenced by py_kdtree_find().
|
static |
Definition at line 156 of file mathutils_kdtree.c.
References self.
|
static |
Definition at line 204 of file mathutils_kdtree.c.
References data, kdtree_nearest_to_py_and_check(), mathutils_array_parse(), NULL, PyKDTree_NearestData::py_filter, py_find_nearest_cb(), and self.
|
static |
Definition at line 257 of file mathutils_kdtree.c.
References kdtree_nearest_to_py(), mathutils_array_parse(), MEM_freeN, MEM_mallocN, NULL, self, and UINT_IS_NEG.
|
static |
Definition at line 311 of file mathutils_kdtree.c.
References kdtree_nearest_to_py(), mathutils_array_parse(), MEM_freeN, NULL, and self.
|
static |
Definition at line 117 of file mathutils_kdtree.c.
References mathutils_array_parse(), NULL, and self.
PyDoc_STRVAR | ( | py_kdtree_balance_doc | , |
".. method:: balance()\n" "\n" " Balance the tree.\n" "\n" ".. note::\n" "\n" " This builds the entire | tree, | ||
avoid calling after each insertion.\n" | |||
) |
PyDoc_STRVAR | ( | py_kdtree_doc | , |
"Generic 3-dimensional kd-tree to perform spatial searches." | |||
) |
PyDoc_STRVAR | ( | py_KDtree_doc | , |
"KdTree(size) -> new kd-tree initialized to hold ``size`` items.\n" "\n" ".. note::\n" "\n" " :class:`KDTree.balance` must have been called before using any of the ``find`` " "methods.\n" | |||
) |
PyDoc_STRVAR | ( | py_kdtree_find_doc | , |
".. method:: find(co, filter=None)\n" "\n" " Find nearest point to ``co``.\n" "\n" " :arg co: 3d coordinates.\n" " :type co: float triplet\n" " :arg filter: function which takes an index and returns True for indices to " "include in the search.\n" " :type filter: callable\n" " :return: Returns (:class:`Vector`, index, distance).\n" " :rtype: :class:`tuple`\n" | |||
) |
PyDoc_STRVAR | ( | py_kdtree_find_n_doc | , |
".. method:: find_n(co, n)\n" "\n" " Find nearest ``n`` points to ``co``.\n" "\n" " :arg co: 3d coordinates.\n" " :type co: float triplet\n" " :arg n: Number of points to find.\n" " :type n: int\n" " :return: Returns a list of tuples (:class:`Vector`, index, distance).\n" " :rtype: :class:`list`\n" | |||
) |
PyDoc_STRVAR | ( | py_kdtree_find_range_doc | , |
".. method:: find_range(co, radius)\n" "\n" " Find all points within ``radius`` of ``co``.\n" "\n" " :arg co: 3d coordinates.\n" " :type co: float triplet\n" " :arg radius: Distance to search for points.\n" " :type radius: float\n" " :return: Returns a list of tuples (:class:`Vector`, index, distance).\n" " :rtype: :class:`list`\n" | |||
) |
PyDoc_STRVAR | ( | py_kdtree_insert_doc | , |
".. method:: insert(co, index)\n" "\n" " Insert a point into the KDTree.\n" "\n" " :arg co: Point 3d position.\n" " :type co: float triplet\n" " :arg index: The index of the point.\n" " :type index: int\n" | |||
) |
PyMODINIT_FUNC PyInit_mathutils_kdtree | ( | void | ) |
Definition at line 437 of file mathutils_kdtree.c.
References kdtree_moduledef, NULL, and PyKDTree_Type.
Referenced by PyInit_mathutils().
Definition at line 102 of file mathutils_kdtree.c.
References self.
|
static |
Definition at line 80 of file mathutils_kdtree.c.
References NULL, and UINT_IS_NEG.
|
static |
Definition at line 424 of file mathutils_kdtree.c.
Referenced by PyInit_mathutils_kdtree().
|
static |
Definition at line 356 of file mathutils_kdtree.c.
PyTypeObject PyKDTree_Type |
Definition at line 375 of file mathutils_kdtree.c.
Referenced by PyInit_mathutils_kdtree().