diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-27 02:21:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-27 02:21:56 +0400 |
commit | 54b64cfd612922054f014460f1c08ec4b0374a3d (patch) | |
tree | 2df8a029ef6deff92da8e67fee92c55a29c11234 /source/blender/blenlib | |
parent | eda0f3b1863e2e41b9913e16af82407b63e145bf (diff) |
code cleanup: use const float and define array size
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_kdtree.h | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdtree.c | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_kdtree.h b/source/blender/blenlib/BLI_kdtree.h index ae5e32d73eb..e90566408d4 100644 --- a/source/blender/blenlib/BLI_kdtree.h +++ b/source/blender/blenlib/BLI_kdtree.h @@ -50,17 +50,17 @@ KDTree *BLI_kdtree_new(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, float *co, float *nor); +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, float *co, float *nor, KDTreeNearest *nearest); -int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, 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, float *co, float *nor, KDTreeNearest **nearest); +int BLI_kdtree_range_search(KDTree *tree, float range, const float co[3], const float nor[3], KDTreeNearest **nearest); #endif diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index 4878c0f05a6..a828ab5b3f4 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -73,7 +73,7 @@ void BLI_kdtree_free(KDTree *tree) } } -void BLI_kdtree_insert(KDTree *tree, int index, float *co, float *nor) +void BLI_kdtree_insert(KDTree *tree, int index, const float co[3], const float nor[3]) { KDTreeNode *node = &tree->nodes[tree->totnode++]; @@ -132,7 +132,7 @@ void BLI_kdtree_balance(KDTree *tree) tree->root = kdtree_balance(tree->nodes, tree->totnode, 0); } -static float squared_distance(const float v2[3], const float v1[3], float *UNUSED(n1), float *n2) +static float squared_distance(const float v2[3], const float v1[3], const float *UNUSED(n1), const float *n2) { float d[3], dist; @@ -258,7 +258,7 @@ static void add_nearest(KDTreeNearest *ptn, int *found, int n, int index, float } /* finds the nearest n entries in tree to specified coordinates */ -int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTreeNearest *nearest) +int BLI_kdtree_find_n_nearest(KDTree *tree, int n, const float co[3], const float nor[3], KDTreeNearest *nearest) { KDTreeNode *root, *node = NULL; KDTreeNode **stack, *defaultstack[100]; @@ -373,7 +373,7 @@ static void add_in_range(KDTreeNearest **ptn, int found, int *totfoundstack, int to->dist = sqrt(dist); copy_v3_v3(to->co, co); } -int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KDTreeNearest **nearest) +int BLI_kdtree_range_search(KDTree *tree, float range, const float co[3], const float nor[3], KDTreeNearest **nearest) { KDTreeNode *root, *node = NULL; KDTreeNode **stack, *defaultstack[100]; |