<?xml version="1.0" ?>
<!-- See https://wiki.sofa-framework.org/wiki/TutorialTopologySurfaceMesh -->
<Node name="root" gravity="0 -9.81 1" dt="0.05">
    <RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase BruteForceBroadPhase CollisionPipeline] -->
    <RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [MinProximityIntersection] -->
    <RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
    <RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
    <RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
    <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshGmshLoader] -->
    <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
    <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TriangularFEMForceField] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField QuadBendingSprings RegularGridSpringForceField TriangularBendingSprings] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TriangleSetGeometryAlgorithms TriangleSetTopologyContainer TriangleSetTopologyModifier] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualModelImpl VisualStyle] -->
    <!-- Basic Components to perform the collision detection -->
    <VisualStyle displayFlags="showVisual showBehavior" />
    <CollisionPipeline name="DefaultCollisionPipeline" depth="6" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" />
    <CollisionResponse name="Response" />
	  <DefaultAnimationLoop/>

	  <Node name="Cloth Dynamic Mesh (blue)">
        <EulerImplicitSolver name="cg_odesolver" printLog="0" />
        <CGLinearSolver name="linear solver" template="GraphScattered" iterations="20" tolerance="1e-09" threshold="1e-09" />
        <MeshGmshLoader name="loader" filename="mesh/square3.msh" createSubelements="true" />
        <MechanicalObject src="@loader" name="DOF" template="Vec3" translation="10 0 15" rotation="0 90 90" scale="10" />
        <FixedProjectiveConstraint name="Fixed dof" template="Vec3" indices="0 1" />
        <UniformMass name="Mass" template="Vec3" vertexMass="0.1" />
        <TriangleSetTopologyContainer src="@loader" name="Topology Container" />
        <TriangleSetTopologyModifier name="Topology Modifier" />
        <TriangleSetGeometryAlgorithms template="Vec3" name="Geometry Algorithms" />
        <TriangularBendingSprings name="FEM-Bend" template="Vec3" stiffness="300" damping="1" />
        <TriangularFEMForceField name="FEM" template="Vec3" method="large" poissonRatio="0.3" youngModulus="80" />
        <TriangleCollisionModel name="models" />
        <Node >
          <VisualModelImpl name="Visual" color="blue" />
          <IdentityMapping input="@.." output="@Visual" />
        </Node>
    </Node>
	
    <Node name="Cloth Static Mesh (white)">
        <EulerImplicitSolver name="cg_odesolver" printLog="0" />
        <CGLinearSolver name="linear solver" template="GraphScattered" iterations="20" tolerance="1e-09" threshold="1e-09" />
        <MeshGmshLoader name="loader" filename="mesh/square3.msh" createSubelements="true"/>
        <MechanicalObject src="@loader" name="DOFs" template="Vec3" translation="10 0 5" rotation="0 90 90" scale="10" />
        <FixedProjectiveConstraint name="Fixed dof" template="Vec3" indices="0 1" />
        <UniformMass name="Mass" template="Vec3" vertexMass="0.1" />
        <MeshTopology src="@loader" name="Static Mesh" />
        <MeshSpringForceField name="Springs" template="Vec3" stiffness="300" damping="1" />
        <TriangularFEMForceField name="FEM" template="Vec3" method="large" poissonRatio="0.3" youngModulus="80" />
        <TriangleCollisionModel name="models" />
        <Node >
          <VisualModelImpl name="Visual" color="white" />
          <IdentityMapping input="@.." output="@Visual" />
        </Node>
    </Node>
	
    <Node name="Cloth Regular Mesh (red)">
	    <EulerImplicitSolver name="cg_odesolver" printLog="0" />
	    <CGLinearSolver name="linear solver" template="GraphScattered" iterations="20" tolerance="1e-09" threshold="1e-09" />
        <MechanicalObject name="DOFs" template="Vec3" translation="0 0 -4" />
        <FixedProjectiveConstraint name="Fixed dof" template="Vec3" indices="0 870" />
        <UniformMass name="Mass" template="Vec3" vertexMass="0.1" />
        <RegularGridTopology name="default38" n="30 1 30" min="0 0 -20" max="10 0 -30" p0="0 0 -1" />
        <RegularGridSpringForceField template="Vec3" stiffness="300" damping="1"/>
        <QuadBendingSprings template="Vec3" name="Bend" stiffness="20" damping="0" />
        <Node >
          <VisualModelImpl name="Visual" color="red" />
          <IdentityMapping input="@.." output="@Visual" />
        </Node>
    </Node>
    
</Node>
