diff options
author | Joseph Eagar <joeedh@gmail.com> | 2011-04-15 05:19:13 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2011-04-15 05:19:13 +0400 |
commit | c98148a963d37fc2f25e125afeb4cf21df6fbf14 (patch) | |
tree | 691a051e27f08e35bf09d35b6fb9c88e4c37b8d2 /source/blender/editors/transform/transform_snap.c | |
parent | 0bba684d08952d0be822f3906ffb2a03b2674cc2 (diff) | |
parent | fa63c297753636c149fbb1a3877d9b3d93601357 (diff) |
=bmesh= merge from trunk at r36153
Diffstat (limited to 'source/blender/editors/transform/transform_snap.c')
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 7379eb46a3a..16c2856ff8b 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -26,6 +26,11 @@ * * ***** END GPL LICENSE BLOCK ***** */ + +/** \file blender/editors/transform/transform_snap.c + * \ingroup edtransform + */ + #include <stdlib.h> #include <math.h> @@ -642,7 +647,7 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3]) cross_v3_v3v3(tmp, start, end); - if (dot_v3v3(tmp, axis) < 0.0) + if (dot_v3v3(tmp, axis) < 0.0f) angle = -acos(dot_v3v3(start, end)); else angle = acos(dot_v3v3(start, end)); @@ -658,11 +663,11 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3]) angle = atan2(start[1],start[0]) - atan2(end[1],end[0]); } - if (angle > M_PI) { - angle = angle - 2 * M_PI; + if (angle > (float)M_PI) { + angle = angle - 2 * (float)M_PI; } - else if (angle < -(M_PI)) { - angle = 2 * M_PI + angle; + else if (angle < -((float)M_PI)) { + angle = 2.0f * (float)M_PI + angle; } return angle; @@ -1131,7 +1136,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh * this takes care of series of connected edges a bit slanted w.r.t the viewport * otherwise, it would stick to the verts of the closest edge and not slide along merrily * */ - if (new_dist <= *dist && new_depth < *depth * 1.001) + if (new_dist <= *dist && new_depth < *depth * 1.001f) { float n1[3], n2[3]; @@ -1683,7 +1688,7 @@ static void removeDoublesPeel(ListBase *depth_peels) { DepthPeel *next_peel = peel->next; - if (peel && next_peel && ABS(peel->depth - next_peel->depth) < 0.0015) + if (peel && next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f) { peel->next = next_peel->next; @@ -1954,7 +1959,7 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea float asp[3] = {1.0f, 1.0f, 1.0f}; // TODO: Remove hard coded limit here (3) // Early bailing out if no need to snap - if (fac[action] == 0.0) + if (fac[action] == 0.0f) return; /* evil hack - snapping needs to be adapted for image aspect ratio */ @@ -1963,6 +1968,6 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea } for (i=0; i<=max_index; i++) { - val[i]= fac[action]*asp[i]*(float)floor(val[i]/(fac[action]*asp[i]) +.5); + val[i]= fac[action]*asp[i]*(float)floor(val[i]/(fac[action]*asp[i]) +0.5f); } } |