git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@80 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
a3c550f572
commit
118c03fa8b
|
@ -20,20 +20,24 @@
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "Body.h"
|
#include "Body.h"
|
||||||
|
|
||||||
// We want to use the ReactPhysics3D namespace
|
// We want to use the ReactPhysics3D namespace
|
||||||
using namespace reactphysics3d;
|
using namespace reactphysics3d;
|
||||||
|
|
||||||
// Constructor
|
|
||||||
Body::Body(Kilogram mass) : mass(mass) {
|
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
Body::Body(Kilogram mass) throw(std::invalid_argument) : mass(mass) {
|
||||||
|
// Check if the mass is different from zero
|
||||||
|
if (mass.getValue() == 0) {
|
||||||
|
// We throw an exception
|
||||||
|
throw std::invalid_argument("Exception in Body constructor : the mass has to be different from zero");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Copy-constructor
|
// Copy-constructor
|
||||||
Body::Body(const Body& body) : mass(body.mass) {
|
Body::Body(const Body& body) : mass(body.mass) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
Body::~Body() {
|
Body::~Body() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,12 @@
|
||||||
* along with ReactPhysics3D. If not, see <http://www.gnu.org/licenses/>. *
|
* along with ReactPhysics3D. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef BODY_H
|
#ifndef BODY_H
|
||||||
#define BODY_H
|
#define BODY_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "../physics/physics.h"
|
#include <stdexcept>
|
||||||
|
#include "../physics/physics.h"
|
||||||
|
|
||||||
// Namespace reactphysics3d
|
// Namespace reactphysics3d
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
@ -37,7 +38,7 @@ class Body {
|
||||||
Kilogram mass; // Mass of the body
|
Kilogram mass; // Mass of the body
|
||||||
|
|
||||||
public :
|
public :
|
||||||
Body(Kilogram mass); // Constructor
|
Body(Kilogram mass) throw(std::invalid_argument); // Constructor
|
||||||
Body(const Body& body); // Copy-constructor
|
Body(const Body& body); // Copy-constructor
|
||||||
virtual ~Body(); // Destructor
|
virtual ~Body(); // Destructor
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user