Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-09-02 00:17:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-09-02 00:17:56 +0400
commit36065ee4f4a729ab48df5388373c26b07554de67 (patch)
treeea5abc0de5357a1e49120a139ef2f62270bc0bd3 /source/blender/blenlib/BLI_kdtree.h
parent77e86dce2aa868f96467b1989f905cf9cb20de02 (diff)
use strict flags for kdtree, and replace ints with unsigned ints where possible.
also replace callocs with mallocs since zeroing memory can be avoided.
Diffstat (limited to 'source/blender/blenlib/BLI_kdtree.h')
-rw-r--r--source/blender/blenlib/BLI_kdtree.h33
1 files changed, 16 insertions, 17 deletions
diff --git a/source/blender/blenlib/BLI_kdtree.h b/source/blender/blenlib/BLI_kdtree.h
index b687d98e6ad..e3c81021351 100644
--- a/source/blender/blenlib/BLI_kdtree.h
+++ b/source/blender/blenlib/BLI_kdtree.h
@@ -31,6 +31,8 @@
* \author Brecht van Lommel
*/
+#include "BLI_compiler_attrs.h"
+
struct KDTree;
typedef struct KDTree KDTree;
@@ -40,22 +42,19 @@ typedef struct KDTreeNearest {
float co[3];
} KDTreeNearest;
-/* Creates or free a kdtree */
-KDTree *BLI_kdtree_new(int maxsize);
+KDTree *BLI_kdtree_new(unsigned int maxsize);
void BLI_kdtree_free(KDTree *tree);
-/* Construction: first insert points, then call balance. Normal is optional. */
-void BLI_kdtree_insert(KDTree *tree, int index, const float co[3], const float nor[3]);
-void BLI_kdtree_balance(KDTree *tree);
-
-/* Find nearest returns index, and -1 if no node is found.
- * Find n nearest returns number of points found, with results in nearest.
- * Normal is optional, but if given will limit results to points in normal direction from co. */
-int BLI_kdtree_find_nearest(KDTree *tree, const float co[3], const float nor[3], KDTreeNearest *nearest);
-int BLI_kdtree_find_n_nearest(KDTree *tree, int n, const float co[3], const float nor[3], KDTreeNearest *nearest);
-
-/* Range search returns number of points found, with results in nearest */
-/* Normal is optional, but if given will limit results to points in normal direction from co. */
-/* Remember to free nearest after use! */
-int BLI_kdtree_range_search(KDTree *tree, float range, const float co[3], const float nor[3], KDTreeNearest **nearest);
-#endif
+void BLI_kdtree_insert(KDTree *tree, int index, const float co[3], const float nor[3]) ATTR_NONNULL(1, 3);
+void BLI_kdtree_balance(KDTree *tree) ATTR_NONNULL(1);
+
+int BLI_kdtree_find_nearest(KDTree *tree, const float co[3], const float nor[3],
+ KDTreeNearest *r_nearest) ATTR_NONNULL(1, 2);
+int BLI_kdtree_find_nearest_n(KDTree *tree, const float co[3], const float nor[3],
+ KDTreeNearest *r_nearest,
+ unsigned int n) ATTR_NONNULL(1, 2, 4);
+int BLI_kdtree_range_search(KDTree *tree, const float co[3], const float nor[3],
+ KDTreeNearest **r_nearest,
+ float range) ATTR_NONNULL(1, 2, 4) ATTR_WARN_UNUSED_RESULT;
+
+#endif /* __BLI_KDTREE_H__ */