Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions examples/Demos/fallingSOFA.scn
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
<CollisionResponse name="ContactManager" response="FrictionContactConstraint" responseParams="mu=0.3" />
<!-- This object is responsible for defining pairs of points used for contact simulation.
Alarm distance and contact distance are key parameters: alarm distance is the distance at which the collision
detection is being performed. The contact distance increases the contact distance between object, enforcing a 'skinning' behavior -->
<NewProximityIntersection name="Intersection" alarmDistance="0.02" contactDistance="0.002" />
detection is being performed. The contact distance increases the final distance between object, enforcing a 'skinning' behavior.
Here, because we are using CCD collision detection, the alarm distance can be set to 0-->
<CCDTightInclusionIntersection name="CCDTightInclusionIntersection" continuousCollisionType="FreeMotion" maxIterations="100" alarmDistance="0.0" contactDistance="0.00001"/>

<!-- Non-simulated node used to create underlying deformable topology -->
<Node name="BeamDomainFromGridTopology">
Expand Down Expand Up @@ -93,9 +94,9 @@
<Tetra2TriangleTopologicalMapping input="@../Container" output="@Container" flipNormals="false"/>
<MechanicalObject name="dofs" rest_position="@../mstate.rest_position"/>

<!-- This uses triangles as colliding element. These triangular primitives are the triangles present in the topology
<!-- This uses points as colliding element. These primitives are the one of the surface, thanks to the topological mapping
For more information on collision models see : https://sofa-framework.github.io/doc/components/collision/geometry/collisionmodels/ -->
<TriangleCollisionModel name="Collision" contactDistance="0.001" color="0.94117647058824 0.93725490196078 0.89411764705882" />
<PointCollisionModel name="Collision" contactDistance="0.0" color="0.94117647058824 0.93725490196078 0.89411764705882" />

<!-- This is a mapping: it relates the position of this node to the one of the simulated node.
The position of this node (the output of the mapping) is totally defined by the position of the input node
Expand Down Expand Up @@ -157,6 +158,6 @@
4 5 6 4 6 7" />
<MechanicalObject template="Vec3"/>
<!-- Because it is neither simulated nor moving, we can speed the solver and collision detection by setting parameters moving="0" simulated="0" -->
<TriangleCollisionModel name="CubeCM" contactDistance="0.001" moving="0" simulated="0" />
<TriangleCollisionModel name="CubeCM" contactDistance="0.00001" moving="0" simulated="0" />
</Node>
</Node>
2 changes: 1 addition & 1 deletion examples/RegressionStateScenes.regression-tests
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Demos/collisionMultiple.scn 100 1e-4 1 1
Demos/liver.scn 100 1e-4 1 1
Demos/simpleBoundaryConditions.scn 100 1e-4 1 1
Demos/fallingBeamLagrangianCollision.scn 46 1e-7 1 1
Demos/fallingSOFA.scn 200 1e-7 1 1
Demos/fallingSOFA.scn 200 1e-6 1 1
Demos/SofaScene.scn 120 1e-5 1 1


Expand Down
12 changes: 7 additions & 5 deletions examples/SimpleAPI/fallingSOFA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ sofa::simulation::Node::SPtr createScene(const sofa::simpleapi::Simulation::SPtr
sofa::simpleapi::createObject(root, "CollisionResponse",{{"name","ContactManager"},
{"response","FrictionContactConstraint"},
{"responseParams","mu=0.3"}});
sofa::simpleapi::createObject(root, "NewProximityIntersection",{{"name","Intersection"},
{"alarmDistance","0.02"},
{"contactDistance","0.002"}});
sofa::simpleapi::createObject(root, "CCDTightInclusionIntersection",{{"name","CCDTightInclusionIntersection"},
{"continuousCollisionType","FreeMotion"},
{"maxIterations","100"},
{"alarmDistance","0.0"},
{"contactDistance","0.00001"}});

//Simulated Topology creation node
const sofa::simulation::Node::SPtr BeamDomainFromGridTopology = sofa::simpleapi::createChild(root,"BeamDomainFromGridTopology");
Expand All @@ -83,7 +85,7 @@ sofa::simulation::Node::SPtr createScene(const sofa::simpleapi::Simulation::SPtr
sofa::simpleapi::createObject(FEMechanicalModel_Surface, "TriangleSetTopologyModifier", {{"name","Modifier"}});
sofa::simpleapi::createObject(FEMechanicalModel_Surface, "Tetra2TriangleTopologicalMapping", {{"input","@../Container"}, {"output","@Container"}, {"flipNormals","false"}});
sofa::simpleapi::createObject(FEMechanicalModel_Surface, "MechanicalObject", {{"name","dofs"},{"rest_position","@../mstate.rest_position"}});
sofa::simpleapi::createObject(FEMechanicalModel_Surface, "TriangleCollisionModel", {{"name","Collision"},{"proximity","0.001"}, {"color","0.94117647058824 0.93725490196078 0.89411764705882"}} );
sofa::simpleapi::createObject(FEMechanicalModel_Surface, "PointCollisionModel", {{"name","Collision"}, {"color","0.94117647058824 0.93725490196078 0.89411764705882"}} );
sofa::simpleapi::createObject(FEMechanicalModel_Surface, "IdentityMapping", {{"name","SurfaceMapping"}});

const std::vector<std::string > visuFiles{"mesh/SofaScene/LogoVisu.obj", "mesh/SofaScene/SVisu.obj", "mesh/SofaScene/O.obj", "mesh/SofaScene/FVisu.obj", "mesh/SofaScene/AVisu.obj"};
Expand All @@ -105,7 +107,7 @@ sofa::simulation::Node::SPtr createScene(const sofa::simpleapi::Simulation::SPtr
{"position","0.2 0 -0.5 0.2 0.1 -0.5 0.3 0.1 -0.5 0.3 0 -0.5 0.2 0 -0.6 0.2 0.1 -0.6 0.3 0.1 -0.6 0.3 0 -0.6"},
{"triangles","0 2 1 0 3 2 0 1 5 0 5 4 0 4 7 0 7 3 1 2 6 1 6 5 3 7 6 3 6 2 4 5 6 4 6 7"}} );
sofa::simpleapi::createObject(Floor, "MechanicalObject", {{"template","Vec3"}});
sofa::simpleapi::createObject(Floor, "TriangleCollisionModel", {{"name","FloorCM"}, {"proximity","0.001"}, {"moving","0"}, {"simulated","0"}} );
sofa::simpleapi::createObject(Floor, "TriangleCollisionModel", {{"name","FloorCM"}, {"contactDistance","0.00001"}, {"moving","0"}, {"simulated","0"}} );
return root;
}

Expand Down
Loading