Skip to content

Commit 0816b1c

Browse files
Lucas-TJLucas Burel
andauthored
[Examples] Add simple example scenes (#15)
* [examples] Update scene * clean example from folder xml/combo * fix paths 200shellComputationAnevrism * remove comments + move LCPConstraintSolver * clean examples 30/04 * fix last commit * Added example scenes * fix example scenes * Delete doc/VRIPHYS2012/vriphys2012.pdf * Delete doc/Vrst2013/vrst2013.pdf --------- Co-authored-by: Lucas Burel <lucas.burel@inria.fr>
1 parent 9843409 commit 0816b1c

18 files changed

Lines changed: 1087 additions & 602 deletions

examples/xml/testClampedSquare.scn

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,60 @@
1-
<Node name="root" dt="0.01" showBehaviorModels="1" showCollisionModels="0" showMappings="0" showForceFields="0" showBoundingTree="0" showVisualModels="1" gravity="0 0 0">
1+
<?xml version="1.0"?>
2+
<Node name="root" dt="0.01" gravity="0 0 0">
3+
<Node name="plugins">
4+
<RequiredPlugin name="Shell"/>
5+
<RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
6+
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
7+
<RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
8+
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
9+
<RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] -->
10+
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
11+
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
12+
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
13+
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
14+
<RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
15+
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
16+
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
17+
<RequiredPlugin name="Sofa.GUI.Component"/> <!-- Needed to use components [AttachBodyButtonSetting] -->
18+
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
19+
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
20+
<RequiredPlugin name="Sofa.Component.MechanicalLoad"/> <!-- Needed to use components [ConstantForceField] -->
21+
<RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->
22+
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TriangleSetTopologyContainer] -->
23+
</Node>
24+
25+
<VisualStyle displayFlags="showBehaviorModels hideMappings hideForceFields showVisualModels"/>
26+
<DefaultAnimationLoop/>
227

328
<Node name="SmallSquare" activated="true">
4-
<!-- <EulerImplicitSolver/>-->
5-
<StaticSolver/>
29+
<EulerImplicitSolver/>
30+
<!--<StaticSolver/>-->
631
<CGLinearSolver iterations="500" tolerance="1e-15" threshold="1e-15"/>
732
<!-- <SparseLDLSolver name="SparseLDL Solver" printLog="false" />-->
8-
<TriangleSetTopologyContainer name="trianglesTopo" filename="../mesh/square5x5.obj"/>
9-
<MechanicalObject name="tri" template="Rigid"/>
33+
<MeshOBJLoader name="loader" filename="../../../Shell/mesh/square5x5.obj"/>
34+
<TriangleSetTopologyContainer name="trianglesTopo" src="@loader"/>
35+
<MechanicalObject name="tri" template="Rigid3" topology="@trianglesTopo" />
1036

11-
<!-- <UniformMass mass="0.1 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.05 ]" showAxisSizeFactor="0.001" totalmass="0.1" />-->
37+
<!-- <UniformMass mass="0.1 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.05 ]" showAxisSizeFactor="0.001" totalmass="0.1" />-->
1238

1339
<BoxROI name="Side1" box="-5.1 -5.1 -0.1 -4.9 5.1 0.1" drawSize="0"/>
14-
<FixedConstraint indices="@Side1.indices" drawSize="0"/>
40+
<FixedProjectiveConstraint indices="@Side1.indices" drawSize="0"/>
1541
<BoxROI name="Side2" box="-5.1 5.1 -0.1 5.1 4.9 0.1" drawSize="0"/>
16-
<FixedConstraint indices="@Side2.indices" drawSize="0"/>
42+
<FixedProjectiveConstraint indices="@Side2.indices" drawSize="0"/>
1743
<BoxROI name="Side3" box="5.1 5.1 -0.1 4.9 -5.1 0.1" drawSize="0"/>
18-
<FixedConstraint indices="@Side3.indices" drawSize="0"/>
44+
<FixedProjectiveConstraint indices="@Side3.indices" drawSize="0"/>
1945
<BoxROI name="Side4" box="5.1 -5.1 -0.1 -5.1 -4.9 0.1" drawSize="0"/>
20-
<FixedConstraint indices="@Side4.indices" drawSize="0"/>
46+
<FixedProjectiveConstraint indices="@Side4.indices" drawSize="0"/>
2147

