Skip to content

Instantly share code, notes, and snippets.

@FantasyVR
Created May 27, 2020 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FantasyVR/c12c1fa459c682f0e116c74d9e809da3 to your computer and use it in GitHub Desktop.
Save FantasyVR/c12c1fa459c682f0e116c74d9e809da3 to your computer and use it in GitHub Desktop.
Flexible suture attached with rigid needle in sofa framwork
<?xml version="1.0"?>
<Node name="root" dt="0.01" gravity="0 0 -9.81">
<RequiredPlugin name="SofaOpenglVisual"/>
<VisualStyle displayFlags="showBehaviorModels showForceFields showCollisionModels" />
<DefaultPipeline depth="6" verbose="0" draw="0" />
<BruteForceDetection name="N2" />
<MinProximityIntersection name="Proximity" alarmDistance="0.03" contactDistance="0.02" />
<DefaultContactManager name="Response" response="default" />
<FreeMotionAnimationLoop /><!-- this is necessary in BilateralInteractionConstraint-->
<LCPConstraintSolver tolerance="1e-3" maxIt="1000"/>
<Node name="RigidNeedle">
<EulerImplicitSolver rayleighStiffness="0.01" rayleighMass="0.1" />
<CGLinearSolver iterations="25" threshold="0.00000001" />
<MechanicalObject template="Rigid3d" translation="0 0 0" rotation="0 0 0" scale3d="3 3 3"/>
<UniformMass />
<FixedConstraint name="FixedConstraint" indices="0" />
<LinearSolverConstraintCorrection /> <!-- this is necessary in BilateralInteractionConstraint-->
<Node name="Collision">
<MeshObjLoader name="loader" filename="mesh/needle/suture_needle.obj"/>
<MeshTopology src="@loader"/>
<MechanicalObject src="@loader" scale3d="1 1 1"/>
<TriangleCollisionModel contactStiffness="200"/>
<LineCollisionModel contactStiffness="@[-1].contactStiffness"/>
<PointCollisionModel contactStiffness="@[-1].contactStiffness" />
<RigidMapping/>
</Node>
<Node name="Visual" tags="Visual">
<OglModel name="Visual" src="@../Collision/loader" color="gray" scale3d="1 1 1" />
<RigidMapping input="@.." output="@Visual" />
</Node>
<Node name="Constraints">
<MechanicalObject name="DOFs" template="Rigid3d" position="0 0 -0.1 0 0 0 0" />
<RigidRigidMapping index="0" />
</Node>
</Node>
<Node name="Suture">
<EulerImplicitSolver rayleighStiffness="0" printLog="false" rayleighMass="0.1" />
<BTDLinearSolver template="BTDMatrix6d" printLog="false" verbose="false" />
<MechanicalObject template="Rigid3d" name="DOFs" position="0 0 0 0 0 0 1 1 0 0 0 0 0 1 2 0 0 0 0 0 1 3 0 0 0 0 0 1 4 0 0 0 0 0 1 5 0 0 0 0 0 1 6 0 0 0 0 0 1 7 0 0 0 0 0 1" />
<MeshTopology name="lines" lines="0 1 1 2 2 3 3 4 4 5 5 6 6 7" />
<!--FixedConstraint name="FixedConstraint" indices="0" /-->
<UniformMass vertexMass="1 1 0.01 0 0 0 0.1 0 0 0 0.1" printLog="false" />
<BeamFEMForceField name="FEM" radius="0.1" youngModulus="20000000" poissonRatio="0.49"/>
<LinearSolverConstraintCorrection /><!-- this is necessary in BilateralInteractionConstraint-->
<Node name="Collision">
<CylinderGridTopology name="coli" nx="6" ny="6" nz="7" length="7" radius=".3" axis="1 0 0" />
<MechanicalObject />
<BeamLinearMapping isMechanical="true" />
<TriangleCollisionModel />
</Node>
<Node name="Visual">
<CylinderGridTopology name="vis" nx="6" ny="6" nz="7" length="7" radius=".3" axis="1 0 0" />
<OglModel color='gray'/>
<BeamLinearMapping isMechanical="false" />
</Node>
</Node>
<BilateralInteractionConstraint template="Rigid3d" object1="@RigidNeedle/Constraints/DOFs" object2="@Suture/DOFs" first_point="0" second_point="0" />
</Node>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment