Fix for possible divide by zero error in Rotate.

Fix for MMB behavior when two axis were exactly on one another or very close. It now defaults like this: X, Y, Z (meaning if as near as X as Y, it chooses X). This could be fixed further.
This commit is contained in:
Martin Poirier 2005-03-21 19:16:39 +00:00
parent e5520d955c
commit c2121fb855
2 changed files with 5 additions and 4 deletions

@ -2330,7 +2330,8 @@ int Rotation(TransInfo *t, short mval[2])
int dy3 = mval[1] - t->imval[1];
float deler= ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3))
/ (2 * A * B);
/ (2 * (A*B?A*B:1.0f));
/* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */
float dphi;

@ -794,7 +794,7 @@ void setNearestAxis(TransInfo *t)
}
}
if (len[0] < len[1] && len[0] < len[2]) {
if (len[0] <= len[1] && len[0] <= len[2]) {
if (G.qual & LR_SHIFTKEY) {
t->con.mode |= (CON_AXIS1|CON_AXIS2);
strcpy(t->con.text, " locking global X");
@ -804,7 +804,7 @@ void setNearestAxis(TransInfo *t)
strcpy(t->con.text, " along global X");
}
}
else if (len[1] < len[0] && len[1] < len[2]) {
else if (len[1] <= len[0] && len[1] <= len[2]) {
if (G.qual & LR_SHIFTKEY) {
t->con.mode |= (CON_AXIS0|CON_AXIS2);
strcpy(t->con.text, " locking global Y");
@ -814,7 +814,7 @@ void setNearestAxis(TransInfo *t)
strcpy(t->con.text, " along global Y");
}
}
else if (len[2] < len[1] && len[2] < len[0]) {
else if (len[2] <= len[1] && len[2] <= len[0]) {
if (G.qual & LR_SHIFTKEY) {
t->con.mode |= (CON_AXIS0|CON_AXIS1);
strcpy(t->con.text, " locking global Z");