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>2011-09-11 06:50:01 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-11 06:50:01 +0400
commit599cd56f535946726bc30e66e7ac483ec91ab6fd (patch)
treec0c09962558535a0a3435f1eed2669deb3b91094 /source/blender/blenlib
parent3a5f2272adc4ec821db16de95781b9ce653dda73 (diff)
minor edits / cleanup - no functional changes.
- use 'const float *' and array size in some function declarations. - replace macros for BLI_math functions INPF, VECCOPY, VECADD etc. - remove unused VertRen.clip struct member. - remove static squared_dist() from 2 files, replace with BLI_math function len_squared_v3v3(). - use vertex arrays for drawing clipping background in the 3D viewport.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index dcbe043f0d0..eae4f918a67 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -408,7 +408,7 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, float *co, int numpoi
// for all Axes.
for (i = tree->start_axis; i < tree->stop_axis; i++)
{
- newminmax = INPR(&co[k * 3], KDOP_AXES[i]);
+ newminmax = dot_v3v3(&co[k * 3], KDOP_AXES[i]);
if (newminmax < bv[2 * i])
bv[2 * i] = newminmax;
if (newminmax > bv[(2 * i) + 1])
@@ -1193,17 +1193,6 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
return overlap;
}
-
-/*
- * Nearest neighbour - BLI_bvhtree_find_nearest
- */
-static float squared_dist(const float *a, const float *b)
-{
- float tmp[3];
- VECSUB(tmp, a, b);
- return INPR(tmp, tmp);
-}
-
//Determines the nearest point of the given node BV. Returns the squared distance to that point.
static float calc_nearest_point(const float *proj, BVHNode *node, float *nearest)
{
@@ -1226,7 +1215,7 @@ static float calc_nearest_point(const float *proj, BVHNode *node, float *nearest
VECCOPY(nearest, data->co);
for(i = data->tree->start_axis; i != data->tree->stop_axis; i++, bv+=2)
{
- float proj = INPR( nearest, KDOP_AXES[i]);
+ float proj = dot_v3v3( nearest, KDOP_AXES[i]);
float dl = bv[0] - proj;
float du = bv[1] - proj;
@@ -1240,7 +1229,7 @@ static float calc_nearest_point(const float *proj, BVHNode *node, float *nearest
}
}
*/
- return squared_dist(proj, nearest);
+ return len_squared_v3v3(proj, nearest);
}
@@ -1404,7 +1393,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float *co, BVHTreeNearest *nea
for(i = data.tree->start_axis; i != data.tree->stop_axis; i++)
{
- data.proj[i] = INPR(data.co, KDOP_AXES[i]);
+ data.proj[i] = dot_v3v3(data.co, KDOP_AXES[i]);
}
if(nearest)
@@ -1596,7 +1585,7 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float
for(i=0; i<3; i++)
{
- data.ray_dot_axis[i] = INPR( data.ray.direction, KDOP_AXES[i]);
+ data.ray_dot_axis[i] = dot_v3v3(data.ray.direction, KDOP_AXES[i]);
data.idot_axis[i] = 1.0f / data.ray_dot_axis[i];
if(fabsf(data.ray_dot_axis[i]) < FLT_EPSILON)