|
Blender V5.3
|
#include <Python.h>#include "MEM_guardedalloc.h"#include "BLI_kdtree.hh"#include "BLI_utildefines.hh"#include "../generic/py_capi_utils.hh"#include "../generic/python_utildefines.hh"#include "mathutils.hh"#include "mathutils_kdtree.hh"#include "BLI_strict_flags.hh"Go to the source code of this file.
Classes | |
| struct | blender::PyKDTree |
| struct | blender::PyKDTree_NearestData |
Namespaces | |
| namespace | blender |
| BMesh Iterators. | |
Functions | |
| blender::PyDoc_STRVAR (py_KDtree_doc, ".. class:: KDTree(size, *, dimensions=3)\n" "\n" " A KD-tree initialized to hold up to ``size`` items.\n" "\n" " :param size: Maximum number of items.\n" " :type size: int\n" " :param dimensions: The dimensions of the tree (2 or 3).\n" " :type dimensions: int\n" "\n" " .. note::\n" "\n" " :meth:`KDTree.balance` must have been called before using any of the ``find`` " "methods.\n") | |
| blender::PyDoc_STRVAR (py_kdtree_doc, "Generic 2D/3D KD-tree to perform spatial searches.") | |
| PyMODINIT_FUNC | blender::PyInit_mathutils_kdtree () |
Utility helper functions | |
| template<typename CoordT> | |
| static KDTree< CoordT > * | blender::pykdtree_tree_get (PyKDTree *self) |
| template<typename CoordT> | |
| static void | blender::kdtree_nearest_to_py_tuple (const KDTreeNearest< CoordT > *nearest, PyObject *py_retval) |
| template<typename CoordT> | |
| static PyObject * | blender::kdtree_nearest_to_py (const KDTreeNearest< CoordT > *nearest) |
| template<typename CoordT> | |
| static PyObject * | blender::kdtree_nearest_to_py_and_check (const KDTreeNearest< CoordT > *nearest) |
KDTree Methods: Insert | |
| blender::PyDoc_STRVAR (py_kdtree_insert_doc, ".. method:: insert(co, index)\n" "\n" " Insert a point into the KDTree.\n" "\n" " :param co: Point position. Can be 2D or 3D, based on the KDTree dimensions.\n" " :type co: Sequence[float]\n" " :param index: The index of the point (must be non-negative).\n" " :type index: int\n") | |
| static PyObject * | blender::py_kdtree_insert (PyKDTree *self, PyObject *args, PyObject *kwargs) |
KDTree Methods: Balance | |
| blender::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 * | blender::py_kdtree_balance (PyKDTree *self) |
KDTree Methods: Find | |
| static int | blender::py_find_nearest_cb (void *user_data, int index) |
| template<typename CoordT> | |
| static PyObject * | blender::py_kdtree_find_impl (PyKDTree *self, const float *co, PyObject *py_filter) |
| blender::PyDoc_STRVAR (py_kdtree_find_doc, ".. method:: find(co, *, filter=None)\n" "\n" " Find nearest point to ``co``.\n" "\n" " :param co: Point position. Can be 2D or 3D, based on the KDTree dimensions.\n" " :type co: Sequence[float]\n" " :param filter: function which takes an index and returns True for indices to " "include in the search.\n" " :type filter: Callable[[int], bool] | None\n" " :return: Returns (position, index, distance),\n" " or (None, None, None) when no match is found.\n" " :rtype: tuple[:class:`Vector`, int, float] | tuple[None, None, None]\n") | |
| static PyObject * | blender::py_kdtree_find (PyKDTree *self, PyObject *args, PyObject *kwargs) |
KDTree Methods: Find N | |
| template<typename CoordT> | |
| static PyObject * | blender::py_kdtree_find_n_impl (PyKDTree *self, const float *co, uint n) |
| blender::PyDoc_STRVAR (py_kdtree_find_n_doc, ".. method:: find_n(co, n)\n" "\n" " Find nearest ``n`` points to ``co``.\n" "\n" " :param co: Point position. Can be 2D or 3D, based on the KDTree dimensions.\n" " :type co: Sequence[float]\n" " :param n: Number of points to find.\n" " :type n: int\n" " :return: Returns a list of tuples (position, index, distance).\n" " :rtype: list[tuple[:class:`Vector`, int, float]]\n") | |
| static PyObject * | blender::py_kdtree_find_n (PyKDTree *self, PyObject *args, PyObject *kwargs) |
KDTree Methods: Find Range | |
| template<typename CoordT> | |
| static PyObject * | blender::py_kdtree_find_range_impl (PyKDTree *self, const float *co, float radius) |
| blender::PyDoc_STRVAR (py_kdtree_find_range_doc, ".. method:: find_range(co, radius)\n" "\n" " Find all points within ``radius`` of ``co``.\n" "\n" " :param co: Point position. Can be 2D or 3D, based on the KDTree dimensions.\n" " :type co: Sequence[float]\n" " :param radius: Maximum distance to search for points.\n" " :type radius: float\n" " :return: Returns a list of tuples (position, index, distance).\n" " :rtype: list[tuple[:class:`Vector`, int, float]]\n") | |
| static PyObject * | blender::py_kdtree_find_range (PyKDTree *self, PyObject *args, PyObject *kwargs) |
KDTree Type: Get/Set Item Implementation | |
| blender::PyDoc_STRVAR (py_kdtree_dimensions_doc, "KDTree dimensions.\n" "\n" ":type: int\n") | |
| static PyObject * | blender::py_kdtree_dimensions_get (PyKDTree *self, void *) |
Variables | |
| static PyMethodDef | blender::PyKDTree_methods [] |
| PyTypeObject | blender::PyKDTree_Type |
| static PyModuleDef | blender::kdtree_moduledef |
KDTree Type: Get/Set Item Definitions | |
| static PyGetSetDef | blender::PyKDTree_getseters [] |
KDTree | |
| #define | UINT_IS_NEG(n) |
| static int | blender::PyKDTree__tp_init (PyKDTree *self, PyObject *args, PyObject *kwargs) |
| static void | blender::PyKDTree__tp_dealloc (PyKDTree *self) |
This file defines the 'mathutils.kdtree' module, a general purpose module to access blenders kdtree for 2D/3D spatial lookups.
Definition in file mathutils_kdtree.cc.
| #define UINT_IS_NEG | ( | n | ) |
Definition at line 97 of file mathutils_kdtree.cc.
Referenced by blender::py_kdtree_find_n(), and blender::PyKDTree__tp_init().