git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@161 92aac97c-a6ce-11dd-a772-7fcde58d38e6

This commit is contained in:
chappuis.daniel 2009-07-03 12:17:18 +00:00
parent 6089f8ef4b
commit 04e9964ae8
4 changed files with 189 additions and 0 deletions

View File

@ -0,0 +1,35 @@
/****************************************************************************
* Copyright (C) 2009 Daniel Chappuis *
****************************************************************************
* This file is part of ReactPhysics3D. *
* *
* ReactPhysics3D is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* ReactPhysics3D is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with ReactPhysics3D. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
// Libraries
#include "Constraint.h"
// We want ot use the ReactPhysics3D namespace
using namespace reactphysics3d;
// Constructor
Constraint::Constraint(Body& body1, Body& body2)
:body1(body1), body2(body2) {
}
// Destructor
Constraint::~Constraint() {
}

View File

@ -0,0 +1,61 @@
/****************************************************************************
* Copyright (C) 2009 Daniel Chappuis *
****************************************************************************
* This file is part of ReactPhysics3D. *
* *
* ReactPhysics3D is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* ReactPhysics3D is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with ReactPhysics3D. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef CONSTRAINT_H
#define CONSTRAINT_H
// Libraries
#include "../body/Body.h"
// ReactPhysics3D namespace
namespace reactphysics3d {
/* -------------------------------------------------------------------
Class Constraint :
This class represents a constraint in the physics engine.
A constraint can be a collision contact or a joint for
instance.
-------------------------------------------------------------------
*/
class Constraint {
private :
Body& body1; // Reference to the first body of the constraint
Body& body2; // Reference to the second body of the constraint
public :
Constraint(Body& body1, Body& body2); // Constructor
virtual ~Constraint(); // Destructor
Body& getBody1() const; // Return the reference to the body 1
Body& getBody2() const; // Return the reference to the body 2
};
// Return the reference to the body 1
inline Body& Constraint::getBody1() const {
return body1;
}
// Return the reference to the body 2
inline Body& Constraint::getBody2() const {
return body2;
}
} // End of the ReactPhysics3D namespace
#endif

View File

@ -0,0 +1,35 @@
/****************************************************************************
* Copyright (C) 2009 Daniel Chappuis *
****************************************************************************
* This file is part of ReactPhysics3D. *
* *
* ReactPhysics3D is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* ReactPhysics3D is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with ReactPhysics3D. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
// Libraries
#include "Contact.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;
// Constructor
Contact::Contact(Body& body1, Body& body2, const Vector3D& normalVector)
:Constraint(body1, body2), normalVector(normalVector) {
}
// Destructor
Contact::~Contact() {
}

View File

@ -0,0 +1,58 @@
/****************************************************************************
* Copyright (C) 2009 Daniel Chappuis *
****************************************************************************
* This file is part of ReactPhysics3D. *
* *
* ReactPhysics3D is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* ReactPhysics3D is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with ReactPhysics3D. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef CONTACT_H
#define CONTACT_H
// Libraries
#include "Constraint.h"
#include "../mathematics/mathematics.h"
// ReactPhysics3D namespace
namespace reactphysics3d {
/* -------------------------------------------------------------------
Class Contact :
This class represents a collision contact between two bodies in
the physics engine. The contact class inherits from the
Constraint class. The collision detection systems compute
contact informations that will be used to perform the collision
response.
-------------------------------------------------------------------
*/
class Contact : public Constraint {
private :
Vector3D normalVector; // Normal vector of the contact
public :
Contact(Body& body1, Body& body2, const Vector3D& normalVector); // Constructor
virtual ~Contact(); // Destructor
Vector3D getNormalVector() const; // Return the normal vector of the contact
};
// Return the normal vector of the contact
inline Vector3D Contact::getNormalVector() const {
return normalVector;
}
} // End of the ReactPhysics3D namespace
#endif