changes in the code structure

git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@433 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
chappuis.daniel 2011-07-10 17:56:00 +00:00
parent a04db140bf
commit 0de337cfe5
15 changed files with 22 additions and 75 deletions

View File

@ -24,7 +24,7 @@
// Libraries
#include "Body.h"
#include "Shape.h"
#include "../shapes/Shape.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -29,8 +29,8 @@
#include <stdexcept>
#include <cassert>
#include "../mathematics/Transform.h"
#include "../body/AABB.h"
#include "../body/Shape.h"
#include "../shapes/AABB.h"
#include "../shapes/Shape.h"
// Namespace reactphysics3d
namespace reactphysics3d {

View File

@ -24,7 +24,7 @@
// Libraries
#include "RigidBody.h"
#include "Shape.h"
#include "../shapes/Shape.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -28,7 +28,7 @@
// Libraries
#include <cassert>
#include "Body.h"
#include "Shape.h"
#include "../shapes/Shape.h"
#include "../mathematics/mathematics.h"
// Namespace reactphysics3d

View File

@ -28,7 +28,7 @@
#include "GJK/GJKAlgorithm.h"
#include "SATAlgorithm.h"
#include "../body/Body.h"
#include "../body/BoxShape.h"
#include "../shapes/BoxShape.h"
#include "../body/RigidBody.h"
#include <cassert>
#include <complex>

View File

@ -26,7 +26,7 @@
#define CONTACT_INFO_H
// Libraries
#include "../body/BoxShape.h"
#include "../shapes/BoxShape.h"
#include "../mathematics/mathematics.h"
// ReactPhysics3D namespace

View File

@ -27,7 +27,7 @@
// Libraries
#include "../GJK/Simplex.h"
#include "../../body/Shape.h"
#include "../../shapes/Shape.h"
#include "../ContactInfo.h"
#include "../../mathematics/mathematics.h"
#include "TriangleEPA.h"

View File

@ -28,7 +28,7 @@
// Libraries
#include "../NarrowPhaseAlgorithm.h"
#include "../ContactInfo.h"
#include "../../body/Shape.h"
#include "../../shapes/Shape.h"
#include "../EPA/EPAAlgorithm.h"

View File

@ -27,7 +27,7 @@
// Libraries
#include "BroadPhaseAlgorithm.h"
#include "../body/AABB.h"
#include "../shapes/AABB.h"
// Namespace ReactPhysics3D
namespace reactphysics3d {

View File

@ -24,7 +24,7 @@
// Libraries
#include "SATAlgorithm.h"
#include "../body/BoxShape.h"
#include "../shapes/BoxShape.h"
#include "../body/RigidBody.h"
#include "../constraint/Contact.h"
#include "../mathematics/Transform.h"

View File

@ -28,7 +28,7 @@
// Libraries
#include "NarrowPhaseAlgorithm.h"
#include "../constraint/Contact.h"
#include "../body/BoxShape.h"
#include "../shapes/BoxShape.h"
#include "../mathematics/Transform.h"
// ReactPhysics3D namespace

View File

@ -26,7 +26,7 @@
#define CONTACT_CACHING_INFO_H
// Libraries
#include "../body/BoxShape.h"
#include "../shapes/BoxShape.h"
// ReactPhysics3D namespace
namespace reactphysics3d {

View File

@ -38,16 +38,15 @@
#include "body/RigidBody.h"
#include "engine/PhysicsWorld.h"
#include "engine/PhysicsEngine.h"
#include "body/Shape.h"
#include "body/BoxShape.h"
#include "body/SphereShape.h"
#include "body/AABB.h"
#include "shapes/Shape.h"
#include "shapes/BoxShape.h"
#include "shapes/SphereShape.h"
#include "shapes/ConeShape.h"
#include "shapes/AABB.h"
// Alias to the ReactPhysics3D namespace
namespace rp3d = reactphysics3d;
// TODO : Use using namespace std in every possible cpp files to increase readability
#endif

View File

@ -38,70 +38,18 @@ namespace reactphysics3d {
-------------------------------------------------------------------
*/
class ConeShape : public Shape {
protected :
Vector3D center; // Center point of the sphere
double radius; // Radius of the sphere
private :
public :
ConeShape(const Vector3D& center, double radius); // Constructor
virtual ~ConeShape(); // Destructor
ConeShape(); // Constructor
virtual ~ConeShape(); // Destructor
Vector3D getCenter() const; // Return the center point of the sphere
void setCenter(const Vector3D& center); // Set the center point of the sphere
double getRadius() const; // Return the radius of the sphere
void setRadius(double radius); // Set the radius of the sphere
virtual void update(const Vector3D& newCenter,
const Quaternion& rotationQuaternion); // Update the sphere orientation according to a new orientation of the rigid body
virtual AABB* computeAABB() const; // Return the corresponding AABB
virtual Vector3D getSupportPoint(const Vector3D& direction, double margin=0.0) const; // Return a support point in a given direction
#ifdef VISUAL_DEBUG
virtual void draw() const; // Draw the sphere (only for testing purpose)
#endif
};
// Return the center point of the sphere
inline Vector3D SphereShape::getCenter() const {
return center;
}
// Set the center point of the sphere
inline void SphereShape::setCenter(const Vector3D& center) {
this->center = center;
}
// Get the radius of the sphere
inline double SphereShape::getRadius() const {
return radius;
}
// Set the radius of the sphere
inline void SphereShape::setRadius(double radius) {
this->radius = radius;
}
// Update the orientation of the shere according to the orientation of the rigid body
inline void SphereShape::update(const Vector3D& newCenter, const Quaternion& rotationQuaternion) {
// Update the center of the sphere
center = newCenter;
}
// Return a support point in a given direction
inline Vector3D SphereShape::getSupportPoint(const Vector3D& direction, double margin) const {
assert(margin >= 0.0);
double length = direction.length();
// If the direction vector is not the zero vector
if (length > EPSILON) {
// Return the support point of the sphere in the given direction
return center + (radius + margin) * direction.getUnit();
}
// If the direction vector is the zero vector we return a point on the
// boundary of the sphere
return center + Vector3D(radius + margin, 0.0, 0.0);
}
}; // End of the ReactPhysics3D namespace
#endif

View File

@ -38,7 +38,7 @@ namespace reactphysics3d {
-------------------------------------------------------------------
*/
class SphereShape : public Shape {
protected :
private :
Vector3D center; // Center point of the sphere
double radius; // Radius of the sphere