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
|
||||
#include "Body.h"
|
||||
|
||||
// We want to use the ReactPhysics3D namespace
|
||||
using namespace reactphysics3d;
|
||||
// We want to use the ReactPhysics3D namespace
|
||||
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
|
||||
Body::Body(const Body& body) : mass(body.mass) {
|
||||
|
||||
// Copy-constructor
|
||||
Body::Body(const Body& body) : mass(body.mass) {
|
||||
}
|
||||
|
||||
}
|
||||
// Destructor
|
||||
Body::~Body() {
|
||||
|
||||
// Destructor
|
||||
Body::~Body() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
* along with ReactPhysics3D. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef BODY_H
|
||||
#define BODY_H
|
||||
#ifndef BODY_H
|
||||
#define BODY_H
|
||||
|
||||
// Libraries
|
||||
#include "../physics/physics.h"
|
||||
#include <stdexcept>
|
||||
#include "../physics/physics.h"
|
||||
|
||||
// Namespace reactphysics3d
|
||||
namespace reactphysics3d {
|
||||
|
@ -37,9 +38,9 @@ class Body {
|
|||
Kilogram mass; // Mass of the body
|
||||
|
||||
public :
|
||||
Body(Kilogram mass); // Constructor
|
||||
Body(const Body& body); // Copy-constructor
|
||||
virtual ~Body(); // Destructor
|
||||
Body(Kilogram mass) throw(std::invalid_argument); // Constructor
|
||||
Body(const Body& body); // Copy-constructor
|
||||
virtual ~Body(); // Destructor
|
||||
|
||||
Kilogram getMass(); // Return the mass of the body
|
||||
void setMass(Kilogram mass); // Set the mass of the body
|
||||
|
|
Loading…
Reference in New Issue
Block a user