Skip to content

Commit

Permalink
Update scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
epernod committed Aug 29, 2023
1 parent 0de4b40 commit 566e8ac
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 18 deletions.
31 changes: 17 additions & 14 deletions examples/3instruments_collis.scn
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<Node name='Plugins'>
<RequiredPlugin name="BeamAdapter"/> <!-- Needed to use components [MultiAdaptiveBeamMapping WireBeamInterpolation WireRestShape] -->
<RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase BruteForceBroadPhase DefaultPipeline] -->
<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 [LocalMinDistance] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [LineCollisionModel PointCollisionModel TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [DefaultContactManager] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [LinearSolverConstraintCorrection] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [LCPConstraintSolver] -->
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedConstraint] -->
Expand All @@ -29,17 +29,18 @@
<FreeMotionAnimationLoop />
<LCPConstraintSolver mu='0.1' tolerance='1e-10' maxIt='1000' build_lcp='false' />

<DefaultPipeline depth='6' verbose='1' draw='0'/>
<CollisionPipeline depth='6' verbose='1' draw='0'/>
<BruteForceBroadPhase/>
<BVHNarrowPhase/>
<LocalMinDistance name='localmindistance' alarmDistance='2' contactDistance='1' angleCone='0.8' coneFactor='0.8' />
<DefaultContactManager name='Response' response='FrictionContactConstraint' />
<CollisionResponse name='Response' response='FrictionContactConstraint' />

<!-- ------------------------- INTERVENTIONAL RADIOLOGY INSTRUMENTS (catheter, guidewire, coil) ------------------------------ -->

<Node name='topoLines_cath'>
<RodStraightSection name="StraightSection" youngModulus="10000" nbEdgesCollis="40" nbEdgesVisu="120" length="600.0"/>
<RodSpireSection name="SpireSection" youngModulus="10000" nbEdgesCollis="20" nbEdgesVisu="80" length="400.0" spireDiameter="4000.0" spireHeight="0.0"/>
<!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity='0.00000155' nbEdgesCollis="40" nbEdgesVisu="120" length="600.0"/>
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity='0.00000155' nbEdgesCollis="20" nbEdgesVisu="80" length="400.0" spireDiameter="4000.0" spireHeight="0.0"/>

<WireRestShape template="Rigid3d" name="catheterRestShape" wireMaterials="@StraightSection @SpireSection"/> <!-- silicone -->

Expand All @@ -49,8 +50,9 @@
<MechanicalObject template='Rigid3d' name='dofTopo1' />
</Node>
<Node name='topoLines_guide'>
<RodStraightSection name="StraightSection" youngModulus="10000" nbEdgesCollis="50" nbEdgesVisu="196" length="980.0"/>
<RodSpireSection name="SpireSection" youngModulus="10000" nbEdgesCollis="10" nbEdgesVisu="4" length="20.0" spireDiameter="25" spireHeight="0.0"/>
<!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity='0.00000155' nbEdgesCollis="50" nbEdgesVisu="196" length="980.0"/>
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity='0.00000155' nbEdgesCollis="10" nbEdgesVisu="4" length="20.0" spireDiameter="25" spireHeight="0.0"/>

<WireRestShape template="Rigid3d" name="GuideRestShape" wireMaterials="@StraightSection @SpireSection"/>

Expand All @@ -60,8 +62,9 @@
<MechanicalObject template='Rigid3d' name='dofTopo2' />
</Node>
<Node name='topoLines_coils'>
<RodStraightSection name="StraightSection" youngModulus="168000" nbEdgesCollis="30" nbEdgesVisu="360" length="540.0"/>
<RodSpireSection name="SpireSection" youngModulus="168000" nbEdgesCollis="30" nbEdgesVisu="40" length="60.0" spireDiameter="7" spireHeight="5.0"/>
<!-- platine E = 168000 MPa // 21000 Kg/m3-->
<RodStraightSection name="StraightSection" youngModulus="168000" massDensity='0.000021' nbEdgesCollis="30" nbEdgesVisu="360" length="540.0"/>
<RodSpireSection name="SpireSection" youngModulus="168000" massDensity='0.000021' nbEdgesCollis="30" nbEdgesVisu="40" length="60.0" spireDiameter="7" spireHeight="5.0"/>

<WireRestShape template="Rigid3d" name="CoilRestShape" wireMaterials="@StraightSection @SpireSection"/>

Expand All @@ -84,13 +87,13 @@
<MechanicalObject template='Rigid3d' name='DOFs' showIndices='0' ry='-90'/>

