RigidDistanceGridCollisionModel
Grid-based distance field.
Target: SofaDistanceGrid
namespace: sofa::component::collision
parents:
- CollisionModel
- SingleStateAccessor
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
active | flag indicating if this collision model is active and should be included in default collision detections | 1 |
moving | flag indicating if this object is changing position between iterations | 1 |
simulated | flag indicating if this object is controlled by a simulation | 1 |
selfCollision | flag indication if the object can self collide | 0 |
proximity | Distance to the actual (visual) surface | 0 |
contactStiffness | Contact stiffness | 10 |
contactFriction | Contact friction coefficient (dry or viscous or unused depending on the contact method) | 0 |
contactRestitution | Contact coefficient of restitution | 0 |
contactResponse | if set, indicate to the ContactManager that this model should use the given class of contacts. Note that this is only indicative, and in particular if both collision models specify a different class it is up to the manager to choose. | |
color | color used to display the collision model if requested | 1 0 0 1 |
group | IDs of the groups containing this model. No collision can occur between collision models included in a common group (e.g. allowing the same object to have multiple collision models) | |
numberOfContacts | Number of collision models this collision model is currently attached to | 0 |
filename | Load distance grid from specified file | |
scale | scaling factor for input file | 1 |
translation | translation to apply to input file | |
rotation | rotation to apply to input file | |
sampling | if not zero: sample the surface with points approximately separated by the given sampling distance (expressed in voxels if the value is negative) | 0 |
box | Field bounding box defined by xmin,ymin,zmin, xmax,ymax,zmax | |
nx | number of values on X axis | 64 |
ny | number of values on Y axis | 64 |
nz | number of values on Z axis | 64 |
dumpfilename | write distance grid to specified file | |
usePoints | use mesh vertices for collision detection | 1 |
flipNormals | reverse surface direction, i.e. points are considered in collision if they move outside of the object instead of inside | 0 |
Visualization | ||
showMeshPoints | Enable rendering of mesh points | 1 |
showGridPoints | Enable rendering of grid points | 0 |
showMinDist | Min distance to render gradients | 0 |
showMaxDist | Max distance to render gradients | 0 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
mechanicalStates | List of mechanical states to which this component is associated | BaseMechanicalState |
previous | Previous (coarser / upper / parent level) CollisionModel in the hierarchy. | CollisionModel |
next | Next (finer / lower / child level) CollisionModel in the hierarchy. | CollisionModel |
collisionElementActiver | CollisionElementActiver component that activates or deactivates collision element(s) during execution | BaseObject |
mstate | MechanicalState used by this component | MechanicalState<Rigid3d> |
Examples
RigidDistanceGridCollisionModel_liver_DefaultAnimationLoop.scn
<?xml version="1.0"?>
<Node name="root" dt="0.005" gravity="0.0 -9.81 0">
<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 [DiscreteIntersection] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [PointCollisionModel TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TriangularFEMForceField] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [TriangularBendingSprings] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [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 [Quad2TriangleTopologicalMapping] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<RequiredPlugin name="SofaDistanceGrid"/> <!-- Needed to use components [RigidDistanceGridCollisionModel] -->
<DefaultAnimationLoop/>
<CollisionPipeline name="pipeline" depth="6" verbose="0" />
<BruteForceBroadPhase/>
<BVHNarrowPhase/>
<CollisionResponse name="response" response="PenalityContactForceField" />
<LocalMinDistance name="proximity" alarmDistance="0.3" contactDistance="0.1"/>
<Node name="RigidLiver">
<MeshOBJLoader name="meshLoader_0" filename="mesh/liver-smooth.obj"/>
<!-- The state should be defined using a Rigid template for this collision model -->
<MechanicalObject template="Rigid3d" name="dofs" position="0 0 0 0 0 0 1"/>
<RigidDistanceGridCollisionModel
filename="mesh/liver-smooth.obj"
scale="1.0"
usePoints="0"
proximity="0.1"
contactStiffness="50"
contactFriction="0.0"
/>
<Node name="Visu">
<OglModel name="VisualModel" src="@../meshLoader_0" color="white" />
</Node>
</Node>
<Node name="Cloth">
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9"/>
<RegularGridTopology
name="Container"
nx="50" ny="1" nz="50"
xmin="-9" xmax="5" ymin="7" ymax="7" zmin="-7" zmax="7"
/>
<MechanicalObject name="dofs"/>
<UniformMass totalMass="100" />
<Node name="T">
<include href="Objects/TriangleSetTopology.xml" />
<Quad2TriangleTopologicalMapping input="@../Container" output="@Container" />
<TriangularFEMForceField name="FEM" youngModulus="60" poissonRatio="0.3" method="large" />
<TriangularBendingSprings name="FEM-Bend" stiffness="300" damping="1.0" />
<TriangleCollisionModel contactStiffness="20.0"/>
<PointCollisionModel/>
<Node name="Visu">
<OglModel
name="Visual"
material="mat1
Diffuse 1 0.5 1.0 0.75 0.8
Ambient 1 0.2 0.2 0.2 1
Specular 1 0.6 0.6 0.6 0.6
Emissive 0 0 0 0 0
Shininess 0 45
"
/>
<IdentityMapping input="@../../dofs" output="@Visual" />
</Node>
</Node>
</Node>
</Node>
def createScene(root_node):
root = root_node.addChild('root', dt="0.005", gravity="0.0 -9.81 0")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Algorithm")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Intersection")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact")
root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
root.addObject('RequiredPlugin', name="Sofa.Component.Mapping.Linear")
root.addObject('RequiredPlugin', name="Sofa.Component.Mass")
root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.FEM.Elastic")
root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.Spring")
root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Grid")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Mapping")
root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
root.addObject('RequiredPlugin', name="SofaDistanceGrid")
root.addObject('DefaultAnimationLoop', )
root.addObject('CollisionPipeline', name="pipeline", depth="6", verbose="0")
root.addObject('BruteForceBroadPhase', )
root.addObject('BVHNarrowPhase', )
root.addObject('CollisionResponse', name="response", response="PenalityContactForceField")
root.addObject('LocalMinDistance', name="proximity", alarmDistance="0.3", contactDistance="0.1")
rigid_liver = root.addChild('RigidLiver')
rigid_liver.addObject('MeshOBJLoader', name="meshLoader_0", filename="mesh/liver-smooth.obj")
rigid_liver.addObject('MechanicalObject', template="Rigid3d", name="dofs", position="0 0 0 0 0 0 1")
rigid_liver.addObject('RigidDistanceGridCollisionModel', filename="mesh/liver-smooth.obj", scale="1.0", usePoints="0", proximity="0.1", contactStiffness="50", contactFriction="0.0")
visu = RigidLiver.addChild('Visu')
visu.addObject('OglModel', name="VisualModel", src="@../meshLoader_0", color="white")
cloth = root.addChild('Cloth')
cloth.addObject('EulerImplicitSolver', name="cg_odesolver", rayleighStiffness="0.1", rayleighMass="0.1")
cloth.addObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
cloth.addObject('RegularGridTopology', name="Container", nx="50", ny="1", nz="50", xmin="-9", xmax="5", ymin="7", ymax="7", zmin="-7", zmax="7")
cloth.addObject('MechanicalObject', name="dofs")
cloth.addObject('UniformMass', totalMass="100")
t = Cloth.addChild('T')
t.addObject('include', href="Objects/TriangleSetTopology.xml")
t.addObject('Quad2TriangleTopologicalMapping', input="@../Container", output="@Container")
t.addObject('TriangularFEMForceField', name="FEM", youngModulus="60", poissonRatio="0.3", method="large")
t.addObject('TriangularBendingSprings', name="FEM-Bend", stiffness="300", damping="1.0")
t.addObject('TriangleCollisionModel', contactStiffness="20.0")
t.addObject('PointCollisionModel', )
visu = T.addChild('Visu')
visu.addObject('OglModel', name="Visual", material="mat1 Diffuse 1 0.5 1.0 0.75 0.8 Ambient 1 0.2 0.2 0.2 1 Specular 1 0.6 0.6 0.6 0.6 Emissive 0 0 0 0 0 Shininess 0 45 ")
visu.addObject('IdentityMapping', input="@../../dofs", output="@Visual")
RigidDistanceGridCollisionModel_liver_FreeMotionAnimationLoop.scn
<?xml version="1.0"?>
<Node name="root" dt="0.005" gravity="0.0 -9.81 0">
<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 [DiscreteIntersection] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [PointCollisionModel TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TriangularFEMForceField] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [TriangularBendingSprings] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [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 [Quad2TriangleTopologicalMapping] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<RequiredPlugin name="SofaDistanceGrid"/> <!-- Needed to use components [RigidDistanceGridCollisionModel] -->
<RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [UncoupledConstraintCorrection] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [LCPConstraintSolver] -->
<FreeMotionAnimationLoop/>
<LCPConstraintSolver tolerance="1e-3" maxIt="1000"/>
<CollisionPipeline name="pipeline" depth="6" verbose="0" />
<BruteForceBroadPhase/>
<BVHNarrowPhase/>
<CollisionResponse name="response" response="FrictionContactConstraint" />
<LocalMinDistance name="proximity" alarmDistance="0.3" contactDistance="0.1"/>
<Node name="RigidLiver">
<MeshOBJLoader name="meshLoader_0" filename="mesh/liver-smooth.obj"/>
<!-- The state should be defined using a Rigid template for this collision model -->
<MechanicalObject template="Rigid3d" name="dofs" position="0 0 0 0 0 0 1"/>
<RigidDistanceGridCollisionModel
filename="mesh/liver-smooth.obj"
scale="1.0"
usePoints="0"
proximity="0.1"
/>
<Node name="Visu">
<OglModel name="VisualModel" src="@../meshLoader_0" color="white" />
</Node>
</Node>
<Node name="Cloth">
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9"/>
<RegularGridTopology
name="Container"
nx="50" ny="1" nz="50"
xmin="-9" xmax="5" ymin="7" ymax="7" zmin="-7" zmax="7"
/>
<MechanicalObject name="dofs"/>
<UniformMass totalMass="500" />
<UncoupledConstraintCorrection defaultCompliance="0.1"/>
<Node name="T">
<include href="Objects/TriangleSetTopology.xml" />
<Quad2TriangleTopologicalMapping input="@../Container" output="@Container" />
<TriangularFEMForceField name="FEM" youngModulus="60" poissonRatio="0.3" method="large" />
<TriangularBendingSprings name="FEM-Bend" stiffness="600" damping="1.0" />
<TriangleCollisionModel/>
<PointCollisionModel/>
<Node name="Visu">
<OglModel
name="Visual"
material="mat1
Diffuse 1 0.5 1.0 0.75 0.8
Ambient 1 0.2 0.2 0.2 1
Specular 1 0.6 0.6 0.6 0.6
Emissive 0 0 0 0 0
Shininess 0 45
"
/>
<IdentityMapping input="@../../dofs" output="@Visual" />
</Node>
</Node>
</Node>
</Node>
def createScene(root_node):
root = root_node.addChild('root', dt="0.005", gravity="0.0 -9.81 0")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Algorithm")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Intersection")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact")
root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
root.addObject('RequiredPlugin', name="Sofa.Component.Mapping.Linear")
root.addObject('RequiredPlugin', name="Sofa.Component.Mass")
root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.FEM.Elastic")
root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.Spring")
root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Grid")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Mapping")
root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
root.addObject('RequiredPlugin', name="SofaDistanceGrid")
root.addObject('RequiredPlugin', name="Sofa.Component.AnimationLoop")
root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Lagrangian.Correction")
root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Lagrangian.Solver")
root.addObject('FreeMotionAnimationLoop', )
root.addObject('LCPConstraintSolver', tolerance="1e-3", maxIt="1000")
root.addObject('CollisionPipeline', name="pipeline", depth="6", verbose="0")
root.addObject('BruteForceBroadPhase', )
root.addObject('BVHNarrowPhase', )
root.addObject('CollisionResponse', name="response", response="FrictionContactConstraint")
root.addObject('LocalMinDistance', name="proximity", alarmDistance="0.3", contactDistance="0.1")
rigid_liver = root.addChild('RigidLiver')
rigid_liver.addObject('MeshOBJLoader', name="meshLoader_0", filename="mesh/liver-smooth.obj")
rigid_liver.addObject('MechanicalObject', template="Rigid3d", name="dofs", position="0 0 0 0 0 0 1")
rigid_liver.addObject('RigidDistanceGridCollisionModel', filename="mesh/liver-smooth.obj", scale="1.0", usePoints="0", proximity="0.1")
visu = RigidLiver.addChild('Visu')
visu.addObject('OglModel', name="VisualModel", src="@../meshLoader_0", color="white")
cloth = root.addChild('Cloth')
cloth.addObject('EulerImplicitSolver', name="cg_odesolver", rayleighStiffness="0.1", rayleighMass="0.1")
cloth.addObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
cloth.addObject('RegularGridTopology', name="Container", nx="50", ny="1", nz="50", xmin="-9", xmax="5", ymin="7", ymax="7", zmin="-7", zmax="7")
cloth.addObject('MechanicalObject', name="dofs")
cloth.addObject('UniformMass', totalMass="500")
cloth.addObject('UncoupledConstraintCorrection', defaultCompliance="0.1")
t = Cloth.addChild('T')
t.addObject('include', href="Objects/TriangleSetTopology.xml")
t.addObject('Quad2TriangleTopologicalMapping', input="@../Container", output="@Container")
t.addObject('TriangularFEMForceField', name="FEM", youngModulus="60", poissonRatio="0.3", method="large")
t.addObject('TriangularBendingSprings', name="FEM-Bend", stiffness="600", damping="1.0")
t.addObject('TriangleCollisionModel', )
t.addObject('PointCollisionModel', )
visu = T.addChild('Visu')
visu.addObject('OglModel', name="Visual", material="mat1 Diffuse 1 0.5 1.0 0.75 0.8 Ambient 1 0.2 0.2 0.2 1 Specular 1 0.6 0.6 0.6 0.6 Emissive 0 0 0 0 0 Shininess 0 45 ")
visu.addObject('IdentityMapping', input="@../../dofs", output="@Visual")