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:
parent
a04db140bf
commit
0de337cfe5
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "Body.h"
|
#include "Body.h"
|
||||||
#include "Shape.h"
|
#include "../shapes/Shape.h"
|
||||||
|
|
||||||
// We want to use the ReactPhysics3D namespace
|
// We want to use the ReactPhysics3D namespace
|
||||||
using namespace reactphysics3d;
|
using namespace reactphysics3d;
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include "../mathematics/Transform.h"
|
#include "../mathematics/Transform.h"
|
||||||
#include "../body/AABB.h"
|
#include "../shapes/AABB.h"
|
||||||
#include "../body/Shape.h"
|
#include "../shapes/Shape.h"
|
||||||
|
|
||||||
// Namespace reactphysics3d
|
// Namespace reactphysics3d
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "RigidBody.h"
|
#include "RigidBody.h"
|
||||||
#include "Shape.h"
|
#include "../shapes/Shape.h"
|
||||||
|
|
||||||
// We want to use the ReactPhysics3D namespace
|
// We want to use the ReactPhysics3D namespace
|
||||||
using namespace reactphysics3d;
|
using namespace reactphysics3d;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
// Libraries
|
// Libraries
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include "Body.h"
|
#include "Body.h"
|
||||||
#include "Shape.h"
|
#include "../shapes/Shape.h"
|
||||||
#include "../mathematics/mathematics.h"
|
#include "../mathematics/mathematics.h"
|
||||||
|
|
||||||
// Namespace reactphysics3d
|
// Namespace reactphysics3d
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "GJK/GJKAlgorithm.h"
|
#include "GJK/GJKAlgorithm.h"
|
||||||
#include "SATAlgorithm.h"
|
#include "SATAlgorithm.h"
|
||||||
#include "../body/Body.h"
|
#include "../body/Body.h"
|
||||||
#include "../body/BoxShape.h"
|
#include "../shapes/BoxShape.h"
|
||||||
#include "../body/RigidBody.h"
|
#include "../body/RigidBody.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#define CONTACT_INFO_H
|
#define CONTACT_INFO_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "../body/BoxShape.h"
|
#include "../shapes/BoxShape.h"
|
||||||
#include "../mathematics/mathematics.h"
|
#include "../mathematics/mathematics.h"
|
||||||
|
|
||||||
// ReactPhysics3D namespace
|
// ReactPhysics3D namespace
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "../GJK/Simplex.h"
|
#include "../GJK/Simplex.h"
|
||||||
#include "../../body/Shape.h"
|
#include "../../shapes/Shape.h"
|
||||||
#include "../ContactInfo.h"
|
#include "../ContactInfo.h"
|
||||||
#include "../../mathematics/mathematics.h"
|
#include "../../mathematics/mathematics.h"
|
||||||
#include "TriangleEPA.h"
|
#include "TriangleEPA.h"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "../NarrowPhaseAlgorithm.h"
|
#include "../NarrowPhaseAlgorithm.h"
|
||||||
#include "../ContactInfo.h"
|
#include "../ContactInfo.h"
|
||||||
#include "../../body/Shape.h"
|
#include "../../shapes/Shape.h"
|
||||||
#include "../EPA/EPAAlgorithm.h"
|
#include "../EPA/EPAAlgorithm.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "BroadPhaseAlgorithm.h"
|
#include "BroadPhaseAlgorithm.h"
|
||||||
#include "../body/AABB.h"
|
#include "../shapes/AABB.h"
|
||||||
|
|
||||||
// Namespace ReactPhysics3D
|
// Namespace ReactPhysics3D
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "SATAlgorithm.h"
|
#include "SATAlgorithm.h"
|
||||||
#include "../body/BoxShape.h"
|
#include "../shapes/BoxShape.h"
|
||||||
#include "../body/RigidBody.h"
|
#include "../body/RigidBody.h"
|
||||||
#include "../constraint/Contact.h"
|
#include "../constraint/Contact.h"
|
||||||
#include "../mathematics/Transform.h"
|
#include "../mathematics/Transform.h"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "NarrowPhaseAlgorithm.h"
|
#include "NarrowPhaseAlgorithm.h"
|
||||||
#include "../constraint/Contact.h"
|
#include "../constraint/Contact.h"
|
||||||
#include "../body/BoxShape.h"
|
#include "../shapes/BoxShape.h"
|
||||||
#include "../mathematics/Transform.h"
|
#include "../mathematics/Transform.h"
|
||||||
|
|
||||||
// ReactPhysics3D namespace
|
// ReactPhysics3D namespace
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#define CONTACT_CACHING_INFO_H
|
#define CONTACT_CACHING_INFO_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "../body/BoxShape.h"
|
#include "../shapes/BoxShape.h"
|
||||||
|
|
||||||
// ReactPhysics3D namespace
|
// ReactPhysics3D namespace
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
|
@ -38,16 +38,15 @@
|
||||||
#include "body/RigidBody.h"
|
#include "body/RigidBody.h"
|
||||||
#include "engine/PhysicsWorld.h"
|
#include "engine/PhysicsWorld.h"
|
||||||
#include "engine/PhysicsEngine.h"
|
#include "engine/PhysicsEngine.h"
|
||||||
#include "body/Shape.h"
|
#include "shapes/Shape.h"
|
||||||
#include "body/BoxShape.h"
|
#include "shapes/BoxShape.h"
|
||||||
#include "body/SphereShape.h"
|
#include "shapes/SphereShape.h"
|
||||||
#include "body/AABB.h"
|
#include "shapes/ConeShape.h"
|
||||||
|
#include "shapes/AABB.h"
|
||||||
|
|
||||||
// Alias to the ReactPhysics3D namespace
|
// Alias to the ReactPhysics3D namespace
|
||||||
namespace rp3d = reactphysics3d;
|
namespace rp3d = reactphysics3d;
|
||||||
|
|
||||||
// TODO : Use using namespace std in every possible cpp files to increase readability
|
// TODO : Use using namespace std in every possible cpp files to increase readability
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,70 +38,18 @@ namespace reactphysics3d {
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
class ConeShape : public Shape {
|
class ConeShape : public Shape {
|
||||||
protected :
|
private :
|
||||||
Vector3D center; // Center point of the sphere
|
|
||||||
double radius; // Radius of the sphere
|
|
||||||
|
|
||||||
public :
|
public :
|
||||||
ConeShape(const Vector3D& center, double radius); // Constructor
|
ConeShape(); // Constructor
|
||||||
virtual ~ConeShape(); // Destructor
|
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
|
#ifdef VISUAL_DEBUG
|
||||||
virtual void draw() const; // Draw the sphere (only for testing purpose)
|
virtual void draw() const; // Draw the sphere (only for testing purpose)
|
||||||
#endif
|
#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
|
}; // End of the ReactPhysics3D namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -38,7 +38,7 @@ namespace reactphysics3d {
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
class SphereShape : public Shape {
|
class SphereShape : public Shape {
|
||||||
protected :
|
private :
|
||||||
Vector3D center; // Center point of the sphere
|
Vector3D center; // Center point of the sphere
|
||||||
double radius; // Radius of the sphere
|
double radius; // Radius of the sphere
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user