DistanceToPlaneMapping
Mapping that computes the distance to a plane
Rigid2d
Templates:
- Rigid2d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
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 |
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 |
planeNormal | Normal of the plane to compute the distance to | |
planePoint | A point belonging to the plane |
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 |
input | Input object to map | State<Rigid2d> |
output | Output object to map | State<Vec1d> |
Rigid3d
Templates:
- Rigid3d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
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 |
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 |
planeNormal | Normal of the plane to compute the distance to | |
planePoint | A point belonging to the plane |
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 |
input | Input object to map | State<Rigid3d> |
output | Output object to map | State<Vec1d> |
Vec2d
Templates:
- Vec2d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
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 |
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 |
planeNormal | Normal of the plane to compute the distance to | |
planePoint | A point belonging to the plane |
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 |
input | Input object to map | State<Vec2d> |
output | Output object to map | State<Vec1d> |
Vec3d
Templates:
- Vec3d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
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 |
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 |
planeNormal | Normal of the plane to compute the distance to | |
planePoint | A point belonging to the plane |
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 |
input | Input object to map | State<Vec3d> |
output | Output object to map | State<Vec1d> |
Vec6d
Templates:
- Vec6d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
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 |
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 |
planeNormal | Normal of the plane to compute the distance to | |
planePoint | A point belonging to the plane |
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 |
input | Input object to map | State<Vec6d> |
output | Output object to map | State<Vec1d> |
Examples
DistanceToPlaneMapping.scn
<!-- Mechanical MassSpring Group Basic Example -->
<Node name="root" dt="0.02" gravity="0 0 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 [MinProximityIntersection] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshGmshLoader] -->
<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 [TriangleFEMForceField] -->
<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 [TriangleSetGeometryAlgorithms TriangleSetTopologyContainer TriangleSetTopologyModifier] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<FreeMotionAnimationLoop/>
<VisualStyle displayFlags="showBehaviorModels showMappings" />
<GenericConstraintSolver/>
<Node name="Langrangian-Bileateral">
<EulerImplicitSolver />
<SparseLDLSolver />
<MechanicalObject name="mstate" template="Vec3d" position="4 2 5 1 5 -8 0 1 -5 5 6 8" showObject="true" showObjectScale="0.2" drawMode="2" />
<UniformMass vertexMass="1" />
<Node name="DistanceToPlane">
<MechanicalObject name="distance" template="Vec1" rest_position="0 0 0 0"/>
<FixedLagrangianConstraint template="Vec1" fixAll="true"/>
<DistanceToPlaneMapping input="@../mstate" output="@distance" planeNormal="0 0 1" planePoint="0 0 2" />
</Node>
<UncoupledConstraintCorrection defaultCompliance="1"/>
</Node>
<Node name="Springs">
<EulerImplicitSolver rayleighMass="0.1" />
<SparseLDLSolver />
<MechanicalObject name="mstate" template="Vec3d" position="4 2 5 1 5 -8 0 1 -5 5 6 8" showColor="0 1 0 1" showObject="true" showObjectScale="0.2" drawMode="1" />
<UniformMass vertexMass="1" />
<Node name="DistanceToPlane">
<MechanicalObject name="distance" template="Vec1" rest_position="0 0 0 0"/>
<RestShapeSpringsForceField template="Vec1" stiffness="10" />
<DistanceToPlaneMapping input="@../mstate" output="@distance" planeNormal="0 0 1" planePoint="0 0 2" />
</Node>
<UncoupledConstraintCorrection defaultCompliance="1"/>
</Node>
</Node>
def createScene(root_node):
root = root_node.addChild('root', dt="0.02", gravity="0 0 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.Constraint.Projective")
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.StateContainer")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Constant")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
root.addObject('FreeMotionAnimationLoop', )
root.addObject('VisualStyle', displayFlags="showBehaviorModels showMappings")
root.addObject('GenericConstraintSolver', )
langrangian__bileateral = root.addChild('Langrangian-Bileateral')
langrangian__bileateral.addObject('EulerImplicitSolver', )
langrangian__bileateral.addObject('SparseLDLSolver', )
langrangian__bileateral.addObject('MechanicalObject', name="mstate", template="Vec3d", position="4 2 5 1 5 -8 0 1 -5 5 6 8", showObject="true", showObjectScale="0.2", drawMode="2")
langrangian__bileateral.addObject('UniformMass', vertexMass="1")
distance_to_plane = Langrangian-Bileateral.addChild('DistanceToPlane')
distance_to_plane.addObject('MechanicalObject', name="distance", template="Vec1", rest_position="0 0 0 0")
distance_to_plane.addObject('FixedLagrangianConstraint', template="Vec1", fixAll="true")
distance_to_plane.addObject('DistanceToPlaneMapping', input="@../mstate", output="@distance", planeNormal="0 0 1", planePoint="0 0 2")
langrangian__bileateral.addObject('UncoupledConstraintCorrection', defaultCompliance="1")
springs = root.addChild('Springs')
springs.addObject('EulerImplicitSolver', rayleighMass="0.1")
springs.addObject('SparseLDLSolver', )
springs.addObject('MechanicalObject', name="mstate", template="Vec3d", position="4 2 5 1 5 -8 0 1 -5 5 6 8", showColor="0 1 0 1", showObject="true", showObjectScale="0.2", drawMode="1")
springs.addObject('UniformMass', vertexMass="1")
distance_to_plane = Springs.addChild('DistanceToPlane')
distance_to_plane.addObject('MechanicalObject', name="distance", template="Vec1", rest_position="0 0 0 0")
distance_to_plane.addObject('RestShapeSpringsForceField', template="Vec1", stiffness="10")
distance_to_plane.addObject('DistanceToPlaneMapping', input="@../mstate", output="@distance", planeNormal="0 0 1", planePoint="0 0 2")
springs.addObject('UncoupledConstraintCorrection', defaultCompliance="1")