Skip to content

Commit

Permalink
[scenes] Fix and update all carving scenes with Geomagic (#7)
Browse files Browse the repository at this point in the history
* [scenes] Fix and update haptic carving scenes

* Add carving against rigid cube

* Add scene with Geomagic and burning
  • Loading branch information
epernod authored Nov 13, 2022
1 parent bd8e444 commit 341523a
Show file tree
Hide file tree
Showing 10 changed files with 458 additions and 147 deletions.
6 changes: 3 additions & 3 deletions examples/Cube_AdvCarvingTexcoords.scn
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
<EulerImplicitSolver name="EulerImplicit" rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver name="CG Solver" iterations="25" tolerance="1e-9" threshold="1e-9"/>

<AdvancedCarvingManager name="ACarving" active="1" refineDistance="1.0" carvingDistance="0.5"
carvingWithBurning="1" drawContacts="1"/>
<AdvancedCarvingManager name="ACarving" active="1" refineDistance="1.0" carvingDistance="0.05"
carvingWithBurning="1" drawContacts="0"/>

<Node name="carvingElement">
<MechanicalObject name="Particles" template="Rigid3d" position="5 15 5 0 0 0 1" />
<MechanicalObject name="Particles" template="Rigid3d" position="5 12 5 0 0 0 1" />
<UniformMass name="Mass" totalMass="10.0" template="Rigid3d"/>
<SphereCollisionModel name="tool" radius="0.1" tags="CarvingTool"/>
<Node name="VisuTool" >
Expand Down
76 changes: 0 additions & 76 deletions examples/Geomagic-ACarving-tetra2triangle.scn

This file was deleted.

65 changes: 0 additions & 65 deletions examples/Geomagic-ACarving.scn

This file was deleted.

118 changes: 118 additions & 0 deletions examples/Geomagic-AdvCarving.scn
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?xml version="1.0" ?>
<Node name="root" dt="0.05" gravity="0 -9 0" >
<VisualStyle displayFlags="hideVisualModels hideBehaviorModels showCollisionModels hideMappings hideForceFields" />

<Node name="RequiredPlugins">
<RequiredPlugin name="Geomagic"/> <!-- Needed to use components [GeomagicDriver] -->
<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.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.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.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
<RequiredPlugin name="Sofa.Component.Haptics"/> <!-- Needed to use components [LCPForceFeedback] -->
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] -->
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
<RequiredPlugin name="Sofa.Component.Mapping.NonLinear"/> <!-- Needed to use components [RigidMapping] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [DiagonalMass, UniformMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TetrahedralCorotationalFEMForceField] -->
<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 [TetrahedronSetGeometryAlgorithms, TetrahedronSetTopologyContainer, TetrahedronSetTopologyModifier, TriangleSetGeometryAlgorithms, TriangleSetTopologyContainer, TriangleSetTopologyModifier] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
<RequiredPlugin name="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Hexa2TetraTopologicalMapping, Tetra2TriangleTopologicalMapping] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<RequiredPlugin name="InfinyToolkit" />
</Node>

<DefaultVisualManagerLoop />
<FreeMotionAnimationLoop/>
<LCPConstraintSolver tolerance="0.001" maxIt="1000"/>

<DefaultPipeline name="pipeline" depth="6" verbose="0"/>
<BruteForceBroadPhase/>
<BVHNarrowPhase/>
<DefaultContactManager name="response" response="FrictionContactConstraint" />
<MinProximityIntersection name="Proximity" alarmDistance="1.0" contactDistance="0.1" />

<GeomagicDriver name="GeomagicDevice" deviceName="Default Device" scale="1" drawDeviceFrame="1"
positionBase="0 0 0" orientationBase="0 0.707 0 -0.707" drawDevice="0"/>
<AdvancedCarvingManager active="@GeomagicDevice.button1" refineDistance="1.0" refineCriteria="0.5" carvingDistance="0.1"
carvingWithBurning="0" carvingWithRefinement="0" drawContacts="0"/>