22-
<ConstantForceField points="0-24" forces="0 0 11.1 0 0 0"/>
48+
<ConstantForceField indices="0-24" forces="0 0 11.1 0 0 0"/>
2349
<TriangularBendingFEMForceField name="FEM" bending="true" youngModulus="1.092e6" poissonRatio="0.3" thickness="0.1" />
2450

2551
<Node name="SubTriangles">
52+
2653
<TriangleSetTopologyContainer name="subTrianglesTopo"/>
27-
<TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="2"/>
28-
<MechanicalObject name="subPoints" />
29-
<BendingPlateMechanicalMapping />
30-
<Triangle/>
54+
<!-- <TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="2"/>
55+
--> <MechanicalObject name="subPoints" topology="@subTrianglesTopo" />
56+
<BendingPlateMechanicalMapping input="@../tri" output="@subPoints" />
57+
<TriangleCollisionModel/>
3158
</Node>
3259

3360
</Node>

examples/xml/testContacts.scn

Lines changed: 68 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,45 @@
1-
<Node name="root" dt="0.01" gravity="0 -10 0" showBehaviorModels="1" showCollisionModels="1">
1+
<?xml version="1.0"?>
2+
<Node name="root" dt="0.01" gravity="0 -10 0" >
3+
4+
<Node name="plugins">
5+
<RequiredPlugin name="Shell"/>
6+
<RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
7+
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
8+
<RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
9+
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
10+
<RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] -->
11+
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
12+
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
13+
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
14+
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
15+
<RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
16+
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
17+
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
18+
<RequiredPlugin name="Sofa.GUI.Component"/> <!-- Needed to use components [AttachBodyButtonSetting] -->
19+
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
20+
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
21+
<RequiredPlugin name="Sofa.Component.MechanicalLoad"/> <!-- Needed to use components [ConstantForceField] -->
22+
<RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->
23+
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TriangleSetTopologyContainer] -->
24+
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase,BruteForceBroadPhase,CollisionPipeline] -->
25+
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [MinProximityIntersection] -->
26+
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
27+
<RequiredPlugin name="Sofa.Component.Engine.Transform"/> <!-- Needed to use components [Vertex2Frame] -->
28+
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [BeamFEMForceField] -->
29+
</Node>
30+
31+
<VisualStyle displayFlags="showBehaviorModels showCollisionModels"/>
32+
<DefaultAnimationLoop/>
233
<!-- <MasterContactSolver name="MasterSolver" maxIt="5000" tolerance="0.00000001" displayTime="true" printLog="0" mu="0.1"/>-->
334
<CollisionPipeline verbose="0" />
4-
<BruteForceDetection name="N2" />
5-
<CollisionResponse />
35+
<BruteForceBroadPhase name="N2"/>
36+
<BVHNarrowPhase/>
37+
<CollisionResponse name="response" response="PenaltyContactForceField" />
638
<MinProximityIntersection name="Proximity" alarmDistance="0.005" contactDistance="0.001"/>
7-
<CollisionGroup />
39+
840

941
<Node name="pointA">
10-
<MechanicalObject template="Rigid" name="fixedPoint" position="-0.03 0 0 0 0 0 1"/>
42+
<MechanicalObject template="Rigid3" name="fixedPoint" position="-0.03 0 0 0 0 0 1"/>
1143
</Node>
1244

1345

@@ -18,27 +50,24 @@
1850
<MechanicalObject name="ArticulatedObject" template="Vec1d"/>
1951
<Node name="6D_DOFs1">
2052

21-
<MechanicalObject name="6D_Dof" template="Rigid"/>
22-
<UniformMass totalmass="1" showAxisSizeFactor="0.001"/>
23-
<ArticulatedSystemMapping object1="ArticulatedObject" object2="6D_Dof"/>
53+
<MechanicalObject name="6D_Dof" template="Rigid3"/>
54+
<UniformMass totalMass="1" showAxisSizeFactor="0.001"/>
55+
<ArticulatedSystemMapping input1="@../ArticulatedObject" output="@6D_Dof"/>
2456
</Node>
2557
<ArticulatedHierarchyContainer filename="BeamMotionInTube.bvh"/>
2658
<ArticulatedHierarchyBVHController />
2759
</Node>
2860

