DistanceFromTargetMapping
Compute edge extensions
Templates:
Rigid3d,Vec1dVec1d,Vec1dVec3d,Vec1d
Target: Sofa.Component.Mapping.NonLinear
namespace: sofa::component::mapping::nonlinear
parents:
Mapping
Data:
| Name | Description | Default value |
|---|---|---|
| name | object name | unnamed |
| printLog | if true, emits extra messages at runtime. | 0 |
| tags | list of the subsets the objet 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 |
| mapForces | Are forces mapped ? | 1 |
| mapConstraints | Are constraints mapped ? | 1 |
| mapMasses | Are masses mapped ? | 1 |
| mapMatrices | Are matrix explicit mapped? | 0 |
| applyRestPosition | set to true to apply this mapping to restPosition at init | 0 |
| geometricStiffness | Method used to compute the geometric stiffness: -None: geometric stiffness is not computed -Exact: the exact geometric stiffness is computed -Stabilized: the exact geometric stiffness is approximated in order to improve stability | Stabilized |
| indices | Indices of the parent points | |
| targetPositions | Positions to compute the distances from | |
| restLengths | Rest lengths of the connections. | |
| Visualization | ||
| showObjectScale | Scale for object display | 0 |
| showColor | Color for object display. (default=[1.0,1.0,0.0,1.0]) | 1 1 0 1 |
Links:
| Name | Description |
|---|---|
| context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) |
| slaves | Sub-objects used internally by this object |
| master | nullptr for regular objects, or master object for which this object is one sub-objects |
| input | Input object to map |
| output | Output object to map |
Examples
Component/Mapping/NonLinear/DistanceFromTargetMapping.scn
<?xml version="1.0"?>
<Node name="root" gravity="0 -9.81 0" dt="0.01">
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [StringMeshCreator] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [EigenSimplicialLLT] -->
<RequiredPlugin name="Sofa.Component.Mapping.NonLinear"/> <!-- Needed to use components [DistanceFromTargetMapping DistanceMapping] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [DiagonalMass] -->
<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.Dynamic"/> <!-- Needed to use components [EdgeSetGeometryAlgorithms EdgeSetTopologyContainer] -->
<DefaultAnimationLoop/>
<DefaultVisualManagerLoop/>
<StringMeshCreator name="loader" resolution="20" scale3d="1 1 1" />
<EulerImplicitSolver />
<EigenSimplicialLLT />
<EdgeSetTopologyContainer name="topology" position="@loader.position" edges="@loader.edges"/>
<MechanicalObject name="dofs" template="Vec3" />
<EdgeSetGeometryAlgorithms drawEdges="true" />
<DiagonalMass name="mass" totalMass="1e-3"/>
<Node name="attach">
<MechanicalObject template="Vec1"/>
<DistanceFromTargetMapping indices="0" targetPositions="0 0 0"/>
<RestShapeSpringsForceField/>
</Node>
<Node name="extensionsNode" >
<MechanicalObject template="Vec1" name="extensionsDOF" />
<DistanceMapping name="distanceMapping" topology="@../topology"/>
<RestShapeSpringsForceField/>
</Node>
</Node>
def createScene(rootNode):
root = rootNode.addChild('root', gravity="0 -9.81 0", dt="0.01")
root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Direct")
root.addObject('RequiredPlugin', name="Sofa.Component.Mapping.NonLinear")
root.addObject('RequiredPlugin', name="Sofa.Component.Mass")
root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
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('DefaultAnimationLoop')
root.addObject('DefaultVisualManagerLoop')
root.addObject('StringMeshCreator', name="loader", resolution="20", scale3d="1 1 1")
root.addObject('EulerImplicitSolver')
root.addObject('EigenSimplicialLLT')
root.addObject('EdgeSetTopologyContainer', name="topology", position="@loader.position", edges="@loader.edges")
root.addObject('MechanicalObject', name="dofs", template="Vec3")
root.addObject('EdgeSetGeometryAlgorithms', drawEdges="true")
root.addObject('DiagonalMass', name="mass", totalMass="1e-3")
attach = root.addChild('attach')
attach.addObject('MechanicalObject', template="Vec1")
attach.addObject('DistanceFromTargetMapping', indices="0", targetPositions="0 0 0")
attach.addObject('RestShapeSpringsForceField')
extensionsNode = root.addChild('extensionsNode')
extensionsNode.addObject('MechanicalObject', template="Vec1", name="extensionsDOF")
extensionsNode.addObject('DistanceMapping', name="distanceMapping", topology="@../topology")
extensionsNode.addObject('RestShapeSpringsForceField')