Skip to content

Commit a0c0f27

Browse files
author
Lucas Burel
committed
fix example scenes
1 parent 2fcedad commit a0c0f27

13 files changed

Lines changed: 211 additions & 119 deletions

examples/xml/testClampedSquare.scn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<TriangleSetTopologyContainer name="trianglesTopo" src="@loader"/>
3535
<MechanicalObject name="tri" template="Rigid3" topology="@trianglesTopo" />
3636

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" />-->
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" />-->
3838

3939
<BoxROI name="Side1" box="-5.1 -5.1 -0.1 -4.9 5.1 0.1" drawSize="0"/>
4040
<FixedProjectiveConstraint indices="@Side1.indices" drawSize="0"/>

examples/xml/testDoubleShell.scn

Lines changed: 71 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,87 @@
11
<?xml version="1.0"?>
2-
<Node name="root" dt="0.02" showBehaviorModels="1" showCollisionModels="0" showMappings="0" showForceFields="1" showBoundingTree="0" showVisualModels="1" gravity="0 0 0">
2+
<Node name="root" dt="0.02" 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.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase,BruteForceBroadPhase,CollisionPipeline] -->
7+
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [MinProximityIntersection] -->
8+
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
9+
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint,FixedRotationProjectiveConstraint] -->
10+
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
11+
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
12+
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
13+
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
14+
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
15+
<RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->
16+
<RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [RestShapeSpringsForceField] -->
17+
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
18+
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TriangleSetTopologyContainer] -->
19+
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
20+
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
21+
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
22+
<RequiredPlugin name="Sofa.Component.Engine.Generate"/> <!-- Needed to use components [NormalsFromPoints] -->
23+
24+
</Node>
25+
<VisualStyle displayFlags="showBehaviorModels showForceFields showVisualsModels"/>
26+
<DefaultAnimationLoop/>
327
<CollisionPipeline verbose="0"/>
4-
<BruteForceDetection name="N2"/>
5-
<CollisionResponse response="default"/>
28+
<BruteForceBroadPhase name="N2"/>
29+
<BVHNarrowPhase/>
30+
<CollisionResponse name="Response" response="PenaltyContactForceField"/>
631
<MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5"/>
7-
<CollisionGroup/>
32+
833

934
<Node name="points">
10-
<MechanicalObject template="Rigid" name="fixedPoints"
35+
<MechanicalObject template="Rigid3" name="fixedPoints"
1136
position="0.5 0.9 1 0.3856834 0 0 0.9238795"
1237
showObject="true" />
13-
<FixedConstraint indices="0" />
38+
<FixedProjectiveConstraint indices="0" />
1439
</Node>
1540

1641
<Node name="shell">
1742
<EulerImplicitSolver/>
1843
<CGLinearSolver iterations="100" tolerance="1e-15" threshold="1e-15"/>
1944
<!-- <SparseLDLSolver name="SparseLDL Solver" printLog="false" />-->
20-
<TriangleSetTopologyContainer name="trianglesTopo" filename="applications/plugins/shells/mesh/oneTriangle.obj"/>
45+
<MeshOBJLoader name="loader" filename="../../../Shell/mesh/oneTriangle.obj"/>
46+
<TriangleSetTopologyContainer name="trianglesTopo" src="@loader"/>
2147

2248
<!-- No rotation - flat rest position -->
23-
<!-- <MechanicalObject name="tri" template="Rigid" />-->
49+
<!-- <MechanicalObject name="tri" template="Rigid3" />-->
2450

2551
<!-- No rotation - deformed rest position -->
26-
<!-- <MechanicalObject name="tri" template="Rigid" rest_position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0.107456 0 0 0.99421" position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0.107456 0 0 0.99421"/>-->
52+
<!-- <MechanicalObject name="tri" template="Rigid3" rest_position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0.107456 0 0 0.99421" position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0.107456 0 0 0.99421"/>-->
2753

2854
<!-- Rotation of Pi/2 around z -->
29-
<!-- <MechanicalObject name="tri" template="Rigid" rest_position="0 0 0 0 0 0.707107 0.707107 1 0 0 0 0 0.707107 0.707107 0.5 0.9 0 0 0 0.707107 0.707107" position="0 0 0 0 0 0.707107 0.707107 1 0 0 0 0 0.707107 0.707107 0.5 0.9 0 0 0 0.707107 0.707107"/>-->
55+
<!-- <MechanicalObject name="tri" template="Rigid3" rest_position="0 0 0 0 0 0.707107 0.707107 1 0 0 0 0 0.707107 0.707107 0.5 0.9 0 0 0 0.707107 0.707107" position="0 0 0 0 0 0.707107 0.707107 1 0 0 0 0 0.707107 0.707107 0.5 0.9 0 0 0 0.707107 0.707107"/>-->
3056