2961

30-
31-
32-
3362
<Node name="Beam">
34-
<EulerImplicit rayleighStiffness="0" printLog="false" />
63+
<EulerImplicitSolver rayleighStiffness="0" printLog="false" />
3564
<!-- <BTDLinearSolver template="NewMatBand" bandWidth="11" printLog="false" verbose="false" />-->
36-
<SparseLDLSolver name="SparseLDL Solver" printLog="false" />
37-
<MechanicalObject template="Rigid" name="DOFs" position="-0.03 0 0 0 0 0 1 -0.02 0 0 0 0 0 1 -0.01 0 0 0 0 0 1 0 0 0 0 0 0 1 0.01 0 0 0 0 0 1 0.02 0 0 0 0 0 1 0.03 0 0 0 0 0 1 0.04 0 0 0 0 0 1" />
38-
<Mesh name="lines" lines="0 1 1 2 2 3 3 4 4 5 5 6 6 7" />
39-
40-
<AttachConstraint name="Constraint" object2="DOFs" object1="pointA/fixedPoint" indices1="0" indices2="0" freeRotations="false" />
41-
<UniformMass mass="0.5 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.1 ]" totalMass="0.2" showAxisSizeFactor="0.01" printLog="false" />
65+
<SparseLDLSolver name="SparseLDL Solver" printLog="false" template="CompressedRowSparseMatrixd"/>
66+
<MechanicalObject template="Rigid3" name="DOFs" position="-0.03 0 0 0 0 0 1 -0.02 0 0 0 0 0 1 -0.01 0 0 0 0 0 1 0 0 0 0 0 0 1 0.01 0 0 0 0 0 1 0.02 0 0 0 0 0 1 0.03 0 0 0 0 0 1 0.04 0 0 0 0 0 1" />
67+
<MeshTopology name="lines" lines="0 1 1 2 2 3 3 4 4 5 5 6 6 7" />
68+
<!--<AttachProjectiveConstraint name="Constraint" object2="@DOFs" object1="@/pointA/fixedPoint" indices1="0" indices2="0" freeRotations="false" />-->
69+
<FixedProjectiveConstraint indices="0"/>
70+
<UniformMass vertexMass="0.5 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.1 ]" showAxisSizeFactor="0.01" printLog="false" />
4271
<BeamFEMForceField name="FEM" radius="0.01" youngModulus="1e6" />
4372

4473
<!-- <RestShapeSpringsForceField points="7" stiffness="1e6" angularStiffness="1e6" external_rest_shape="../Motion/6D_DOFs1/6D_Dof" external_points="1"/>-->
@@ -47,55 +76,56 @@
4776
<!-- <CubeTopology nx="2" ny="15" nz="2" min="0.001 -0.03 -0.001" max="-0.001 0.04 0.001" />-->
4877
<!-- <MechanicalObject />-->
4978
<!-- <BeamLinearMapping isMechanical="true" localCoord="false"/>-->
50-
<!-- <Triangle />-->
79+
<!-- <TriangleCollisionModel />-->
5180
<!-- </Node>-->
5281
<Node name="Collision">
5382
<CubeTopology nx="15" ny="2" nz="2" min="0 -0.1 -0.1" max="7 0.1 0.1" />
5483
<MechanicalObject />
5584
<BeamLinearMapping isMechanical="true" localCoord="true"/>
56-
<Triangle contactStiffness="1e4" bothSide="1"/>
57-
<Line contactStiffness="1e4" bothSide="1"/>
58-
<Point contactStiffness="1e4" bothSide="1"/>
85+
<TriangleCollisionModel contactStiffness="1e4" bothSide="1"/>
86+
<LineCollisionModel contactStiffness="1e4" bothSide="1"/>
87+
<PointCollisionModel contactStiffness="1e4" bothSide="1"/>
5988
</Node>
6089
</Node>
6190

