Skip to content

PlaneForceField

Repulsion along the normal to a plane.

Rigid3d

Templates:

  • Rigid3d

Target: Sofa.Component.MechanicalLoad

namespace: sofa::component::mechanicalload

parents:

  • ForceField

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
rayleighStiffness Rayleigh damping - stiffness matrix coefficient 0
normal plane normal. (default=[0,1,0])
d plane d coef. (default=0) 0
stiffness force stiffness. (default=500) 500
damping force damping. (default=5) 5
maxForce if non-null , the max force that can be applied to the object. (default=0) 0
bilateral if true the plane force field is applied on both sides. (default=false) 0
localRange optional range of local DOF indices. Any computation involving indices outside of this range are discarded (useful for parallelization using mesh partitioning) -1 -1
planeColor plane color. (default=[0.0,0.5,0.2,1.0]) 0 0.5 0.2 1
Visualization
showPlane enable/disable drawing of plane. (default=false) 0
showPlaneSize plane display size if draw is enabled. (default=10) 10
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
mstate MechanicalState used by this component MechanicalState<Rigid3d>

Vec1d

Templates:

  • Vec1d

Target: Sofa.Component.MechanicalLoad

namespace: sofa::component::mechanicalload

parents:

  • ForceField

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
rayleighStiffness Rayleigh damping - stiffness matrix coefficient 0
normal plane normal. (default=[0,1,0])
d plane d coef. (default=0) 0
stiffness force stiffness. (default=500) 500
damping force damping. (default=5) 5
maxForce if non-null , the max force that can be applied to the object. (default=0) 0
bilateral if true the plane force field is applied on both sides. (default=false) 0
localRange optional range of local DOF indices. Any computation involving indices outside of this range are discarded (useful for parallelization using mesh partitioning) -1 -1
planeColor plane color. (default=[0.0,0.5,0.2,1.0]) 0 0.5 0.2 1
Visualization
showPlane enable/disable drawing of plane. (default=false) 0
showPlaneSize plane display size if draw is enabled. (default=10) 10
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
mstate MechanicalState used by this component MechanicalState<Vec1d>

Vec2d

Templates:

  • Vec2d

Target: Sofa.Component.MechanicalLoad

namespace: sofa::component::mechanicalload

parents:

  • ForceField

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
rayleighStiffness Rayleigh damping - stiffness matrix coefficient 0
normal plane normal. (default=[0,1,0])
d plane d coef. (default=0) 0
stiffness force stiffness. (default=500) 500
damping force damping. (default=5) 5
maxForce if non-null , the max force that can be applied to the object. (default=0) 0
bilateral if true the plane force field is applied on both sides. (default=false) 0
localRange optional range of local DOF indices. Any computation involving indices outside of this range are discarded (useful for parallelization using mesh partitioning) -1 -1
planeColor plane color. (default=[0.0,0.5,0.2,1.0]) 0 0.5 0.2 1
Visualization
showPlane enable/disable drawing of plane. (default=false) 0
showPlaneSize plane display size if draw is enabled. (default=10) 10
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
mstate MechanicalState used by this component MechanicalState<Vec2d>

Vec3d

Templates:

  • Vec3d

Target: Sofa.Component.MechanicalLoad

namespace: sofa::component::mechanicalload

parents:

  • ForceField

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
rayleighStiffness Rayleigh damping - stiffness matrix coefficient 0
normal plane normal. (default=[0,1,0])
d plane d coef. (default=0) 0
stiffness force stiffness. (default=500) 500
damping force damping. (default=5) 5
maxForce if non-null , the max force that can be applied to the object. (default=0) 0
bilateral if true the plane force field is applied on both sides. (default=false) 0
localRange optional range of local DOF indices. Any computation involving indices outside of this range are discarded (useful for parallelization using mesh partitioning) -1 -1
planeColor plane color. (default=[0.0,0.5,0.2,1.0]) 0 0.5 0.2 1
Visualization
showPlane enable/disable drawing of plane. (default=false) 0
showPlaneSize plane display size if draw is enabled. (default=10) 10
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
mstate MechanicalState used by this component MechanicalState<Vec3d>

Vec6d

Templates:

  • Vec6d

Target: Sofa.Component.MechanicalLoad

namespace: sofa::component::mechanicalload