<WireBeamInterpolation name='InterpolCatheter' WireRestShape='@../topoLines_cath/catheterRestShape' radius='1' printLog='0'/>
<AdaptiveBeamForceFieldAndMass name='CatheterForceField' interpolation='@InterpolCatheter' massDensity='0.00000155'/> <!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
<AdaptiveBeamForceFieldAndMass name='CatheterForceField' interpolation='@InterpolCatheter' /> <!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->

<WireBeamInterpolation name='InterpolGuide' WireRestShape='@../topoLines_guide/GuideRestShape' radius='0.9' printLog='0'/>
<AdaptiveBeamForceFieldAndMass name='GuideForceField' interpolation='@InterpolGuide' massDensity='0.00000155'/>
<AdaptiveBeamForceFieldAndMass name='GuideForceField' interpolation='@InterpolGuide' />

<WireBeamInterpolation name='InterpolCoils' WireRestShape='@../topoLines_coils/CoilRestShape' radius='0.1' printLog='0'/>
<AdaptiveBeamForceFieldAndMass name='CoilsForceField' interpolation='@InterpolCoils' massDensity='0.000021'/> <!-- platine E = 168000 MPa // 21000 Kg/m3-->
<AdaptiveBeamForceFieldAndMass name='CoilsForceField' interpolation='@InterpolCoils' /> <!-- platine E = 168000 MPa // 21000 Kg/m3-->

<InterventionalRadiologyController template='Rigid3d' name='m_ircontroller' printLog='1' xtip='1 0 0' step='3' rotationInstrument='0 0 0'
controlledInstrument='0' startingPos='0 0 0 0 -0.7071068 0 0.7071068' speed='2' instruments='InterpolCatheter InterpolGuide InterpolCoils' />
Expand Down Expand Up @@ -154,7 +157,7 @@


<Node name='CollisionModel'>
<MeshObjLoader name='meshLoader' filename='mesh/phantom.obj' triangulate='true' flipNormals='1'/>
<MeshOBJLoader name='meshLoader' filename='mesh/phantom.obj' triangulate='true' flipNormals='1'/>
<MeshTopology position='@meshLoader.position' triangles='@meshLoader.triangles'/>
<MechanicalObject name='DOFs1' position='0 0 400' scale='3' ry='90'/>
<TriangleCollisionModel simulated='0' moving='0'/>
Expand Down
176 changes: 176 additions & 0 deletions examples/3instruments_collis_auto.scn
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<?xml version='1.0'?>
<Node name='root' dt='0.05' gravity='0 0 0'>
<Node name='Plugins'>
<RequiredPlugin name="BeamAdapter"/> <!-- Needed to use components [MultiAdaptiveBeamMapping WireBeamInterpolation WireRestShape] -->
<RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
<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 [LocalMinDistance] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [LineCollisionModel PointCollisionModel TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [LinearSolverConstraintCorrection] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [LCPConstraintSolver] -->
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedConstraint] -->
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [BTDLinearSolver] -->
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [RestShapeSpringsForceField] -->
<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 [EdgeSetGeometryAlgorithms EdgeSetTopologyContainer EdgeSetTopologyModifier QuadSetGeometryAlgorithms QuadSetTopologyContainer QuadSetTopologyModifier] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
<RequiredPlugin name="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Edge2QuadTopologicalMapping] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
</Node>
<VisualStyle displayFlags='showVisualModels showBehaviorModels showCollisionModels hideMappings hideForceFields' />
<DefaultVisualManagerLoop/>

<FreeMotionAnimationLoop />
<LCPConstraintSolver mu='0.1' tolerance='1e-10' maxIt='1000' build_lcp='false' />

<CollisionPipeline depth='6' verbose='1' draw='0'/>
<BruteForceBroadPhase/>
<BVHNarrowPhase/>
<LocalMinDistance name='localmindistance' alarmDistance='2' contactDistance='1' angleCone='0.8' coneFactor='0.8' />
<CollisionResponse name='Response' response='FrictionContactConstraint' />

<!-- ------------------------- INTERVENTIONAL RADIOLOGY INSTRUMENTS (catheter, guidewire, coil) ------------------------------ -->

<Node name='topoLines_cath'>
<!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
<RodStraightSection name="StraightSection" youngModulus="1000" massDensity='0.000155' nbEdgesCollis="40" nbEdgesVisu="120" length="600.0"/>
<RodSpireSection name="SpireSection" youngModulus="1000" massDensity='0.000155' nbEdgesCollis="20" nbEdgesVisu="80" length="400.0" spireDiameter="4000.0" spireHeight="0.0"/>

