Add the constants.h file
git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@407 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
6b4e5c0fa2
commit
7762d3daca
|
@ -22,11 +22,34 @@
|
||||||
* THE SOFTWARE. *
|
* THE SOFTWARE. *
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#ifndef TYPEDEFINITIONS_H
|
#ifndef CONSTANTS_H
|
||||||
#define TYPEDEFINITIONS_H
|
#define CONSTANTS_H
|
||||||
|
|
||||||
|
// Libraries
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
// Type definitions
|
// Type definitions
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
|
|
||||||
|
// Mathematical constants
|
||||||
|
const double EPSILON = 0.00001; // Epsilon value to avoid numerical errors
|
||||||
|
const double ONE_MINUS_EPSILON = 0.99999; // 1 - espilon
|
||||||
|
const double INFINITY_CONST = std::numeric_limits<double>::infinity(); // Infinity constant
|
||||||
|
const double PI = 3.14159265; // Pi constant
|
||||||
|
|
||||||
|
// Contact constants
|
||||||
|
const double FRICTION_COEFFICIENT = 0.4; // Friction coefficient
|
||||||
|
const double PENETRATION_FACTOR = 0.2; // Penetration factor (between 0 and 1) which specify the importance of the
|
||||||
|
// penetration depth in order to calculate the correct impulse for the contact
|
||||||
|
|
||||||
|
// Constraint solver constants
|
||||||
|
const uint MAX_LCP_ITERATIONS = 10; // Maximum number of iterations when solving a LCP problem
|
||||||
|
const double AV_COUNTER_LIMIT = 500; // Maximum number value of the avBodiesCounter or avConstraintsCounter
|
||||||
|
const double AV_PERCENT_TO_FREE = 0.5; // We will free the memory if the current nb of bodies (or constraints) is
|
||||||
|
// less than AV_PERCENT_TO_FREE * bodiesCapacity (or constraintsCapacity). This
|
||||||
|
// is used to avoid to keep to much memory for a long time if the system doesn't
|
||||||
|
// need that memory. This value is between 0.0 and 1.0
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
#define CONTACT_H
|
#define CONTACT_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "../typeDefinitions.h"
|
|
||||||
#include "Constraint.h"
|
#include "Constraint.h"
|
||||||
#include "../body/RigidBody.h"
|
#include "../body/RigidBody.h"
|
||||||
|
#include "../constants.h"
|
||||||
#include "../mathematics/mathematics.h"
|
#include "../mathematics/mathematics.h"
|
||||||
#include <GL/freeglut.h> // TODO : Remove this in the final version
|
#include <GL/freeglut.h> // TODO : Remove this in the final version
|
||||||
#include <GL/gl.h> // TODO : Remove this in the final version
|
#include <GL/gl.h> // TODO : Remove this in the final version
|
||||||
|
@ -36,11 +36,6 @@
|
||||||
// ReactPhysics3D namespace
|
// ReactPhysics3D namespace
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
||||||
// Constants
|
|
||||||
const double FRICTION_COEFFICIENT = 0.3; // Friction coefficient
|
|
||||||
const double PENETRATION_FACTOR = 0.0; // Penetration factor (between 0 and 1) which specify the importance of the
|
|
||||||
// penetration depth in order to calculate the correct impulse for the contact
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------
|
/* -------------------------------------------------------------------
|
||||||
Class Contact :
|
Class Contact :
|
||||||
This class represents a collision contact between two bodies in
|
This class represents a collision contact between two bodies in
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#define CONSTRAINTSOLVER_H
|
#define CONSTRAINTSOLVER_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "../typeDefinitions.h"
|
#include "../constants.h"
|
||||||
#include "../constraint/Constraint.h"
|
#include "../constraint/Constraint.h"
|
||||||
#include "../mathematics/lcp/LCPSolver.h"
|
#include "../mathematics/lcp/LCPSolver.h"
|
||||||
#include "ContactCache.h"
|
#include "ContactCache.h"
|
||||||
|
@ -37,14 +37,6 @@
|
||||||
// ReactPhysics3D namespace
|
// ReactPhysics3D namespace
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
||||||
// Constants
|
|
||||||
const uint MAX_LCP_ITERATIONS = 10; // Maximum number of iterations when solving a LCP problem
|
|
||||||
const double AV_COUNTER_LIMIT = 500; // Maximum number value of the avBodiesCounter or avConstraintsCounter
|
|
||||||
const double AV_PERCENT_TO_FREE = 0.5; // We will free the memory if the current nb of bodies (or constraints) is
|
|
||||||
// less than AV_PERCENT_TO_FREE * bodiesCapacity (or constraintsCapacity). This
|
|
||||||
// is used to avoid to keep to much memory for a long time if the system doesn't
|
|
||||||
// need that memory. This value is between 0.0 and 1.0
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------
|
/* -------------------------------------------------------------------
|
||||||
Class ConstrainSolver :
|
Class ConstrainSolver :
|
||||||
This class represents the constraint solver. The goal is to
|
This class represents the constraint solver. The goal is to
|
||||||
|
|
|
@ -99,7 +99,6 @@ Matrix::Matrix(const Matrix3x3& matrix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Conversion from Vector to Matrix
|
// Conversion from Vector to Matrix
|
||||||
Matrix::Matrix(const Vector& vector) {
|
Matrix::Matrix(const Vector& vector) {
|
||||||
// Create the two dimensional dynamic array
|
// Create the two dimensional dynamic array
|
||||||
|
@ -112,59 +111,6 @@ Matrix::Matrix(const Vector& vector) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Delete this
|
|
||||||
Matrix::Matrix(const Matrix6x6& matrix) : nbRow(6), nbColumn(6) {
|
|
||||||
// Create the two dimensional dynamic array
|
|
||||||
array = new double*[nbRow];
|
|
||||||
|
|
||||||
assert(array != 0); // Array pointer musn't be null
|
|
||||||
|
|
||||||
for(int i=0; i<nbRow; ++i) {
|
|
||||||
array[i] = new double[nbColumn];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy the matrix
|
|
||||||
for (int i=0; i<nbRow; ++i) {
|
|
||||||
for(int j=0; j<nbColumn; ++j) {
|
|
||||||
setValue(i,j, matrix.getValue(i,j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO : Delete this
|
|
||||||
Matrix::Matrix(const Matrix1x6& matrix) : nbRow(1), nbColumn(6) {
|
|
||||||
// Create the two dimensional dynamic array
|
|
||||||
array = new double*[nbRow];
|
|
||||||
|
|
||||||
assert(array != 0); // Array pointer musn't be null
|
|
||||||
|
|
||||||
for(int i=0; i<nbRow; ++i) {
|
|
||||||
array[i] = new double[nbColumn];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy the matrix
|
|
||||||
for(int j=0; j<nbColumn; ++j) {
|
|
||||||
setValue(0,j, matrix.getValue(j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO : Delete this
|
|
||||||
Matrix::Matrix(const Vector6D& vector) :nbRow(6), nbColumn(1) {
|
|
||||||
// Create the two dimensional dynamic array
|
|
||||||
array = new double*[nbRow];
|
|
||||||
|
|
||||||
assert(array != 0); // Array pointer musn't be null
|
|
||||||
|
|
||||||
for(int i=0; i<nbRow; ++i) {
|
|
||||||
array[i] = new double[nbColumn];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy the matrix
|
|
||||||
for(int j=0; j<nbRow; ++j) {
|
|
||||||
setValue(j,0, vector.getValue(j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Destructor of the class Matrix
|
// Destructor of the class Matrix
|
||||||
Matrix::~Matrix() {
|
Matrix::~Matrix() {
|
||||||
// Destruction of the dynamic array
|
// Destruction of the dynamic array
|
||||||
|
|
|
@ -57,9 +57,6 @@ class Matrix {
|
||||||
Matrix(const Matrix& matrix); // Copy constructor of the class Matrix
|
Matrix(const Matrix& matrix); // Copy constructor of the class Matrix
|
||||||
Matrix(const Matrix3x3& matrix); // Conversion from Matrix3x3
|
Matrix(const Matrix3x3& matrix); // Conversion from Matrix3x3
|
||||||
Matrix(const Vector& vector); // Conversion from Vector to Matrix
|
Matrix(const Vector& vector); // Conversion from Vector to Matrix
|
||||||
Matrix(const Matrix6x6& matrix);
|
|
||||||
Matrix(const Matrix1x6& matrix);
|
|
||||||
Matrix(const Vector6D& vector);
|
|
||||||
virtual ~Matrix(); // Destructor of the class Matrix
|
virtual ~Matrix(); // Destructor of the class Matrix
|
||||||
double getValue(int i, int j) const throw(std::invalid_argument); // Return a value in the matrix
|
double getValue(int i, int j) const throw(std::invalid_argument); // Return a value in the matrix
|
||||||
void setValue(int i, int j, double value) throw(std::invalid_argument); // Set a value in the matrix
|
void setValue(int i, int j, double value) throw(std::invalid_argument); // Set a value in the matrix
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "Vector3D.h"
|
#include "Vector3D.h"
|
||||||
#include "../typeDefinitions.h"
|
#include "../constants.h"
|
||||||
#include "mathematics_functions.h"
|
#include "mathematics_functions.h"
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
|
@ -26,12 +26,6 @@
|
||||||
#define CONSTANTS_H
|
#define CONSTANTS_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
// Constants
|
|
||||||
const double EPSILON = 0.00001;
|
|
||||||
const double ONE_MINUS_EPSILON = 0.99999;
|
|
||||||
const double INFINITY_CONST = std::numeric_limits<double>::infinity();
|
|
||||||
const double PI = 3.14159265; // Pi constant
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "../Vector.h"
|
#include "../Vector.h"
|
||||||
#include "../Matrix.h"
|
#include "../Matrix.h"
|
||||||
#include "../../body/Body.h"
|
#include "../../body/Body.h"
|
||||||
#include "../../typeDefinitions.h"
|
#include "../../constants.h"
|
||||||
|
|
||||||
// ReactPhysics3D namespace
|
// ReactPhysics3D namespace
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "Quaternion.h"
|
#include "Quaternion.h"
|
||||||
#include "Vector.h"
|
#include "Vector.h"
|
||||||
#include "Vector3D.h"
|
#include "Vector3D.h"
|
||||||
#include "constants.h"
|
#include "../constants.h"
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#include "mathematics_functions.h"
|
#include "mathematics_functions.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#define MATHEMATICS_FUNCTIONS_H
|
#define MATHEMATICS_FUNCTIONS_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "constants.h"
|
#include "../constants.h"
|
||||||
|
|
||||||
// ReactPhysics3D namespace
|
// ReactPhysics3D namespace
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user