<Node name="ToolController">
<MechanicalObject template="Rigid3" name="DOFs" position="@GeomagicDevice.positionDevice"/>
</Node>


<Node name="Hexa2Tetra" >
<RegularGridTopology name="HexaTop" n="7 7 7" min="1 0 3" max="11 10 13" />
<TetrahedronSetTopologyContainer name="Container" position="@HexaTop.position" />
<TetrahedronSetTopologyModifier name="Modifier"/>
<Hexa2TetraTopologicalMapping input="@HexaTop" output="@Container" swapping="false" />
</Node>

<Node name="Cube">
<EulerImplicitSolver name="ODE solver" rayleighStiffness="0.05" rayleighMass="1.0" />
<SparseLDLSolver template="CompressedRowSparseMatrixMat3x3d"/>
<MechanicalObject position="@../Hexa2Tetra/Container.position" name="Volume" />

<TetrahedronSetTopologyContainer name="Tetra_topo" src="@../Hexa2Tetra/Container" />
<TetrahedronSetTopologyModifier name="Modifier" />
<TetrahedronSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" drawTetrahedra="0" drawScaleTetrahedra="0.8"/>

<DiagonalMass massDensity="10.0" />

<BoxROI name="box" box="-1 -1 -1 12 0 14" drawBoxes="true" />
<FixedConstraint name="FixedConstraint" indices="@box.indices" activate_projectVelocity="1"/>

<TetrahedralCorotationalFEMForceField name="CFEM" youngModulus="5000" poissonRatio="0.3" method="large" />
<LinearSolverConstraintCorrection/>
<Node name="Surface">
<TriangleSetTopologyContainer name="Container"/>
<TriangleSetTopologyModifier name="Modifier" />
<TriangleSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" drawTriangles="0"/>
<Tetra2TriangleTopologicalMapping input="@../Tetra_topo" output="@Container" />

<TriangleCollisionModel name="triangleCol" tags="CarvingSurface"/>
<LineCollisionModel name="instrumentLine" />
<PointCollisionModel name="pointCol" tags="CarvingSurface"/>

<Node name="liver-Visual">
<OglModel name="Visual" texturename="textures/colorMap.png" />
<IdentityMapping input="@../../Volume" output="@Visual" />
</Node>
</Node>
</Node>


<Node name="Instrument" >
<EulerImplicitSolver name="ODE solver" rayleighStiffness="0.05" rayleighMass="1.0" />
<SparseLDLSolver template="CompressedRowSparseMatrixMat3x3d"/>

<MechanicalObject name="instrumentState" template="Rigid3" tags="GeomagicDevice" position="@../GeomagicDevice.positionBase"/>
<UniformMass name="mass" totalMass="0.1" />

<RestShapeSpringsForceField stiffness='1000000' angularStiffness='1000000' external_rest_shape='@../ToolController/DOFs' points='0' external_points='0' />
<LCPForceFeedback activate="true" forceCoef="0.001"/>
<LinearSolverConstraintCorrection/>

<Node name="CollisionModel" >
<MeshOBJLoader filename="./mesh/drill_collision.obj" name="loader"/>
<MeshTopology src="@loader" name="InstrumentCollisionModel" />
<MechanicalObject src="@loader" name="instrumentCollisionState" ry="-180" rz="-90" dz="3.5" dx="0.0" />
<LineCollisionModel name="instrumentLine" contactStiffness="10" />
<PointCollisionModel name="instrumentPoint" contactStiffness="10" tags="CarvingTool" />
<RigidMapping name="MM->CM mapping" input="@instrumentState" output="@instrumentCollisionState" />
</Node>
</Node>

</Node>
2 changes: 2 additions & 0 deletions examples/Geomagic-AdvCarving.scn.qglviewer.view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-26.4817 33.5874 3.80545
-0.239151 -0.629519 -0.295128 0.6778
Loading

0 comments on commit 341523a

Please sign in to comment.