SEARCH
TOOLBOX
LANGUAGES
TutorialCollisionMultipleGroups

TutorialCollisionMultipleGroups

From SOFAWiki

Jump to: navigation, search
Tutorial : Collision Cubes

Contents

Example showing multiple interactions managed independently

This example is distributed in
examples/Tutorials/Basic/TutorialCollisionMultipleGroups.scn
within SofaSVN and SOFA distributions starting from 1.0 beta 4.

Graph

XML Description

<?xml version="1.0" ?>
<!-- See http://wiki.sofa-framework.org/mediawiki/index.php/TutorialCollisionMultipleGroups.scn -->
<Node name="root" dt="0.01" gravity="0 0 -9.81" showForceFields="1" showCollisionModels="1">
  <!-- Basic Components to perform the collision detection -->
  <CollisionPipeline/>
  <BruteForceDetection/>
  <DefaultContactManager/>
  <MinProximityIntersection alarmDistance="0.5" contactDistance="0.2"/>
 
  <Node name="CubeSphere1">
    <EulerImplicitSolver  name="EulerImplicit" />
    <CGLinearSolver       name="CG Solver" />    
    <MechanicalObject     name="Particles" template="Vec3d"
                          position="0 0 1  1 0 1  0 1 1  1 1 1  0 0 2  1 0 2  0 1 2  1 1 2" 
                          translation="-2 1 2" />
    <MeshTopology         name="Topology" hexas="0 4 6 2 1 5 7 3" />    
    <UniformMass          name="Mass" totalmass="1" />
    <MeshSpringForceField name="Springs" stiffness="100" damping="1" />
    <!-- Collision Model -->
    <SphereModel          name="Spheres Cube1" radius="0.4"/>
  </Node>
 
  <Node name="CubeSphere2">
    <EulerImplicitSolver  name="EulerImplicit" />
    <CGLinearSolver       name="CG Solver" />
 
    <MechanicalObject     name="Particles" template="Vec3d"
                          position="0 0 1  1 0 1  0 1 1  1 1 1  0 0 2  1 0 2  0 1 2  1 1 2" 
                          translation="0 0 6"/>
    <MeshTopology         name="Topology" hexas="0 4 6 2 1 5 7 3" />
 
    <UniformMass          name="Mass" totalmass="1" />
    <MeshSpringForceField name="Springs" stiffness="100" damping="1" />
    <!-- Collision Model -->
    <SphereModel          name="Spheres Cube2" radius="0.4"/>
  </Node>
 
  <Node name="CubeGeometry1">
    <EulerImplicitSolver  name="EulerImplicit" />
    <CGLinearSolver       name="CG Solver" />
 
    <MechanicalObject     name="Particles" template="Vec3d"
                          position="0 0 1  1 0 1  0 1 1  1 1 1  0 0 2  1 0 2  0 1 2  1 1 2" 
                          translation="0 1 2"/>
    <MeshTopology         name="Topology" hexas="0 4 6 2 1 5 7 3" />   
    <UniformMass          name="Mass" totalmass="1" />
    <MeshSpringForceField name="Springs" stiffness="100" damping="1" />
    <!-- Collision Models -->
    <TriangleModel        name="Triangles CubeGeometry1"/>
    <LineModel            name="Lines CubeGeometry1"/>
    <PointModel           name="Points CubeGeometry1"/>
  </Node>
 
  <Node name="CubeGeometry2">
    <EulerImplicitSolver  name="EulerImplicit" />
    <CGLinearSolver       name="CG Solver" />    
    <MechanicalObject     name="Particles" template="Vec3d"
                          position="0 0 1  1 0 1  0 1 1  1 1 1  0 0 2  1 0 2  0 1 2  1 1 2" 
                          translation="2 1 2"/>
    <MeshTopology         name="Topology" hexas="0 4 6 2 1 5 7 3" />    
    <UniformMass          name="Mass" totalmass="1" />
    <MeshSpringForceField name="Springs" stiffness="100" damping="1" />
    <!-- Collision Models -->
    <TriangleModel        name="Triangles CubeGeometry2"/>
    <LineModel            name="Lines CubeGeometry2"/>
    <PointModel           name="Points CubeGeometry2"/>
  </Node>
 
  <Node name="SaladBowl">       
    <MeshTopology         name="Topology Salad Bowl"  filename="mesh/SaladBowl.obj"/>
    <MechanicalObject     name="Particles Salad Bowl" scale="10"/>                
    <TriangleModel        name="Triangles Salad Bowl" moving="0" simulated="0"/>
    <LineModel            name="Lines Salad Bowl"     moving="0" simulated="0"/>
    <PointModel           name="Points Salad Bowl"     moving="0" simulated="0"/>
  </Node>
