From 19522d8ff65668fa953b1e17dad5caf885a9e1e1 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Wed, 13 Nov 2013 14:50:08 +0100 Subject: [PATCH] References in solution adjusted All references to ::Utility::Memory changed to ::Utility::DynamicMemory --- OysterPhysics3D/Box.cpp | 4 ++-- OysterPhysics3D/Box.h | 2 +- OysterPhysics3D/BoxAxisAligned.cpp | 4 ++-- OysterPhysics3D/BoxAxisAligned.h | 2 +- OysterPhysics3D/Frustrum.cpp | 4 ++-- OysterPhysics3D/Frustrum.h | 2 +- OysterPhysics3D/ICollideable.h | 2 +- OysterPhysics3D/Line.cpp | 4 ++-- OysterPhysics3D/Line.h | 2 +- OysterPhysics3D/OysterPhysics3D.h | 11 ++++++++++- OysterPhysics3D/Plane.cpp | 4 ++-- OysterPhysics3D/Plane.h | 2 +- OysterPhysics3D/Point.cpp | 4 ++-- OysterPhysics3D/Point.h | 2 +- OysterPhysics3D/Ray.cpp | 4 ++-- OysterPhysics3D/Ray.h | 2 +- OysterPhysics3D/RigidBody.h | 2 +- OysterPhysics3D/Sphere.cpp | 4 ++-- OysterPhysics3D/Sphere.h | 2 +- OysterPhysics3D/Universe.cpp | 2 +- OysterPhysics3D/Universe.h | 2 +- 21 files changed, 38 insertions(+), 29 deletions(-) diff --git a/OysterPhysics3D/Box.cpp b/OysterPhysics3D/Box.cpp index 9ba1bb28..a20b8195 100644 --- a/OysterPhysics3D/Box.cpp +++ b/OysterPhysics3D/Box.cpp @@ -19,8 +19,8 @@ Box & Box::operator = ( const Box &box ) return *this; } -::Utility::Memory::UniquePointer Box::Clone( ) const -{ return ::Utility::Memory::UniquePointer( new Box(*this) ); } +::Utility::DynamicMemory::UniquePointer Box::Clone( ) const +{ return ::Utility::DynamicMemory::UniquePointer( new Box(*this) ); } bool Box::Intersects( const ICollideable *target ) const { diff --git a/OysterPhysics3D/Box.h b/OysterPhysics3D/Box.h index be7b29ad..034639d0 100644 --- a/OysterPhysics3D/Box.h +++ b/OysterPhysics3D/Box.h @@ -33,7 +33,7 @@ namespace Oyster { namespace Collision3D Box & operator = ( const Box &box ); - virtual ::Utility::Memory::UniquePointer Clone( ) const; + virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable *target ) const; bool Contains( const ICollideable *target ) const; }; diff --git a/OysterPhysics3D/BoxAxisAligned.cpp b/OysterPhysics3D/BoxAxisAligned.cpp index b745646f..c782ed25 100644 --- a/OysterPhysics3D/BoxAxisAligned.cpp +++ b/OysterPhysics3D/BoxAxisAligned.cpp @@ -21,8 +21,8 @@ BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box ) return *this; } -::Utility::Memory::UniquePointer BoxAxisAligned::Clone( ) const -{ return ::Utility::Memory::UniquePointer( new BoxAxisAligned(*this) ); } +::Utility::DynamicMemory::UniquePointer BoxAxisAligned::Clone( ) const +{ return ::Utility::DynamicMemory::UniquePointer( new BoxAxisAligned(*this) ); } bool BoxAxisAligned::Intersects( const ICollideable *target ) const { diff --git a/OysterPhysics3D/BoxAxisAligned.h b/OysterPhysics3D/BoxAxisAligned.h index e3c91722..9810c39a 100644 --- a/OysterPhysics3D/BoxAxisAligned.h +++ b/OysterPhysics3D/BoxAxisAligned.h @@ -27,7 +27,7 @@ namespace Oyster { namespace Collision3D BoxAxisAligned & operator = ( const BoxAxisAligned &box ); - virtual ::Utility::Memory::UniquePointer Clone( ) const; + virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable *target ) const; bool Contains( const ICollideable *target ) const; }; diff --git a/OysterPhysics3D/Frustrum.cpp b/OysterPhysics3D/Frustrum.cpp index 837ba579..e4da0ce9 100644 --- a/OysterPhysics3D/Frustrum.cpp +++ b/OysterPhysics3D/Frustrum.cpp @@ -188,8 +188,8 @@ void Frustrum::WriteToByte( unsigned int &nextIndex, unsigned char targetMem[] ) nextIndex += 6 * ::Utility::StaticArray::NumElementsOf( this->plane[0].byte ); } -::Utility::Memory::UniquePointer Frustrum::Clone( ) const -{ return ::Utility::Memory::UniquePointer( new Frustrum(*this) ); } +::Utility::DynamicMemory::UniquePointer Frustrum::Clone( ) const +{ return ::Utility::DynamicMemory::UniquePointer( new Frustrum(*this) ); } bool Frustrum::Intersects( const ICollideable *target ) const { diff --git a/OysterPhysics3D/Frustrum.h b/OysterPhysics3D/Frustrum.h index a27a8f4a..c711c9af 100644 --- a/OysterPhysics3D/Frustrum.h +++ b/OysterPhysics3D/Frustrum.h @@ -37,7 +37,7 @@ namespace Oyster { namespace Collision3D void Split( Frustrum targetList[], unsigned int numX, unsigned int numY = 1U, unsigned int numZ = 1u ) const; /// DEPRECATED void WriteToByte( unsigned char targetMem[], unsigned int &nextIndex ) const; /// DEPRECATED - virtual ::Utility::Memory::UniquePointer Clone( ) const; + virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable *target ) const; bool Contains( const ICollideable *target ) const; }; diff --git a/OysterPhysics3D/ICollideable.h b/OysterPhysics3D/ICollideable.h index b2a74aed..aa6c7891 100644 --- a/OysterPhysics3D/ICollideable.h +++ b/OysterPhysics3D/ICollideable.h @@ -33,7 +33,7 @@ namespace Oyster { namespace Collision3D /// Contains a collection of 3D shapes ICollideable( Type type = Type_undefined ); virtual ~ICollideable(); - virtual ::Utility::Memory::UniquePointer Clone( ) const = 0; + virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const = 0; virtual bool Intersects( const ICollideable *target ) const = 0; virtual bool Contains( const ICollideable *target ) const = 0; }; diff --git a/OysterPhysics3D/Line.cpp b/OysterPhysics3D/Line.cpp index 2afa69d8..7093f6b2 100644 --- a/OysterPhysics3D/Line.cpp +++ b/OysterPhysics3D/Line.cpp @@ -20,8 +20,8 @@ Line & Line::operator = ( const Line &line ) return *this; } -::Utility::Memory::UniquePointer Line::Clone( ) const -{ return ::Utility::Memory::UniquePointer( new Line(*this) ); } +::Utility::DynamicMemory::UniquePointer Line::Clone( ) const +{ return ::Utility::DynamicMemory::UniquePointer( new Line(*this) ); } bool Line::Intersects( const ICollideable *target ) const { diff --git a/OysterPhysics3D/Line.h b/OysterPhysics3D/Line.h index b23ff58f..fecc0bd2 100644 --- a/OysterPhysics3D/Line.h +++ b/OysterPhysics3D/Line.h @@ -28,7 +28,7 @@ namespace Oyster { namespace Collision3D Line & operator = ( const Line &line ); - virtual ::Utility::Memory::UniquePointer Clone( ) const; + virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable *target ) const; bool Contains( const ICollideable *target ) const; }; diff --git a/OysterPhysics3D/OysterPhysics3D.h b/OysterPhysics3D/OysterPhysics3D.h index e31aa17b..a5d58c0b 100644 --- a/OysterPhysics3D/OysterPhysics3D.h +++ b/OysterPhysics3D/OysterPhysics3D.h @@ -57,6 +57,15 @@ namespace Oyster { namespace Physics3D return ( momentOfInertia * ::Oyster::Math::Float4(angularVelocity, 0.0f) ).xyz; } + /****************************************************************** + * Returns the local angular momentum of a mass in rotation. + * @todo TODO: improve doc + ******************************************************************/ + inline ::Oyster::Math::Float3 AngularMomentum( const ::Oyster::Math::Float3 linearMomentum, const ::Oyster::Math::Float3 &offset ) + { + return offset.Cross( linearMomentum ); + } + /****************************************************************** * Returns the local tangential momentum at localPos, of a mass in rotation. * @todo TODO: improve doc @@ -160,7 +169,7 @@ namespace Oyster { namespace Physics3D * * @todo TODO: improve doc ******************************************************************/ - inline ::Oyster::Math::Float3 ImpulseTorque( const ::Oyster::Math::Float3 & offset, const ::Oyster::Math::Float3 &impulseForce ) + inline ::Oyster::Math::Float3 ImpulseTorque( const ::Oyster::Math::Float3 & impulseForce, const ::Oyster::Math::Float3 &offset ) { return offset.Cross( impulseForce ); } diff --git a/OysterPhysics3D/Plane.cpp b/OysterPhysics3D/Plane.cpp index 3c89975b..c999324b 100644 --- a/OysterPhysics3D/Plane.cpp +++ b/OysterPhysics3D/Plane.cpp @@ -19,8 +19,8 @@ Plane & Plane::operator = ( const Plane &plane ) return *this; } -::Utility::Memory::UniquePointer Plane::Clone( ) const -{ return ::Utility::Memory::UniquePointer( new Plane(*this) ); } +::Utility::DynamicMemory::UniquePointer Plane::Clone( ) const +{ return ::Utility::DynamicMemory::UniquePointer( new Plane(*this) ); } bool Plane::Intersects( const ICollideable *target ) const { diff --git a/OysterPhysics3D/Plane.h b/OysterPhysics3D/Plane.h index 570161fb..d44c92bd 100644 --- a/OysterPhysics3D/Plane.h +++ b/OysterPhysics3D/Plane.h @@ -27,7 +27,7 @@ namespace Oyster { namespace Collision3D Plane & operator = ( const Plane &plane ); - virtual ::Utility::Memory::UniquePointer Clone( ) const; + virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable *target ) const; bool Contains( const ICollideable *target ) const; }; diff --git a/OysterPhysics3D/Point.cpp b/OysterPhysics3D/Point.cpp index 562e7e98..39cc93af 100644 --- a/OysterPhysics3D/Point.cpp +++ b/OysterPhysics3D/Point.cpp @@ -18,8 +18,8 @@ Point & Point::operator = ( const Point &point ) return *this; } -::Utility::Memory::UniquePointer Point::Clone( ) const -{ return ::Utility::Memory::UniquePointer( new Point(*this) ); } +::Utility::DynamicMemory::UniquePointer Point::Clone( ) const +{ return ::Utility::DynamicMemory::UniquePointer( new Point(*this) ); } bool Point::Intersects( const ICollideable *target ) const { diff --git a/OysterPhysics3D/Point.h b/OysterPhysics3D/Point.h index d4ff655b..2529ae0c 100644 --- a/OysterPhysics3D/Point.h +++ b/OysterPhysics3D/Point.h @@ -26,7 +26,7 @@ namespace Oyster { namespace Collision3D Point & operator = ( const Point &point ); - virtual ::Utility::Memory::UniquePointer Clone( ) const; + virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable *target ) const; bool Contains( const ICollideable *target ) const; }; diff --git a/OysterPhysics3D/Ray.cpp b/OysterPhysics3D/Ray.cpp index 7675fad7..f7873437 100644 --- a/OysterPhysics3D/Ray.cpp +++ b/OysterPhysics3D/Ray.cpp @@ -19,8 +19,8 @@ Ray & Ray::operator = ( const Ray &ray ) return *this; } -::Utility::Memory::UniquePointer Ray::Clone( ) const -{ return ::Utility::Memory::UniquePointer( new Ray(*this) ); } +::Utility::DynamicMemory::UniquePointer Ray::Clone( ) const +{ return ::Utility::DynamicMemory::UniquePointer( new Ray(*this) ); } bool Ray::Intersects( const ICollideable *target ) const { diff --git a/OysterPhysics3D/Ray.h b/OysterPhysics3D/Ray.h index a5dced1c..4132c0b8 100644 --- a/OysterPhysics3D/Ray.h +++ b/OysterPhysics3D/Ray.h @@ -35,7 +35,7 @@ namespace Oyster { namespace Collision3D Ray & operator = ( const Ray &ray ); - virtual ::Utility::Memory::UniquePointer Clone( ) const; + virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable *target ) const; bool Contains( const ICollideable *target ) const; }; diff --git a/OysterPhysics3D/RigidBody.h b/OysterPhysics3D/RigidBody.h index bb0dcc7d..a2d32f95 100644 --- a/OysterPhysics3D/RigidBody.h +++ b/OysterPhysics3D/RigidBody.h @@ -96,7 +96,7 @@ namespace Oyster { namespace Physics3D void SetSize( const ::Oyster::Math::Float3 &widthHeight ); void SetCenter( const ::Oyster::Math::Float3 &p ); - void SetImpulsTorque( const ::Oyster::Math::Float3 &t ); + void SetImpulseTorque( const ::Oyster::Math::Float3 &t ); void SetAngularMomentum( const ::Oyster::Math::Float3 &h ); void SetAngularImpulseAcceleration( const ::Oyster::Math::Float3 &a ); void SetAngularVelocity( const ::Oyster::Math::Float3 &w ); diff --git a/OysterPhysics3D/Sphere.cpp b/OysterPhysics3D/Sphere.cpp index b0f14cf3..f138208c 100644 --- a/OysterPhysics3D/Sphere.cpp +++ b/OysterPhysics3D/Sphere.cpp @@ -15,8 +15,8 @@ Sphere & Sphere::operator = ( const Sphere &sphere ) return *this; } -::Utility::Memory::UniquePointer Sphere::Clone( ) const -{ return ::Utility::Memory::UniquePointer( new Sphere(*this) ); } +::Utility::DynamicMemory::UniquePointer Sphere::Clone( ) const +{ return ::Utility::DynamicMemory::UniquePointer( new Sphere(*this) ); } bool Sphere::Intersects( const ICollideable *target ) const { diff --git a/OysterPhysics3D/Sphere.h b/OysterPhysics3D/Sphere.h index 9d8c4c8f..881c8928 100644 --- a/OysterPhysics3D/Sphere.h +++ b/OysterPhysics3D/Sphere.h @@ -26,7 +26,7 @@ namespace Oyster { namespace Collision3D Sphere & operator = ( const Sphere &sphere ); - virtual ::Utility::Memory::UniquePointer Clone( ) const; + virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable *target ) const; bool Contains( const ICollideable *target ) const; }; diff --git a/OysterPhysics3D/Universe.cpp b/OysterPhysics3D/Universe.cpp index ee02144b..f473ff2c 100644 --- a/OysterPhysics3D/Universe.cpp +++ b/OysterPhysics3D/Universe.cpp @@ -2,7 +2,7 @@ #include "OysterCollision3D.h" using namespace ::Oyster::Collision3D; -using namespace ::Utility::Memory; +using namespace ::Utility::DynamicMemory; Universe::Universe() : ICollideable(Type_universe) {} Universe::~Universe() {} diff --git a/OysterPhysics3D/Universe.h b/OysterPhysics3D/Universe.h index 74b93108..fd06a454 100644 --- a/OysterPhysics3D/Universe.h +++ b/OysterPhysics3D/Universe.h @@ -18,7 +18,7 @@ namespace Oyster { namespace Collision3D Universe & operator = ( const Universe &universe ); - virtual ::Utility::Memory::UniquePointer Clone( ) const; + virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable *target ) const; bool Contains( const ICollideable *target ) const; };