Removed incorrect Quaternion to AngAxis conversion
use Float3 AngularAxis( const Quaternion &rotation ) in ::Oyster::Math3D instead
This commit is contained in:
parent
911700676c
commit
73e9629832
|
@ -420,7 +420,7 @@ void GameState::DataRecieved( NetEvent<NetworkClient*, NetworkClient::ClientEven
|
|||
|
||||
// if is this player. Remember to change camera
|
||||
if( this->myId == decoded.object_ID )
|
||||
camera.SetAngular( QuaternionToAngularAxis(rotation).xyz );
|
||||
camera.SetAngular( AngularAxis(rotation) );
|
||||
|
||||
int i = FindObject( this->dynamicObjects, decoded.object_ID );
|
||||
if( i > -1 )
|
||||
|
@ -437,7 +437,7 @@ void GameState::DataRecieved( NetEvent<NetworkClient*, NetworkClient::ClientEven
|
|||
if( this->myId == decoded.object_ID )
|
||||
{
|
||||
camera.SetPosition( position );
|
||||
camera.SetAngular( QuaternionToAngularAxis(rotation).xyz );
|
||||
camera.SetAngular( AngularAxis(rotation) );
|
||||
}
|
||||
|
||||
int i = FindObject( this->dynamicObjects, decoded.object_ID );
|
||||
|
|
|
@ -375,7 +375,7 @@ namespace LinearAlgebra3D
|
|||
|
||||
template<typename ScalarType>
|
||||
inline ::LinearAlgebra::Vector3<ScalarType> AngularAxis( const ::LinearAlgebra::Quaternion<ScalarType> &rotation )
|
||||
{
|
||||
{ // see http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
|
||||
ScalarType angle = ScalarType(2) * (ScalarType)::std::acos( rotation.real ),
|
||||
multiplier = angle / (ScalarType)::std::sqrt( ScalarType(1) - rotation.real * rotation.real );
|
||||
return multiplier * rotation.imaginary;
|
||||
|
|
|
@ -102,52 +102,6 @@ namespace Oyster { namespace Math3D
|
|||
// return ::LinearAlgebra3D::ExtractAngularAxis( orientationMatrix );
|
||||
//}
|
||||
|
||||
Float4 QuaternionToAngularAxis(Float4 quaternion)
|
||||
{
|
||||
Float4 axis = Float4::null;
|
||||
Float s = sqrtf(1 - quaternion.w*quaternion.w);
|
||||
|
||||
axis.w = 2*acos(quaternion.w*quaternion.w);
|
||||
|
||||
if(1 - quaternion.w > 0.001f)
|
||||
{
|
||||
axis.x = quaternion.x/s;
|
||||
axis.y = quaternion.y/s;
|
||||
axis.z = quaternion.z/s;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis.x = quaternion.x;
|
||||
axis.y = quaternion.y;
|
||||
axis.z = quaternion.z;
|
||||
}
|
||||
|
||||
return axis;
|
||||
}
|
||||
|
||||
Float4 QuaternionToAngularAxis(Quaternion quaternion)
|
||||
{
|
||||
Float4 axis = Float4::null;
|
||||
Float s = sqrtf(1 - quaternion.real*quaternion.real);
|
||||
|
||||
axis.w = 2*acos(quaternion.real*quaternion.real);
|
||||
|
||||
if(1 - quaternion.real > 0.001f)
|
||||
{
|
||||
axis.x = quaternion.imaginary.x/s;
|
||||
axis.y = quaternion.imaginary.y/s;
|
||||
axis.z = quaternion.imaginary.z/s;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis.x = quaternion.imaginary.x;
|
||||
axis.y = quaternion.imaginary.y;
|
||||
axis.z = quaternion.imaginary.z;
|
||||
}
|
||||
|
||||
return axis;
|
||||
}
|
||||
|
||||
Float4x4 & TranslationMatrix( const Float3 &position, Float4x4 &targetMem )
|
||||
{
|
||||
return ::LinearAlgebra3D::TranslationMatrix( position, targetMem );
|
||||
|
|
|
@ -152,12 +152,6 @@ namespace Oyster { namespace Math3D //! Oyster's native math library specialized
|
|||
////! Extracts the angularAxis from orientationMatrix
|
||||
//Float4 ExtractAngularAxis( const Float4x4 &orientationMatrix );
|
||||
|
||||
//! Converts a quaternion as Float4 to angular axis as Float4
|
||||
Float4 QuaternionToAngularAxis(Float4 quaternion);
|
||||
|
||||
//! Converts a quaternion to angular axis as Float4
|
||||
Float4 QuaternionToAngularAxis(Quaternion quaternion);
|
||||
|
||||
//! Sets and returns targetMem to a translationMatrix with position as translation.
|
||||
Float4x4 & TranslationMatrix( const Float3 &position, Float4x4 &targetMem = Float4x4() );
|
||||
|
||||
|
|
Loading…
Reference in New Issue