</Node>

Example showing multiple interactions managed by a single solver

This example is distributed in
examples/Tutorials/Basic/TutorialCollisionMultipleGroupsSolver.scn
within SofaSVN and SOFA distributions starting from 1.0 beta 4.

Graph

XML Description

<?xml version="1.0" ?>
<!-- See http://wiki.sofa-framework.org/mediawiki/index.php/TutorialCollisionMultipleGroups.scn -->
<Node name="root" dt="0.01" gravity="0 0 -9.81" showForceFields="1" showCollisionModels="1">
  <!-- Basic Components to perform the collision detection -->
  <CollisionPipeline/>
  <BruteForceDetection/>
  <DefaultContactManager/>
  <MinProximityIntersection alarmDistance="0.5" contactDistance="0.2"/>
  <Node name="SolverNode">
    <EulerImplicitSolver  name="EulerImplicit" />
    <CGLinearSolver       name="CG Solver" /> 
    <Node name="CubeSphere1">   
      <MechanicalObject     name="Particles" template="Vec3d"
                            position="0 0 1  1 0 1  0 1 1  1 1 1  0 0 2  1 0 2  0 1 2  1 1 2" 
                            translation="-2 1 2" />
      <MeshTopology         name="Topology" hexas="0 4 6 2 1 5 7 3" />    
      <UniformMass          name="Mass" totalmass="1" />
      <MeshSpringForceField name="Springs" stiffness="100" damping="1" />
      <!-- Collision Model -->
      <SphereModel          name="Spheres Cube1" radius="0.4"/>
    </Node>
 
    <Node name="CubeSphere2">
      <MechanicalObject     name="Particles" template="Vec3d"
                            position="0 0 1  1 0 1  0 1 1  1 1 1  0 0 2  1 0 2  0 1 2  1 1 2" 
                            translation="0 0 6"/>
      <MeshTopology         name="Topology" hexas="0 4 6 2 1 5 7 3" />
 
      <UniformMass          name="Mass" totalmass="1" />
      <MeshSpringForceField name="Springs" stiffness="100" damping="1" />
      <!-- Collision Model -->
      <SphereModel          name="Spheres Cube2" radius="0.4"/>
    </Node>
 
    <Node name="CubeGeometry1">
      <MechanicalObject     name="Particles" template="Vec3d"
                            position="0 0 1  1 0 1  0 1 1  1 1 1  0 0 2  1 0 2  0 1 2  1 1 2" 
                            translation="0 1 2"/>
      <MeshTopology         name="Topology" hexas="0 4 6 2 1 5 7 3" />   
      <UniformMass          name="Mass" totalmass="1" />
      <MeshSpringForceField name="Springs" stiffness="100" damping="1" />
      <!-- Collision Models -->
      <TriangleModel        name="Triangles CubeGeometry1"/>
      <LineModel            name="Lines CubeGeometry1"/>
      <PointModel           name="Points CubeGeometry1"/>
    </Node>
 
    <Node name="CubeGeometry2">  
      <MechanicalObject     name="Particles" template="Vec3d"
                            position="0 0 1  1 0 1  0 1 1  1 1 1  0 0 2  1 0 2  0 1 2  1 1 2" 
                            translation="2 1 2"/>
      <MeshTopology         name="Topology" hexas="0 4 6 2 1 5 7 3" />    
      <UniformMass          name="Mass" totalmass="1" />
      <MeshSpringForceField name="Springs" stiffness="100" damping="1" />
      <!-- Collision Models -->
      <TriangleModel        name="Triangles CubeGeometry2"/>
      <LineModel            name="Lines CubeGeometry2"/>
      <PointModel           name="Points CubeGeometry2"/>
    </Node>
  </Node>
  <Node name="SaladBowl">       
    <MeshTopology         name="Topology Salad Bowl"  filename="mesh/SaladBowl.obj"/>
    <MechanicalObject     name="Particles Salad Bowl" scale="10"/>                
    <TriangleModel        name="Triangles Salad Bowl" moving="0" simulated="0"/>
    <LineModel            name="Lines Salad Bowl"     moving="0" simulated="0"/>
    <PointModel           name="Points Salad Bowl"     moving="0" simulated="0"/>
  </Node>
</Node>