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>2014-02-02 19:46:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-02 19:46:45 +0400
commitfed1b8b16d2d6a56aeea496677f24b286672bb74 (patch)
tree542e5f6bcfef3491e61f745b4aa1cee769dff63c /source/blender/editors
parentdda63375b2fa581197e909c45116ac17b5f8782c (diff)
Code cleanup: suffix vars to make obvious they are squared
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_widgets.c4
-rw-r--r--source/blender/editors/mask/mask_ops.c28
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c16
-rw-r--r--source/blender/editors/object/object_vgroup.c6
-rw-r--r--source/blender/editors/physics/particle_object.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_proj.c16
-rw-r--r--source/blender/editors/space_clip/clip_draw.c6
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c6
-rw-r--r--source/blender/editors/transform/transform.c20
-rw-r--r--source/blender/editors/transform/transform_conversions.c8
-rw-r--r--source/blender/editors/transform/transform_snap.c10
13 files changed, 68 insertions, 68 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 1724380aaf8..0006163c48e 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1981,9 +1981,9 @@ void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rec
const float centy = BLI_rcti_cent_y_fl(rect);
const float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
const float m_delta[2] = {mx - centx, my - centy};
- const float dist_squared = len_squared_v2(m_delta);
+ const float dist_sq = len_squared_v2(m_delta);
- *val_dist = (dist_squared < (radius * radius)) ? sqrtf(dist_squared) / radius : 1.0f;
+ *val_dist = (dist_sq < (radius * radius)) ? sqrtf(dist_sq) / radius : 1.0f;
*val_rad = atan2f(m_delta[0], m_delta[1]) / (2.0f * (float)M_PI) + 0.5f;
}
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index bf2939c1a62..13ae17c6efd 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -72,7 +72,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask, const
MaskSplinePoint *point = NULL;
float co[2];
const float threshold_sq = threshold * threshold;
- float len = FLT_MAX, scalex, scaley;
+ float len_sq = FLT_MAX, scalex, scaley;
int is_handle = FALSE, width, height;
ED_mask_get_size(sa, &width, &height);
@@ -96,7 +96,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask, const
for (i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *cur_point = &spline->points[i];
MaskSplinePoint *cur_point_deform = &points_array[i];
- float cur_len, vec[2], handle[2];
+ float cur_len_sq, vec[2], handle[2];
vec[0] = cur_point_deform->bezt.vec[1][0] * scalex;
vec[1] = cur_point_deform->bezt.vec[1][1] * scaley;
@@ -106,31 +106,31 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask, const
handle[0] *= scalex;
handle[1] *= scaley;
- cur_len = len_squared_v2v2(co, handle);
+ cur_len_sq = len_squared_v2v2(co, handle);
- if (cur_len < len) {
+ if (cur_len_sq < len_sq) {
point_masklay = masklay;
point_spline = spline;
point = cur_point;
- len = cur_len;
+ len_sq = cur_len_sq;
is_handle = TRUE;
}
}
- cur_len = len_squared_v2v2(co, vec);
+ cur_len_sq = len_squared_v2v2(co, vec);
- if (cur_len < len) {
+ if (cur_len_sq < len_sq) {
point_spline = spline;
point_masklay = masklay;
point = cur_point;
- len = cur_len;
+ len_sq = cur_len_sq;
is_handle = FALSE;
}
}
}
}
- if (len < threshold_sq) {
+ if (len_sq < threshold_sq) {
if (masklay_r)
*masklay_r = point_masklay;
@@ -141,7 +141,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask, const
*is_handle_r = is_handle;
if (score)
- *score = sqrtf(len);
+ *score = sqrtf(len_sq);
return point;
}
@@ -200,14 +200,14 @@ bool ED_mask_feather_find_nearest(const bContext *C, Mask *mask, const float nor
MaskSplinePoint *cur_point = &spline->points[i];
for (j = 0; j <= cur_point->tot_uw; j++) {
- float cur_len, vec[2];
+ float cur_len_sq, vec[2];
vec[0] = (*fp)[0] * scalex;
vec[1] = (*fp)[1] * scaley;
- cur_len = len_squared_v2v2(vec, co);
+ cur_len_sq = len_squared_v2v2(vec, co);
- if (point == NULL || cur_len < len) {
+ if (point == NULL || cur_len_sq < len) {
if (j == 0)
uw = NULL;
else
@@ -216,7 +216,7 @@ bool ED_mask_feather_find_nearest(const bContext *C, Mask *mask, const float nor
point_masklay = masklay;
point_spline = spline;
point = cur_point;
- len = cur_len;
+ len = cur_len_sq;
}
fp++;
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 1fb3741380a..d24fbb3900e 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1842,7 +1842,7 @@ static void sort_by_frac_along(ListBase *lst, BMEdge *e)
for (cur = ((Ref *)lst->first)->next; cur; cur = next) {
KnifeVert *vcur = cur->ref;
- const float vcur_fac = len_squared_v3v3(v1co, vcur->co);
+ const float vcur_fac_sq = len_squared_v3v3(v1co, vcur->co);
next = cur->next;
prev = cur->prev;
@@ -1851,7 +1851,7 @@ static void sort_by_frac_along(ListBase *lst, BMEdge *e)
while (prev) {
KnifeVert *vprev = prev->ref;
- if (len_squared_v3v3(v1co, vprev->co) <= vcur_fac)
+ if (len_squared_v3v3(v1co, vprev->co) <= vcur_fac_sq)
break;
prev = prev->prev;
}
@@ -2057,7 +2057,7 @@ static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, L
BMIter iter;
int nh, nf, i, j, k, m, ax, ay, sep = 0 /* Quite warnings */, bestsep;
int besti[2], bestj[2];
- float d, bestd;
+ float dist_sq, dist_best_sq;
nh = BLI_countlist(hole);
nf = f->len;
@@ -2110,7 +2110,7 @@ static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, L
for (m = 0; m < 2; m++) {
besti[m] = -1;
bestj[m] = -1;
- bestd = FLT_MAX;
+ dist_best_sq = FLT_MAX;
bestsep = 0;
for (i = 0; i < nh; i++) {
if (m == 1) {
@@ -2120,15 +2120,15 @@ static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, L
sep = MIN2(sep, nh - sep);
if (sep < bestsep)
continue;
- bestd = FLT_MAX;
+ dist_best_sq = FLT_MAX;
}
for (j = 0; j < nf; j++) {
bool ok;
if (m == 1 && j == bestj[0])
continue;
- d = len_squared_v2v2(hco[i], fco[j]);
- if (d > bestd)
+ dist_sq = len_squared_v2v2(hco[i], fco[j]);
+ if (dist_sq > dist_best_sq)
continue;
ok = true;
@@ -2151,7 +2151,7 @@ static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, L
bestj[m] = j;
if (m == 1)
bestsep = sep;
- bestd = d;
+ dist_best_sq = dist_sq;
}
}
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 66884d75f36..fa47f8f8bd9 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -997,7 +997,7 @@ static bool ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGro
}
/* Reset nearest.*/
- nearest.dist = FLT_MAX;
+ nearest.dist_sq = FLT_MAX;
/* It is faster to start searching at the top of the tree instead of previous search result.*/
nearest.index = -1;
@@ -1037,7 +1037,7 @@ static bool ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGro
}
/* Reset nearest.*/
- nearest.dist = FLT_MAX;
+ nearest.dist_sq = FLT_MAX;
/* It is faster to start searching at the top of the tree instead of previous search result.*/
nearest.index = -1;
@@ -1098,7 +1098,7 @@ static bool ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGro
}
/* Reset nearest.*/
- nearest.dist = FLT_MAX;
+ nearest.dist_sq = FLT_MAX;
/* It is faster to start searching at the top of the tree instead of previous search result.*/
nearest.index = -1;
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 61392341ce3..bebc46d1242 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -675,7 +675,7 @@ static int connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
key = pa->hair;
nearest.index = -1;
- nearest.dist = FLT_MAX;
+ nearest.dist_sq = FLT_MAX;
BLI_bvhtree_find_nearest(bvhtree.tree, key->co, &nearest, bvhtree.nearest_callback, &bvhtree);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 9f3743cf28f..2e8a8a32ce9 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -3814,7 +3814,7 @@ static void *do_projectpaint_thread(void *ph_v)
ProjPaintImage *last_projIma = NULL;
ImagePaintPartialRedraw *last_partial_redraw_cell;
- float dist_nosqrt, dist;
+ float dist_sq, dist;
float falloff;
int bucket_index;
@@ -3914,11 +3914,11 @@ static void *do_projectpaint_thread(void *ph_v)
projPixel = (ProjPixel *)node->link;
- dist_nosqrt = len_squared_v2v2(projPixel->projCoSS, pos);
+ dist_sq = len_squared_v2v2(projPixel->projCoSS, pos);
/*if (dist < radius) {*/ /* correct but uses a sqrtf */
- if (dist_nosqrt <= brush_radius_sq) {
- dist = sqrtf(dist_nosqrt);
+ if (dist_sq <= brush_radius_sq) {
+ dist = sqrtf(dist_sq);
falloff = BKE_brush_curve_strength_clamp(ps->brush, dist, brush_radius);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index f04e94719c0..d6d13decf4d 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -917,11 +917,11 @@ static float calc_vp_strength_col_dl(VPaint *vp, ViewContext *vc, const float co
co, co_ss,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
- const float dist_squared = len_squared_v2v2(mval, co_ss);
+ const float dist_sq = len_squared_v2v2(mval, co_ss);
- if (dist_squared <= brush_size_pressure * brush_size_pressure) {
+ if (dist_sq <= brush_size_pressure * brush_size_pressure) {
Brush *brush = BKE_paint_brush(&vp->paint);
- const float dist = sqrtf(dist_squared);
+ const float dist = sqrtf(dist_sq);
float factor;
if (brush->mtex.tex && rgba) {
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
index 4c06cb8ea0d..cf15fc3b2db 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
@@ -56,7 +56,7 @@ struct VertProjHandle {
bool use_update;
/* use for update */
- float *dists;
+ float *dists_sq;
Object *ob;
Scene *scene;
@@ -144,13 +144,13 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb(void *userData, int index,
co, co_ss,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
- const float dist = len_squared_v2v2(vp_update->mval_fl, co_ss);
- if (dist > vp_handle->dists[index]) {
+ const float dist_sq = len_squared_v2v2(vp_update->mval_fl, co_ss);
+ if (dist_sq > vp_handle->dists_sq[index]) {
/* bail out! */
return;
}
- vp_handle->dists[index] = dist;
+ vp_handle->dists_sq[index] = dist_sq;
}
}
/* continue with regular functionality */
@@ -181,7 +181,7 @@ static void vpaint_proj_dm_map_cosnos_update(struct VertProjHandle *vp_handle,
/* highly unlikely this will become unavailable once painting starts (perhaps with animated modifiers) */
if (LIKELY(dm->foreachMappedVert)) {
- fill_vn_fl(vp_handle->dists, me->totvert, FLT_MAX);
+ fill_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX);
dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, DM_FOREACH_USE_NORMAL);
}
@@ -207,13 +207,13 @@ struct VertProjHandle *ED_vpaint_proj_handle_create(Scene *scene, Object *ob,
vpaint_proj_dm_map_cosnos_init(scene, ob, vp_handle);
if (vp_handle->use_update) {
- vp_handle->dists = MEM_mallocN(sizeof(float) * me->totvert, __func__);
+ vp_handle->dists_sq = MEM_mallocN(sizeof(float) * me->totvert, __func__);
vp_handle->ob = ob;
vp_handle->scene = scene;
}
else {
- vp_handle->dists = NULL;
+ vp_handle->dists_sq = NULL;
vp_handle->ob = NULL;
vp_handle->scene = NULL;
@@ -234,7 +234,7 @@ void ED_vpaint_proj_handle_update(struct VertProjHandle *vp_handle,
void ED_vpaint_proj_handle_free(struct VertProjHandle *vp_handle)
{
if (vp_handle->use_update) {
- MEM_freeN(vp_handle->dists);
+ MEM_freeN(vp_handle->dists_sq);
}
MEM_freeN(vp_handle->vcosnos);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index aee6e2cda93..92f94185712 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -762,7 +762,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
static float get_shortest_pattern_side(MovieTrackingMarker *marker)
{
int i, next;
- float len = FLT_MAX;
+ float len_sq = FLT_MAX;
for (i = 0; i < 4; i++) {
float cur_len;
@@ -771,10 +771,10 @@ static float get_shortest_pattern_side(MovieTrackingMarker *marker)
cur_len = len_squared_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]);
- len = min_ff(cur_len, len);
+ len_sq = min_ff(cur_len, len_sq);
}
- return sqrtf(len);
+ return sqrtf(len_sq);
}
static void draw_marker_slide_square(float x, float y, float dx, float dy, int outline, float px[2])
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 2e63e00dc28..45f00462147 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -542,13 +542,13 @@ static int get_mouse_pattern_corner(SpaceClip *sc, MovieTrackingMarker *marker,
float len = FLT_MAX, dx, dy;
for (i = 0; i < 4; i++) {
- float cur_len;
+ float cur_len_sq;
next = (i + 1) % 4;
- cur_len = len_squared_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]);
+ cur_len_sq = len_squared_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]);
- len = min_ff(cur_len, len);
+ len = min_ff(cur_len_sq, len);
}
len = sqrtf(len);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 59cb050a335..a7d2ee35be3 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -5273,8 +5273,8 @@ static void calcNonProportionalEdgeSlide(TransInfo *t, EdgeSlideData *sld, const
int i = 0;
float v_proj[2];
- float dist = 0;
- float min_dist = FLT_MAX;
+ float dist_sq = 0;
+ float dist_min_sq = FLT_MAX;
if (t->spacetype == SPACE_VIEW3D) {
/* background mode support */
@@ -5294,9 +5294,9 @@ static void calcNonProportionalEdgeSlide(TransInfo *t, EdgeSlideData *sld, const
sv->edge_len = len_v3v3(sv->dir_a, sv->dir_b);
ED_view3d_project_float_v2_m4(ar, sv->v->co, v_proj, projectMat);
- dist = len_squared_v2v2(mval, v_proj);
- if (dist < min_dist) {
- min_dist = dist;
+ dist_sq = len_squared_v2v2(mval, v_proj);
+ if (dist_sq < dist_min_sq) {
+ dist_min_sq = dist_sq;
sld->curr_sv_index = i;
}
}
@@ -6249,14 +6249,14 @@ static void calcVertSlideMouseActiveVert(struct TransInfo *t, const int mval[2])
TransDataVertSlideVert *sv;
/* set the vertex to use as a reference for the mouse direction 'curr_sv_index' */
- float dist = 0.0f;
- float min_dist = FLT_MAX;
+ float dist_sq = 0.0f;
+ float dist_min_sq = FLT_MAX;
int i;
for (i = 0, sv = sld->sv; i < sld->totsv; i++, sv++) {
- dist = len_squared_v2v2(mval_fl, sv->co_orig_2d);
- if (dist < min_dist) {
- min_dist = dist;
+ dist_sq = len_squared_v2v2(mval_fl, sv->co_orig_2d);
+ if (dist_sq < dist_min_sq) {
+ dist_min_sq = dist_sq;
sld->curr_sv_index = i;
}
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 3163e8ffce4..2103073d5e9 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -238,7 +238,7 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
if ((tob->flag & TD_SELECTED) == 0) {
TransData *td;
int i;
- float dist, vec[3];
+ float dist_sq, vec[3];
tob->rdist = -1.0f; // signal for next loop
@@ -253,9 +253,9 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
sub_v3_v3(vec, vec_p);
}
- dist = len_squared_v3(vec);
- if ((tob->rdist == -1.0f) || (dist < (tob->rdist * tob->rdist))) {
- tob->rdist = sqrtf(dist);
+ dist_sq = len_squared_v3(vec);
+ if ((tob->rdist == -1.0f) || (dist_sq < (tob->rdist * tob->rdist))) {
+ tob->rdist = sqrtf(dist_sq);
}
}
else {
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 4a6f4c31a90..9f48dc8995c 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -680,22 +680,22 @@ eRedrawFlag updateSelectedSnapPoint(TransInfo *t)
if (t->tsnap.status & MULTI_POINTS) {
TransSnapPoint *p, *closest_p = NULL;
- float closest_dist = TRANSFORM_SNAP_MAX_PX;
+ float dist_min_sq = TRANSFORM_SNAP_MAX_PX;
const float mval_fl[2] = {t->mval[0], t->mval[1]};
float screen_loc[2];
for (p = t->tsnap.points.first; p; p = p->next) {
- float dist;
+ float dist_sq;
if (ED_view3d_project_float_global(t->ar, p->co, screen_loc, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) {
continue;
}
- dist = len_squared_v2v2(mval_fl, screen_loc);
+ dist_sq = len_squared_v2v2(mval_fl, screen_loc);
- if (dist < closest_dist) {
+ if (dist_sq < dist_min_sq) {
closest_p = p;
- closest_dist = dist;
+ dist_min_sq = dist_sq;
}
}