3157
<!-- Rotation of Pi/2 around z + torque on vertex 2 around local x -->
32-
<!-- <MechanicalObject name="tri" template="Rigid" rest_position="0 0 0 0 0 0.707629 0.706586 1 0 0 0 0 0.707629 0.706586 0.5 0.9 0 0.0783006 -0.0735901 0.680883 0.724466" position="0 0 0 0 0 0.707629 0.706586 1 0 0 0 0 0.707629 0.706586 0.5 0.9 0 0.0783006 -0.0735901 0.680883 0.724466"/>-->
58+
<!-- <MechanicalObject name="tri" template="Rigid3" rest_position="0 0 0 0 0 0.707629 0.706586 1 0 0 0 0 0.707629 0.706586 0.5 0.9 0 0.0783006 -0.0735901 0.680883 0.724466" position="0 0 0 0 0 0.707629 0.706586 1 0 0 0 0 0.707629 0.706586 0.5 0.9 0 0.0783006 -0.0735901 0.680883 0.724466"/>-->
3359

3460
<!-- Rotation of Pi/2 around z + displacement on vertex 2 along z -->
35-
<MechanicalObject name="tri" template="Rigid" rest_position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0 0 0 1" position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0 0 0 1"/>
61+
<MechanicalObject name="tri" template="Rigid3" topology="@trianglesTopo" rest_position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0 0 0 1" position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0 0 0 1"/>
3662

3763

38-
<UniformMass mass="0.1 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.05 ]" showAxisSizeFactor="0.2" totalmass="1"/>
39-
<FixedConstraint indices="0 1" drawSize="0"/>
64+
<UniformMass vertexMass="0.1 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.05 ]" showAxisSizeFactor="0.2" />
65+
<FixedProjectiveConstraint indices="0 1" drawSize="0"/>
4066

41-
<RestShapeSpringsForceField template="Rigid" name="Springs" external_rest_shape="../points/fixedPoints"
67+
<RestShapeSpringsForceField template="Rigid3" name="Springs" external_rest_shape="@../points/fixedPoints"
4268
points="2"
4369
external_points="0"
4470
stiffness="50000"
4571
angularStiffness="50000" />
4672

4773

48-
<FixedRotationConstraint FixedZRotation="true"/>
74+
<FixedRotationProjectiveConstraint FixedZRotation="true"/>
4975
<TriangularBendingFEMForceField name="FEM" bending="true" youngModulus="20000" poissonRatio="0.45" thickness="0.1"/>
5076

5177
<Node name="SubTriangles">
52-
<TriangleSetTopologyContainer name="subTrianglesTopo"/>
53-
<TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="3"/>
54-
<MechanicalObject name="subPoints"/>
78+
<MeshOBJLoader name="loader" filename="../../../Shell/mesh/oneTriangle.obj"/>
79+
<TriangleSetTopologyContainer name="subTrianglesTopo" src="@loader"/>
80+
<!-- <TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="3"/>
81+
--> <MechanicalObject name="subPoints" topology="@subTrianglesTopo"/>
5582
<BendingPlateMechanicalMapping input="@../tri" output="@subPoints"/>
56-
<Triangle contactStiffness="0.001"/>
57-
<Node>
83+
<TriangleCollisionModel contactStiffness="0.001"/>
84+
<Node name="visual">
5885
<OglModel name="Visual" color="red"/>
5986
<IdentityMapping input="@../subPoints" output="@Visual"/>
6087
</Node>
@@ -66,47 +93,54 @@
6693
<EulerImplicitSolver/>
6794
<CGLinearSolver iterations="100" tolerance="1e-15" threshold="1e-15"/>
6895
<!-- <SparseLDLSolver name="SparseLDL Solver" printLog="false" />-->
69-
<TriangleSetTopologyContainer name="trianglesTopo" filename="applications/plugins/shells/mesh/oneTriangle.obj"/>
96+
<MeshOBJLoader name="loader" filename="../../../Shell/mesh/oneTriangle.obj"/>
97+
<TriangleSetTopologyContainer name="trianglesTopo" src="@loader"/>
7098

7199
<!-- No rotation - flat rest position -->
72-
<!-- <MechanicalObject name="tri" template="Rigid" />-->
100+
<!-- <MechanicalObject name="tri" template="Rigid3" />-->
73101

74102
<!-- No rotation - deformed rest position -->
75-
<!-- <MechanicalObject name="tri" template="Rigid" rest_position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0.107456 0 0 0.99421" position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0.107456 0 0 0.99421"/>-->
103+
<!-- <MechanicalObject name="tri" template="Rigid3" rest_position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0.107456 0 0 0.99421" position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0.107456 0 0 0.99421"/>-->
76104

