From 599cd56f535946726bc30e66e7ac483ec91ab6fd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 11 Sep 2011 02:50:01 +0000 Subject: 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. --- source/blender/modifiers/intern/MOD_weightvgproximity.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index af3f71d6099..d015a8af4c4 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -62,16 +62,6 @@ /* Util macro. */ #define OUT_OF_MEMORY() ((void)printf("WeightVGProximity: Out of memory.\n")) -/** - * Returns the squared distance between two given points. - */ -static float squared_dist(const float *a, const float *b) -{ - float tmp[3]; - VECSUB(tmp, a, b); - return INPR(tmp, tmp); -} - /** * Find nearest vertex and/or edge and/or face, for each vertex (adapted from shrinkwrap.c). */ @@ -137,19 +127,19 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3], * This will lead in prunning of the search tree. */ if (dist_v) { - nearest_v.dist = nearest_v.index != -1 ? squared_dist(tmp_co, nearest_v.co) : FLT_MAX; + nearest_v.dist = nearest_v.index != -1 ? len_squared_v3v3(tmp_co, nearest_v.co) : FLT_MAX; /* Compute and store result. If invalid (-1 idx), keep FLT_MAX dist. */ BLI_bvhtree_find_nearest(treeData_v.tree, tmp_co, &nearest_v, treeData_v.nearest_callback, &treeData_v); dist_v[i] = sqrtf(nearest_v.dist); } if (dist_e) { - nearest_e.dist = nearest_e.index != -1 ? squared_dist(tmp_co, nearest_e.co) : FLT_MAX; + nearest_e.dist = nearest_e.index != -1 ? len_squared_v3v3(tmp_co, nearest_e.co) : FLT_MAX; /* Compute and store result. If invalid (-1 idx), keep FLT_MAX dist. */ BLI_bvhtree_find_nearest(treeData_e.tree, tmp_co, &nearest_e, treeData_e.nearest_callback, &treeData_e); dist_e[i] = sqrtf(nearest_e.dist); } if (dist_f) { - nearest_f.dist = nearest_f.index != -1 ? squared_dist(tmp_co, nearest_f.co) : FLT_MAX; + nearest_f.dist = nearest_f.index != -1 ? len_squared_v3v3(tmp_co, nearest_f.co) : FLT_MAX; /* Compute and store result. If invalid (-1 idx), keep FLT_MAX dist. */ BLI_bvhtree_find_nearest(treeData_f.tree, tmp_co, &nearest_f, treeData_f.nearest_callback, &treeData_f); dist_f[i] = sqrtf(nearest_f.dist); -- cgit v1.2.3