Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_kdtree_nd.h
- This file was added.
| /* | |||||
| * This program is free software; you can redistribute it and/or | |||||
| * modify it under the terms of the GNU General Public License | |||||
| * as published by the Free Software Foundation; either version 2 | |||||
| * of the License, or (at your option) any later version. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * GNU General Public License for more details. | |||||
| * | |||||
| * You should have received a copy of the GNU General Public License | |||||
| * along with this program; if not, write to the Free Software Foundation, | |||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
| */ | |||||
| #ifndef __BLI_KDTREE_ND_H__ | |||||
| #define __BLI_KDTREE_ND_H__ | |||||
| /** \file | |||||
| * \ingroup bli | |||||
| * \brief A kd-tree for nearest neighbor search. | |||||
| */ | |||||
| #include "BLI_compiler_attrs.h" | |||||
| struct KDTreeND; | |||||
| typedef struct KDTreeND KDTreeND; | |||||
| typedef struct KDTreeNearestND_Base { | |||||
| int index; | |||||
| float dist; | |||||
| float co[0]; | |||||
| /* User must add size after. */ | |||||
| } KDTreeNearestND_Base; | |||||
| KDTreeND *BLI_kdtree_nd_new(unsigned int maxsize, unsigned int dims); | |||||
| void BLI_kdtree_nd_free(KDTreeND *tree); | |||||
| void BLI_kdtree_nd_balance(KDTreeND *tree) ATTR_NONNULL(1); | |||||
| void BLI_kdtree_nd_insert( | |||||
| KDTreeND *tree, int index, | |||||
| const float co[3]) ATTR_NONNULL(1, 3); | |||||
| int BLI_kdtree_nd_find_nearest( | |||||
| const KDTreeND *tree, const float co[3], | |||||
| KDTreeNearestND_Base *r_nearest) ATTR_NONNULL(1, 2); | |||||
| #endif /* __BLI_KDTREE_H__ */ | |||||