diff --git a/src/typeDefinitions.h b/src/constants.h similarity index 55% rename from src/typeDefinitions.h rename to src/constants.h index 1e956970..d097d9b1 100644 --- a/src/typeDefinitions.h +++ b/src/constants.h @@ -22,11 +22,34 @@ * THE SOFTWARE. * ********************************************************************************/ -#ifndef TYPEDEFINITIONS_H -#define TYPEDEFINITIONS_H +#ifndef CONSTANTS_H +#define CONSTANTS_H + +// Libraries +#include // Type definitions 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::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 diff --git a/src/constraint/Contact.h b/src/constraint/Contact.h index 569e9a55..4d0d7de4 100644 --- a/src/constraint/Contact.h +++ b/src/constraint/Contact.h @@ -26,9 +26,9 @@ #define CONTACT_H // Libraries -#include "../typeDefinitions.h" #include "Constraint.h" #include "../body/RigidBody.h" +#include "../constants.h" #include "../mathematics/mathematics.h" #include // TODO : Remove this in the final version #include // TODO : Remove this in the final version @@ -36,11 +36,6 @@ // ReactPhysics3D namespace 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 : This class represents a collision contact between two bodies in diff --git a/src/engine/ConstraintSolver.h b/src/engine/ConstraintSolver.h index e7d5760f..b4489516 100644 --- a/src/engine/ConstraintSolver.h +++ b/src/engine/ConstraintSolver.h @@ -26,7 +26,7 @@ #define CONSTRAINTSOLVER_H // Libraries -#include "../typeDefinitions.h" +#include "../constants.h" #include "../constraint/Constraint.h" #include "../mathematics/lcp/LCPSolver.h" #include "ContactCache.h" @@ -37,14 +37,6 @@ // ReactPhysics3D namespace 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 : This class represents the constraint solver. The goal is to diff --git a/src/mathematics/Matrix.cpp b/src/mathematics/Matrix.cpp index 2eb4a49c..4aa15b46 100644 --- a/src/mathematics/Matrix.cpp +++ b/src/mathematics/Matrix.cpp @@ -99,7 +99,6 @@ Matrix::Matrix(const Matrix3x3& matrix) } } - // Conversion from Vector to Matrix Matrix::Matrix(const Vector& vector) { // 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 diff --git a/src/mathematics/constants.h b/src/mathematics/constants.h index 34a10429..a7776c90 100644 --- a/src/mathematics/constants.h +++ b/src/mathematics/constants.h @@ -26,12 +26,6 @@ #define CONSTANTS_H // Libraries -#include -// Constants -const double EPSILON = 0.00001; -const double ONE_MINUS_EPSILON = 0.99999; -const double INFINITY_CONST = std::numeric_limits::infinity(); -const double PI = 3.14159265; // Pi constant #endif diff --git a/src/mathematics/lcp/LCPSolver.h b/src/mathematics/lcp/LCPSolver.h index 90daaeaf..651e276f 100644 --- a/src/mathematics/lcp/LCPSolver.h +++ b/src/mathematics/lcp/LCPSolver.h @@ -26,7 +26,7 @@ #include "../Vector.h" #include "../Matrix.h" #include "../../body/Body.h" -#include "../../typeDefinitions.h" +#include "../../constants.h" // ReactPhysics3D namespace namespace reactphysics3d { diff --git a/src/mathematics/mathematics.h b/src/mathematics/mathematics.h index b00ae03e..85631fd1 100644 --- a/src/mathematics/mathematics.h +++ b/src/mathematics/mathematics.h @@ -31,7 +31,7 @@ #include "Quaternion.h" #include "Vector.h" #include "Vector3D.h" -#include "constants.h" +#include "../constants.h" #include "exceptions.h" #include "mathematics_functions.h" #include diff --git a/src/mathematics/mathematics_functions.h b/src/mathematics/mathematics_functions.h index 2a45a0fd..7b8d77f5 100644 --- a/src/mathematics/mathematics_functions.h +++ b/src/mathematics/mathematics_functions.h @@ -26,7 +26,7 @@ #define MATHEMATICS_FUNCTIONS_H // Libraries -#include "constants.h" +#include "../constants.h" // ReactPhysics3D namespace namespace reactphysics3d {