Inertia tensor fix

should produce radian anglevelocities
This commit is contained in:
Dander7BD 2014-01-14 11:32:02 +01:00
parent 01e7614a5c
commit 23dab9dea6
1 changed files with 14 additions and 14 deletions

View File

@ -278,7 +278,7 @@ namespace Oyster { namespace Physics3D
/** @todo TODO: add MomentOfInertia tensor formulas */ /** @todo TODO: add MomentOfInertia tensor formulas */
inline ::Oyster::Math::Float CalculateSphere( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius ) inline ::Oyster::Math::Float CalculateSphere( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius )
{ {
return (2.0f/5.0f)*mass*radius*radius; return ::Utility::Value::Radian( 2.0f / 5.0f ) * mass * radius * radius;
} }
inline ::Oyster::Math::Float4x4 Sphere( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius ) inline ::Oyster::Math::Float4x4 Sphere( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius )
@ -293,7 +293,7 @@ namespace Oyster { namespace Physics3D
inline ::Oyster::Math::Float CalculateHollowSphere( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius ) inline ::Oyster::Math::Float CalculateHollowSphere( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius )
{ {
return (2.0f/3.0f)*mass*radius*radius; return ::Utility::Value::Radian( 2.0f / 3.0f ) * mass * radius * radius;
} }
inline ::Oyster::Math::Float4x4 HollowSphere( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius ) inline ::Oyster::Math::Float4x4 HollowSphere( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius )
@ -308,17 +308,17 @@ namespace Oyster { namespace Physics3D
inline ::Oyster::Math::Float CalculateCuboidX( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float depth ) inline ::Oyster::Math::Float CalculateCuboidX( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float depth )
{ {
return (1.0f/12.0f)*mass*(height*height + depth*depth); return ::Utility::Value::Radian( 1.0f / 12.0f ) * mass * (height * height + depth * depth);
} }
inline ::Oyster::Math::Float CalculateCuboidY( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float width, const ::Oyster::Math::Float depth ) inline ::Oyster::Math::Float CalculateCuboidY( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float width, const ::Oyster::Math::Float depth )
{ {
return (1.0f/12.0f)*mass*(width*width + depth*depth); return ::Utility::Value::Radian( 1.0f / 12.0f ) * mass * (width * width + depth * depth );
} }
inline ::Oyster::Math::Float CalculateCuboidZ( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float width, const ::Oyster::Math::Float height ) inline ::Oyster::Math::Float CalculateCuboidZ( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float width, const ::Oyster::Math::Float height )
{ {
return (1.0f/12.0f)*mass*(height*height + width*width); return ::Utility::Value::Radian( 1.0f / 12.0f ) * mass * (height * height + width * width );
} }
inline ::Oyster::Math::Float4x4 Cuboid( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float width, const ::Oyster::Math::Float depth ) inline ::Oyster::Math::Float4x4 Cuboid( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float width, const ::Oyster::Math::Float depth )
@ -333,7 +333,7 @@ namespace Oyster { namespace Physics3D
inline ::Oyster::Math::Float CalculateRodCenter( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float length ) inline ::Oyster::Math::Float CalculateRodCenter( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float length )
{ {
return (1.0f/12.0f)*mass*(length*length); return ::Utility::Value::Radian( 1.0f / 12.0f ) * mass * length * length;
} }
inline ::Oyster::Math::Float4x4 RodCenter( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float length ) inline ::Oyster::Math::Float4x4 RodCenter( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float length )
@ -348,12 +348,12 @@ namespace Oyster { namespace Physics3D
inline ::Oyster::Math::Float CalculateCylinderXY( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float radius ) inline ::Oyster::Math::Float CalculateCylinderXY( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float radius )
{ {
return (1.0f/12.0f)*mass*(3.0f*radius*radius + height*height); return ::Utility::Value::Radian( 1.0f / 12.0f ) * mass * ( 3.0f * radius * radius + height * height );
} }
inline ::Oyster::Math::Float CalculateCylinderZ( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius ) inline ::Oyster::Math::Float CalculateCylinderZ( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius )
{ {
return 0.5f*mass*(radius*radius); return ::Utility::Value::Radian( 0.5f ) * mass * ( radius * radius );
} }
inline ::Oyster::Math::Float4x4 Cylinder( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float radius ) inline ::Oyster::Math::Float4x4 Cylinder( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float radius )