77105
<!-- Rotation of Pi/2 around z -->
78-
<!-- <MechanicalObject name="tri" template="Rigid" rest_position="0 0 0 0 0 0.707107 0.707107 1 0 0 0 0 0.707107 0.707107 0.5 0.9 0 0 0 0.707107 0.707107" position="0 0 0 0 0 0.707107 0.707107 1 0 0 0 0 0.707107 0.707107 0.5 0.9 0 0 0 0.707107 0.707107"/>-->
106+
<!-- <MechanicalObject name="tri" template="Rigid3" rest_position="0 0 0 0 0 0.707107 0.707107 1 0 0 0 0 0.707107 0.707107 0.5 0.9 0 0 0 0.707107 0.707107" position="0 0 0 0 0 0.707107 0.707107 1 0 0 0 0 0.707107 0.707107 0.5 0.9 0 0 0 0.707107 0.707107"/>-->
79107

80108
<!-- Rotation of Pi/2 around z + torque on vertex 2 around local x -->
81-
<!-- <MechanicalObject name="tri" template="Rigid" rest_position="0 0 0 0 0 0.707629 0.706586 1 0 0 0 0 0.707629 0.706586 0.5 0.9 0 0.0783006 -0.0735901 0.680883 0.724466" position="0 0 0 0 0 0.707629 0.706586 1 0 0 0 0 0.707629 0.706586 0.5 0.9 0 0.0783006 -0.0735901 0.680883 0.724466"/>-->
109+
<!-- <MechanicalObject name="tri" template="Rigid3" rest_position="0 0 0 0 0 0.707629 0.706586 1 0 0 0 0 0.707629 0.706586 0.5 0.9 0 0.0783006 -0.0735901 0.680883 0.724466" position="0 0 0 0 0 0.707629 0.706586 1 0 0 0 0 0.707629 0.706586 0.5 0.9 0 0.0783006 -0.0735901 0.680883 0.724466"/>-->
82110

83111
<!-- Rotation of Pi/2 around z + displacement on vertex 2 along z -->
84-
<MechanicalObject name="tri" template="Rigid" rest_position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0 0 0 1" position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 0.5 0.9 0 0 0 0 1"/>
85-
112+
<MechanicalObject name="tri" template="Rigid3" topology="@trianglesTopo" />
113+
<NormalsFromPoints name="NormalsFrom" position="@tri.position"/>
86114

87-
<UniformMass mass="0.1 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.05 ]" showAxisSizeFactor="0.2" totalmass="1"/>
88-
<FixedConstraint indices="0 1" drawSize="0"/>
115+
<UniformMass vertexMass="0.1 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.05 ]" showAxisSizeFactor="0.2" />
116+
<FixedProjectiveConstraint indices="0 1" drawSize="0"/>
89117

90-
<RestShapeSpringsForceField template="Rigid" name="Springs" external_rest_shape="../points/fixedPoints"
118+
<RestShapeSpringsForceField template="Rigid3" name="Springs" external_rest_shape="@../points/fixedPoints"
91119
points="2"
92120
external_points="0"
93121
stiffness="50000"
94122
angularStiffness="50000" />
95123

96124

97-
<BezierTriangularBendingFEMForceField name="FEM" youngModulus="20000" poissonRatio="0.45" thickness="0.1"/>
125+
<BezierTriangularBendingFEMForceField name="FEM" youngModulus="20000" poissonRatio="0.45" thickness="0.1" normals="@NormalsFrom.normals"/>
126+
<!--<TriangularBendingFEMForceField name="FEM" youngModulus="20000" poissonRatio="0.45" thickness="0.1" />-->
98127

99128
<Node name="SubTriangles">
100-
<TriangleSetTopologyContainer name="subTrianglesTopo"/>
101-
<TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="3"/>
102-
<MechanicalObject name="subPoints"/>
129+
<MeshOBJLoader name="loader" filename="../../../Shell/mesh/oneTriangle.obj"/>
130+
<TriangleSetTopologyContainer name="subTrianglesTopo" src="@loader"/>
131+
<!-- <TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="3"/>
132+
--> <MechanicalObject name="subPoints" topology="@subTrianglesTopo"/>
103133
<BezierTriangleMechanicalMapping input="@../tri" output="@subPoints"/>
104-
<Triangle contactStiffness="0.001"/>
105-
<Node>
134+
<TriangleCollisionModel contactStiffness="0.001"/>
135+
<Node name="visual">
106136
<OglModel name="Visual" color="green"/>
107137
<IdentityMapping input="@../subPoints" output="@Visual"/>
108138
</Node>
109139
</Node>
110140

111141
</Node>
142+
143+
144+
145+
112146
</Node>

0 commit comments

Comments
 (0)