18 #ifndef SURGSIM_PHYSICS_UNITTESTS_COMMONTESTS_H 19 #define SURGSIM_PHYSICS_UNITTESTS_COMMONTESTS_H 21 #include <gtest/gtest.h> 26 #include "SurgSim/Math/Shapes.h" 27 #include "SurgSim/Physics/Constraint.h" 28 #include "SurgSim/Physics/ConstraintImplementation.h" 29 #include "SurgSim/Physics/ContactConstraintData.h" 30 #include "SurgSim/Physics/FixedConstraintFrictionlessContact.h" 31 #include "SurgSim/Physics/FixedRepresentation.h" 32 #include "SurgSim/Physics/MlcpPhysicsProblem.h" 33 #include "SurgSim/Physics/MlcpPhysicsSolution.h" 34 #include "SurgSim/Physics/PhysicsManagerState.h" 35 #include "SurgSim/Physics/RigidConstraintFrictionlessContact.h" 36 #include "SurgSim/Physics/RigidRepresentation.h" 44 const double epsilon = 1e-10;
75 std::shared_ptr<RigidRepresentation> rigidSphereRepresentation;
76 rigidSphereRepresentation = std::make_shared<RigidRepresentation>(
"RigidSphere");
79 std::shared_ptr<Shape> shape = std::make_shared<SphereShape>(radius);
80 rigidSphereRepresentation->setShape(shape);
81 rigidSphereRepresentation->setDensity(1000);
82 rigidSphereRepresentation->setIsGravityEnabled(
false);
85 rigidSphereRepresentation->beforeUpdate(
dt);
86 rigidSphereRepresentation->update(
dt);
87 rigidSphereRepresentation->afterUpdate(
dt);
93 std::shared_ptr<RigidRepresentation> rigidBoxRepresentation = std::make_shared<RigidRepresentation>(
"RigidBox");
95 double size[3]={0.01, 0.02, 0.03};
96 rigidBoxRepresentation->setDensity(1000);
97 std::shared_ptr<Shape> shape = std::make_shared<BoxShape>(size[0], size[1], size[2]);
98 rigidBoxRepresentation->setShape(shape);
99 rigidBoxRepresentation->setIsGravityEnabled(
false);
102 rigidBoxRepresentation->beforeUpdate(
dt);
103 rigidBoxRepresentation->update(
dt);
104 rigidBoxRepresentation->afterUpdate(
dt);
110 void resetMlcpProblem(
int nbDof,
int nbConstraint)
128 double dt = std::numeric_limits<double>::signaling_NaN();
149 #endif // SURGSIM_PHYSICS_UNITTESTS_COMMONTESTS_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
std::vector< std::shared_ptr< Representation > > m_allRepresentations
Vector of all representations.
Definition: CommonTests.h:134
double dt
Time step.
Definition: CommonTests.h:128
Box shape: box centered on (0 0 0), aligned with the axis with different sizes along X...
Definition: BoxShape.h:33
Definition: CommonTests.h:52
std::shared_ptr< Representation > m_fixedWorldRepresentation
Fixed representation to define constraint in fixed space.
Definition: CommonTests.h:131
std::shared_ptr< PhysicsManagerState > m_physicsManagerState
The unique physics manager state.
Definition: CommonTests.h:143
Sphere shape: sphere centered on (0 0 0), defined with radius.
Definition: SphereShape.h:30
void SetUp()
Setup the test case by creating all object.
Definition: CommonTests.h:56
std::vector< std::shared_ptr< Representation > > m_usedRepresentations
Vector of representations useful for the current test.
Definition: CommonTests.h:137
std::vector< std::shared_ptr< Constraint > > m_usedConstraints
Vector of constraints useful for the current test.
Definition: CommonTests.h:140
Generic rigid shape class defining a shape.
Definition: Shape.h:65