diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-22 21:20:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-22 21:20:37 +0400 |
commit | cd4123e1db8a40836fa04813ef7dc440ef7feeb0 (patch) | |
tree | 9a10e2dd83251954c8dfcfddd430cb46931b9d99 /source/blender/blenlib/intern/BLI_kdtree.c | |
parent | 39aaf4f2f0af3e0663a19381d65081a9090fc10e (diff) |
use inline BLI_math functions for dot product and length calculation.
Diffstat (limited to 'source/blender/blenlib/intern/BLI_kdtree.c')
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdtree.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index 3543b847f19..d5f66c0e75f 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -132,19 +132,18 @@ void BLI_kdtree_balance(KDTree *tree) tree->root= kdtree_balance(tree->nodes, tree->totnode, 0); } -static float squared_distance(float *v2, float *v1, float *n1, float *n2) +static float squared_distance(float *v2, float *v1, float *UNUSED(n1), float *n2) { float d[3], dist; - (void)n1; /* unused */ d[0]= v2[0]-v1[0]; d[1]= v2[1]-v1[1]; d[2]= v2[2]-v1[2]; - dist= d[0]*d[0] + d[1]*d[1] + d[2]*d[2]; + dist = dot_v3v3(d, d); - //if(n1 && n2 && n1[0]*n2[0] + n1[1]*n2[1] + n1[2]*n2[2] < 0.0f) - if(n2 && d[0]*n2[0] + d[1]*n2[1] + d[2]*n2[2] < 0.0f) + //if(n1 && n2 && (dot_v3v3(n1, n2) < 0.0f)) + if(n2 && (dot_v3v3(d, n2) < 0.0f)) dist *= 10.0f; return dist; |