parents:

  • ForceField

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
rayleighStiffness Rayleigh damping - stiffness matrix coefficient 0
normal plane normal. (default=[0,1,0])
d plane d coef. (default=0) 0
stiffness force stiffness. (default=500) 500
damping force damping. (default=5) 5
maxForce if non-null , the max force that can be applied to the object. (default=0) 0
bilateral if true the plane force field is applied on both sides. (default=false) 0
localRange optional range of local DOF indices. Any computation involving indices outside of this range are discarded (useful for parallelization using mesh partitioning) -1 -1
planeColor plane color. (default=[0.0,0.5,0.2,1.0]) 0 0.5 0.2 1
Visualization
showPlane enable/disable drawing of plane. (default=false) 0
showPlaneSize plane display size if draw is enabled. (default=10) 10
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
mstate MechanicalState used by this component MechanicalState<Vec6d>

Examples

PlaneForceField.scn

<Node name="root" dt="0.01">
    <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 [NewProximityIntersection] -->
    <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.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 [BarycentricMapping] -->
    <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
    <RequiredPlugin name="Sofa.Component.MechanicalLoad"/> <!-- Needed to use components [PlaneForceField] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [RegularGridSpringForceField] -->
    <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.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->

    <DefaultAnimationLoop/>
    <VisualStyle displayFlags="showBehaviorModels showForceFields" />
    <CollisionPipeline depth="6" verbose="0" draw="0" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <NewProximityIntersection name="Proximity" alarmDistance="0.3" contactDistance="0.2" />
    <CollisionResponse name="Response" response="PenalityContactForceField" />
    <Node name="M1">
        <EulerImplicitSolver name="cg_odesolver" printLog="false"  rayleighStiffness="0.1" rayleighMass="0.1" />
        <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" />
        <MechanicalObject />
        <UniformMass totalMass="10" />
        <RegularGridTopology nx="2" ny="2" nz="2" xmin="-3.5" xmax="3.5" ymin="-3.5" ymax="3.5" zmin="-3.5" zmax="3.5" />
        <RegularGridSpringForceField name="Springs" stiffness="1000" />
        <PlaneForceField normal="0 1 0" d="-10" stiffness="100000" showPlane="1" showPlaneSize="20"/>
        <Node name="Visu">
            <MeshOBJLoader name="meshLoader_0" filename="mesh/smCube125.obj" handleSeams="1" />
            <OglModel name="Visual" src="@meshLoader_0" color="blue" />
            <BarycentricMapping input="@.." output="@Visual" />
        </Node>
        <Node name="Collis">
            <MeshOBJLoader name="loader" filename="mesh/smCube125.obj" />
            <MeshTopology src="@loader" />
            <MechanicalObject src="@loader" />
            <TriangleCollisionModel />
            <BarycentricMapping input="@.." output="@Collis" />
        </Node>
    </Node>
</Node>
def createScene(root_node):

   root = root_node.addChild('root', dt="0.01")

   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.MechanicalLoad")
   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.Constant")
   root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Grid")
   root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
   root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
   root.addObject('DefaultAnimationLoop', )
   root.addObject('VisualStyle', displayFlags="showBehaviorModels showForceFields")
   root.addObject('CollisionPipeline', depth="6", verbose="0", draw="0")
   root.addObject('BruteForceBroadPhase', )
   root.addObject('BVHNarrowPhase', )
   root.addObject('NewProximityIntersection', name="Proximity", alarmDistance="0.3", contactDistance="0.2")
   root.addObject('CollisionResponse', name="Response", response="PenalityContactForceField")

   m1 = root.addChild('M1')

   m1.addObject('EulerImplicitSolver', name="cg_odesolver", printLog="false", rayleighStiffness="0.1", rayleighMass="0.1")
   m1.addObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
   m1.addObject('MechanicalObject', )
   m1.addObject('UniformMass', totalMass="10")
   m1.addObject('RegularGridTopology', nx="2", ny="2", nz="2", xmin="-3.5", xmax="3.5", ymin="-3.5", ymax="3.5", zmin="-3.5", zmax="3.5")
   m1.addObject('RegularGridSpringForceField', name="Springs", stiffness="1000")
   m1.addObject('PlaneForceField', normal="0 1 0", d="-10", stiffness="100000", showPlane="1", showPlaneSize="20")

   visu = M1.addChild('Visu')

   visu.addObject('MeshOBJLoader', name="meshLoader_0", filename="mesh/smCube125.obj", handleSeams="1")
   visu.addObject('OglModel', name="Visual", src="@meshLoader_0", color="blue")
   visu.addObject('BarycentricMapping', input="@..", output="@Visual")

   collis = M1.addChild('Collis')

   collis.addObject('MeshOBJLoader', name="loader", filename="mesh/smCube125.obj")
   collis.addObject('MeshTopology', src="@loader")
   collis.addObject('MechanicalObject', src="@loader")
   collis.addObject('TriangleCollisionModel', )
   collis.addObject('BarycentricMapping', input="@..", output="@Collis")