<WireRestShape template="Rigid3d" name="catheterRestShape" wireMaterials="@StraightSection @SpireSection"/> <!-- silicone -->

<EdgeSetTopologyContainer name='meshLinesCath' />
<EdgeSetTopologyModifier name='Modifier' />
<EdgeSetGeometryAlgorithms name='GeomAlgo' template='Rigid3d' />
<MechanicalObject template='Rigid3d' name='dofTopo1' />
</Node>
<Node name='topoLines_guide'>
<!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity='0.00000155' nbEdgesCollis="50" nbEdgesVisu="196" length="980.0"/>
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity='0.00000155' nbEdgesCollis="10" nbEdgesVisu="4" length="20.0" spireDiameter="25" spireHeight="0.0"/>

<WireRestShape template="Rigid3d" name="GuideRestShape" wireMaterials="@StraightSection @SpireSection"/>

<EdgeSetTopologyContainer name='meshLinesGuide' />
<EdgeSetTopologyModifier name='Modifier' />
<EdgeSetGeometryAlgorithms name='GeomAlgo' template='Rigid3d' />
<MechanicalObject template='Rigid3d' name='dofTopo2' />
</Node>
<Node name='topoLines_coils'>
<!-- platine E = 168000 MPa // 21000 Kg/m3-->
<RodStraightSection name="StraightSection" youngModulus="168000" massDensity='0.000021' nbEdgesCollis="30" nbEdgesVisu="360" length="540.0"/>
<RodSpireSection name="SpireSection" youngModulus="168000" massDensity='0.000021' nbEdgesCollis="30" nbEdgesVisu="40" length="60.0" spireDiameter="7" spireHeight="5.0"/>

<WireRestShape template="Rigid3d" name="CoilRestShape" wireMaterials="@StraightSection @SpireSection"/>

<EdgeSetTopologyContainer name='meshLinesCoils' />
<EdgeSetTopologyModifier name='Modifier' />
<EdgeSetGeometryAlgorithms name='GeomAlgo' template='Rigid3d' />
<MechanicalObject template='Rigid3d' name='dofTopo3' />
</Node>


<Node name='InstrumentCombined'>
<EulerImplicitSolver rayleighStiffness='0.2' rayleighMass='0.1' printLog='false' />
<BTDLinearSolver subpartSolve='0' verification='0' verbose='0'/>
<RegularGridTopology name='meshLinesCombined'
nx='200' ny='1' nz='1'
xmin='0.0' xmax='1.0'
ymin='0' ymax='0'
zmin='1' zmax='1'
/>
<MechanicalObject template='Rigid3d' name='DOFs' showIndices='0' ry='-90'/>

<WireBeamInterpolation name='InterpolCatheter' WireRestShape='@../topoLines_cath/catheterRestShape' radius='1' printLog='0'/>
<AdaptiveBeamForceFieldAndMass name='CatheterForceField' interpolation='@InterpolCatheter' />

<WireBeamInterpolation name='InterpolGuide' WireRestShape='@../topoLines_guide/GuideRestShape' radius='0.9' printLog='0'/>
<AdaptiveBeamForceFieldAndMass name='GuideForceField' interpolation='@InterpolGuide' />

<WireBeamInterpolation name='InterpolCoils' WireRestShape='@../topoLines_coils/CoilRestShape' radius='0.1' printLog='0'/>
<AdaptiveBeamForceFieldAndMass name='CoilsForceField' interpolation='@InterpolCoils' />

<InterventionalRadiologyController template='Rigid3d' name='m_ircontroller' printLog='1' xtip='1 0 0' step='1' rotationInstrument='0 0 0'
speed="0.01" controlledInstrument='0' startingPos='0 0 0 0 -0.7071068 0 0.7071068' instruments='InterpolCatheter InterpolGuide InterpolCoils' />

<BeamAdapterActionController name="AController" interventionController="@m_ircontroller" writeMode="1"
/>

<LinearSolverConstraintCorrection printLog='false' wire_optimization='true'/>

<FixedConstraint name='FixedConstraint' indices='0' />
<RestShapeSpringsForceField points='@m_ircontroller.indexFirstNode' stiffness='1e8' angularStiffness='1e8' />

<Node name='Collis' activated='true'>
<EdgeSetTopologyContainer name='collisEdgeSet' />
<EdgeSetTopologyModifier name='colliseEdgeModifier' />
<EdgeSetGeometryAlgorithms name='GeomAlgo' />
<MechanicalObject name='CollisionDOFs'/>
<MultiAdaptiveBeamMapping name='collisMap' controller='../m_ircontroller' useCurvAbs='1' printLog='0'/>
<LineCollisionModel proximity='0.0' group='1'/>
<PointCollisionModel proximity='0.0' group='1'/>
</Node>

