<!-- 
     + Added LCP contact resolution. The modifications are:
     	 In the root node:
            ++ Added a different collision response (FrictionContact)
            ++ Added local minimal distance contact detection
            ++ Added a Master Contact solver which gets the constraints from the objects, computes the LCP and propagates the contact correction
         In the instrument node:
	    ++ Added UncoupledConstraintCorrection to compute the constraints of the related object
     -->

<Node name="root" dt="0.005" showBehaviorModels="0" showCollisionModels="0" showMappings="0" showForceFields="0" >
	
	<Object type="Gravity" name="G" gravity="0 -9.81 0" />
	<Object type="CollisionPipeline" name="pipeline" depth="6" verbose="0"/>
	<Object type="BruteForceDetection" name="detection" />
	<Object type="CollisionResponse" name="response" response="FrictionContact" />
	<Object type="LocalMinDistance" name="proximity" alarmDistance="0.15" contactDistance="0.05" angleCone="0.0" />
	<Object type="MasterContactSolver" mu="0.01"/>

	<Node name="Tooth" >
		<Node name="VisualModel" >
			<Object type="OglModel" name="ToothVisualModel" fileMesh="data/mesh/tooth_closed.obj" color="white" /> 
		</Node>
		
		<Node name="CollisionModel" > 
			<Object type="MeshLoader" filename="data/mesh/tooth_closed.obj" />
			<Object type="Mesh" name="ToothCollisionModel" />
			<Object type="MechanicalObject" name="toothState" />		
			<Object type="Triangle" name="tooth" contactStiffness="100" simulated="0" moving="0"/>
			<Object type="Line" name="tooth" contactStiffness="100" simulated="0" moving="0"/>	
			<Object type="Point" name="tooth" contactStiffness="100" simulated="0" moving="0"/>	
		</Node>
	</Node>

	<Node name="Instrument" >
		<Object type="EulerImplicitSolver" name="ODE solver" rayleighStiffness="0.05" rayleighMass="1.0" />
		<Object type="CGLinearSolver" name="linear solver" iterations="25" tolerance="1e-10" threshold="10e-10" /> 
		<Object type="MechanicalObject" name="instrumentState" template="Rigid" />
		<Object type="UniformMass" name="mass" totalmass="0.05" filename="BehaviorModels/dental_instrument.rigid" />
		<Object type="UncoupledConstraintCorrection"/>
		<Node name="VisualModel" >
			<Object type="OglModel" name="InstrumentVisualModel" fileMesh="data/mesh/dental_instrument.obj" color="1.0 0.2 0.2 1.0"/>
			<Object type="RigidMapping" name="MM->VM mapping" object1="instrumentState" object2="InstrumentVisualModel" />
		</Node>
		<Node name="CollisionModel" >
			<Object type="MeshLoader" filename="data/mesh/dental_instrument_centerline.obj" />
			<Object type="Mesh" name="InstrumentCollisionModel" />
			<Object type="MechanicalObject" name="instrumentCollisionState" />
			<Object type="Line" name="instrument" contactStiffness="10" />
			<Object type="Point" name="instrument" contactStiffness="10" /> 
			<Object type="RigidMapping" name="MM->CM mapping" object1="instrumentState" object2="instrumentCollisionState" />
		</Node>
	</Node>  
</Node>
