From fc0d618c2f3489e62b28d6e83978d39ea70c1e7e Mon Sep 17 00:00:00 2001 From: Whirly Date: Wed, 20 Aug 2014 23:41:33 +0100 Subject: STORM-2078 Editing an objects rotation with the rotation rings often causes the object to jump to position <0,0,0> on the region and rotation changes to <0,0,0> --- indra/newview/llmaniprotate.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llmaniprotate.cpp') diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 7861573908..50863ac970 100755 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -1241,9 +1241,9 @@ LLQuaternion LLManipRotate::dragUnconstrained( S32 x, S32 y ) LLVector3 axis = mMouseDown % mMouseCur; axis.normVec(); - F32 angle = acos(mMouseDown * mMouseCur); + F32 angle = atan2(sqrtf(axis * axis), mMouseDown * mMouseCur); LLQuaternion sphere_rot( angle, axis ); - + if (is_approx_zero(1.f - mMouseDown * mMouseCur)) { return LLQuaternion::DEFAULT; @@ -1638,9 +1638,9 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) mInSnapRegime = FALSE; } - angle = acos(mMouseCur * mMouseDown); - - F32 dir = (mMouseDown % mMouseCur) * constraint_axis; // cross product + LLVector3 cross_product = mMouseDown % mMouseCur; + angle = atan2(sqrtf(cross_product * cross_product), mMouseCur * mMouseDown); + F32 dir = cross_product * constraint_axis; // cross product if( dir < 0.f ) { angle *= -1.f; -- cgit v1.2.3 From 5634cc990d71d34e330f87e838be44f60f496bd9 Mon Sep 17 00:00:00 2001 From: Whirly Date: Thu, 21 Aug 2014 01:07:26 +0100 Subject: STORM-2078 Make atan2() work with the unnormalized axis --- indra/newview/llmaniprotate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llmaniprotate.cpp') diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 50863ac970..b2350e5a75 100755 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -1240,8 +1240,8 @@ LLQuaternion LLManipRotate::dragUnconstrained( S32 x, S32 y ) F32 dist_from_sphere_center = sqrt(delta_x * delta_x + delta_y * delta_y); LLVector3 axis = mMouseDown % mMouseCur; - axis.normVec(); F32 angle = atan2(sqrtf(axis * axis), mMouseDown * mMouseCur); + axis.normVec(); LLQuaternion sphere_rot( angle, axis ); if (is_approx_zero(1.f - mMouseDown * mMouseCur)) -- cgit v1.2.3