<Node name='VisuCatheter' activated='true'>
<MechanicalObject name='Quads' />
<QuadSetTopologyContainer name='ContainerCath' />
<QuadSetTopologyModifier name='Modifier' />
<QuadSetGeometryAlgorithms name='GeomAlgo' template='Vec3d' />
<Edge2QuadTopologicalMapping nbPointsOnEachCircle='10' radius='2' input='@../../topoLines_cath/meshLinesCath' output='@ContainerCath' flipNormals='true'/>

<AdaptiveBeamMapping name='VisuMapCath' useCurvAbs='1' printLog='0' interpolation='@../InterpolCatheter' input='@../DOFs' output='@Quads' isMechanical='false' />

<Node name='VisuOgl' activated='true'>
<OglModel name='Visual' color='0.7 0.7 0.7' quads='@../ContainerCath.quads' material='texture Ambient 1 0.2 0.2 0.2 0.0 Diffuse 1 1.0 1.0 1.0 1.0 Specular 1 1.0 1.0 1.0 1.0 Emissive 0 0.15 0.05 0.05 0.0 Shininess 1 20'/>
<IdentityMapping input='@../Quads' output='@Visual'/>
</Node>
</Node>

<Node name='VisuGuide' activated='true'>
<MechanicalObject name='Quads' />
<QuadSetTopologyContainer name='ContainerGuide' />
<QuadSetTopologyModifier name='Modifier' />
<QuadSetGeometryAlgorithms name='GeomAlgo' template='Vec3d' />
<Edge2QuadTopologicalMapping nbPointsOnEachCircle='10' radius='1' input='@../../topoLines_guide/meshLinesGuide' output='@ContainerGuide' flipNormals='true' listening='true'/>
<AdaptiveBeamMapping name='visuMapGuide' useCurvAbs='1' printLog='0' interpolation='@../InterpolGuide' input='@../DOFs' output='@Quads' isMechanical='false' />
<Node name='VisuOgl'>
<OglModel name='Visual' color='0.2 0.2 0.8' material='texture Ambient 1 0.2 0.2 0.2 0.0 Diffuse 1 1.0 1.0 1.0 1.0 Specular 1 1.0 1.0 1.0 1.0 Emissive 0 0.15 0.05 0.05 0.0 Shininess 1 20' quads='@../ContainerGuide.quads'/>
<IdentityMapping input='@../Quads' output='@Visual'/>
</Node>
</Node>

<Node name='VisuCoils' activated='true'>
<MechanicalObject name='Quads'/>
<QuadSetTopologyContainer name='ContainerCoils' />
<QuadSetTopologyModifier name='Modifier' />
<QuadSetGeometryAlgorithms name='GeomAlgo' template='Vec3d' />
<Edge2QuadTopologicalMapping nbPointsOnEachCircle='10' radius='0.3' input='@../../topoLines_coils/meshLinesCoils' output='@ContainerCoils' flipNormals='true' listening='true' />
<AdaptiveBeamMapping name='visuMapCoils' useCurvAbs='1' printLog='0' interpolation='@../InterpolCoils' input='@../DOFs' output='@Quads' isMechanical='false' />
<Node name='VisuOgl'>
<OglModel name='Visual' color='0.2 0.8 0.2' material='texture Ambient 1 0.2 0.2 0.2 0.0 Diffuse 1 1.0 1.0 1.0 1.0 Specular 1 1.0 1.0 1.0 1.0 Emissive 0 0.15 0.05 0.05 0.0 Shininess 1 20' quads='@../ContainerCoils.quads'/>
<IdentityMapping input='@../Quads' output='@Visual'/>
</Node>
</Node>
</Node>



<Node name='CollisionModel'>
<MeshOBJLoader name='meshLoader' filename='mesh/phantom.obj' triangulate='true' flipNormals='1'/>
<MeshTopology position='@meshLoader.position' triangles='@meshLoader.triangles'/>
<MechanicalObject name='DOFs1' position='0 0 400' scale='3' ry='90'/>
<TriangleCollisionModel simulated='0' moving='0'/>
<LineCollisionModel simulated='0' moving='0'/>
<PointCollisionModel simulated='0' moving='0'/>
<OglModel name='Visual' src='@meshLoader' color='1 0 0 0.3' scale='3' ry='90'/>
</Node>



</Node>

Loading

0 comments on commit 566e8ac

Please sign in to comment.