6291

6392

6493

6594
<Node name="Rest_colon">
66-
<MeshLoader name="rest_shape" filename="applications/plugins/shells/mesh/fake_colon.obj"/>
67-
<Mesh/>
68-
<Vertex2Frame name="RestVertex2Frame" template="Rigid" invertNormals="false" vertices="@rest_shape.vertices" normals="@rest_shape.normals" />
95+
<MeshOBJLoader name="rest_shape" filename="../../../Shell/mesh/fake_colon.obj"/>
96+
<MeshTopology/>
97+
<Vertex2Frame name="RestVertex2Frame" template="Rigid3" invertNormals="false" position="@rest_shape.position" normals="@rest_shape.normals" />
6998
</Node>
7099

71100

72101
<Node name="Fake_colon" activated="true">
73102
<EulerImplicitSolver/>
74103
<CGLinearSolver iterations="100" tolerance="1e-15" threshold="1e-15"/>
75-
<TriangleSetTopologyContainer name="trianglesTopo" filename="applications/plugins/shells/mesh/fake_colon.obj"/>
76-
<MechanicalObject name="colon" template="Rigid" debugViewIndices="false" debugViewIndicesScale="0.0003" position="@../Rest_colon/RestVertex2Frame.frames" />
104+
<MeshOBJLoader name="loader" filename="../../../Shell/mesh/fake_colon.obj" />
105+
<TriangleSetTopologyContainer name="trianglesTopo" src="@loader"/>
106+
<MechanicalObject name="colon" template="Rigid3" showIndices="false" showIndicesScale="0.0003" position="@../Rest_colon/RestVertex2Frame.frames" topology="@trianglesTopo"/>
77107

78-
<UniformMass mass="0.1 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.05 ]" showAxisSizeFactor="0.003" totalmass="3" />
108+
<UniformMass showAxisSizeFactor="0.003" totalMass="3" />
79109

80110
<BoxROI name="box1" box="-0.065 -0.03 -0.03 -0.06 0.03 0.03" drawSize="0"/>
81-
<FixedConstraint indices="@box1.indices" drawSize="0"/>
111+
<FixedProjectiveConstraint indices="@box1.indices" drawSize="0"/>
82112
<BoxROI name="box2" box="0.06 -0.03 -0.03 0.065 0.03 0.03" drawSize="0"/>
83-
<FixedConstraint indices="@box2.indices" drawSize="0"/>
113+
<FixedProjectiveConstraint indices="@box2.indices" drawSize="0"/>
84114

85-
<FixedRotationConstraint FixedZRotation="true"/>
115+
<FixedRotationProjectiveConstraint FixedZRotation="true"/>
86116
<TriangularBendingFEMForceField name="FEM" bending="true" youngModulus="1e5" poissonRatio="0.42" thickness="0.001" />
87117

88118
<Node name="SubTriangles">
89119
<TriangleSetTopologyContainer name="subTrianglesTopo"/>
90-
<TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="1"/>
91-
<MechanicalObject name="subPoints" />
92-
<BendingPlateMechanicalMapping />
93-
<Triangle contactStiffness="1e4" bothSide="1"/>
94-
<Line contactStiffness="1e4" bothSide="1"/>
95-
<Point contactStiffness="1e4" bothSide="1"/>
120+
<!--<TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="1"/>-->
121+
<MechanicalObject name="subPoints" topology="@subTrianglesTopo"/>
122+
<BendingPlateMechanicalMapping input="@../colon" output="@subPoints"/>
123+
<TriangleCollisionModel contactStiffness="1e4" bothSide="1"/>
124+
<LineCollisionModel contactStiffness="1e4" bothSide="1"/>
125+
<PointCollisionModel contactStiffness="1e4" bothSide="1"/>
96126
<Node name="visual">
97127
<OglModel name="Visual" color="red"/>
98-
<IdentityMapping object1="subPoints" object2="Visual"/>
128+
<IdentityMapping input="@../subPoints" output="@Visual"/>
99129
</Node>
100130
</Node>
101131

0 commit comments

Comments
 (0)