Skip to content

InteractionEllipsoidForceField

Outward / inward repulsion applied by an ellipsoid geometry, which can possibly act on several objects.

Vec3d,Rigid3d

Templates:

  • Vec3d,Rigid3d

Target: Sofa.Component.MechanicalLoad

namespace: sofa::component::mechanicalload

parents:

  • MixedInteractionForceField

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
rayleighStiffness Rayleigh damping - stiffness matrix coefficient 0
contacts Contacts
center ellipsoid center
vradius ellipsoid radius
stiffness force stiffness (positive to repulse outward, negative inward) 500
damping force damping 5
color ellipsoid color. (default=[0.0,0.5,1.0,1.0]) 0 0.5 1 1
object2_dof_index Dof index of object 2 where the forcefield is attached 0
object2_forces enable/disable propagation of forces to object 2 1
object2_invert inverse transform from object 2 (use when object 1 is in local coordinates within a frame defined by object 2) 0
Visualization
draw enable/disable drawing of the ellipsoid 1
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
object1 First object associated to this component MechanicalState<Vec3d>
object2 Second object associated to this component MechanicalState<Rigid3d>

Examples

InteractionEllipsoidForceField.scn

<!-- Mechanical InteractionEllipsoidForceField Example -->
<Node name="root" gravity="0.0 -2.0 0.0" dt="0.04">
    <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.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
    <RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint PartialFixedProjectiveConstraint] -->
    <RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
    <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.MechanicalLoad"/> <!-- Needed to use components [InteractionEllipsoidForceField] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Forward"/> <!-- Needed to use components [EulerExplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField QuadBendingSprings] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <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 showInteractionForceFields showVisual" />
    <CollisionPipeline verbose="0" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <CollisionResponse name="Response" />
    <NewProximityIntersection alarmDistance="0.002" contactDistance="0.001" />
    <Node name="RotatingObstacle">
        <EulerExplicitSolver name="odesolver" printLog="false" />
        <MechanicalObject name="MS2" template="Rigid3" position="0 5 3 0 0 0 1" velocity="0 0 0 -0.1 0 0" />
        <UniformMass totalMass="1" />
        <PartialFixedProjectiveConstraint indices="0" fixedDirections="1 1 1 0 0 0" />
    </Node>
    <Node name="SquareCloth1">
        <EulerImplicitSolver name="odesolver" printLog="false"  rayleighStiffness="0.1" rayleighMass="0.1" />
        <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" />
        <MechanicalObject name="MS1" />
        <UniformMass totalMass="100" />
        <RegularGridTopology nx="20" ny="1" nz="20" xmin="12" xmax="-12" ymin="7" ymax="7" zmin="-12" zmax="12" />
        <BoxROI name="box1" box="-12 7 12 -10 7 12" />
        <FixedProjectiveConstraint indices="@box1.indices"/>
        <BoxROI name="box2" box="-12 7 12 -10 7 12" />
        <FixedProjectiveConstraint indices="@box2.indices"/>
        <MeshSpringForceField name="Springs" stiffness="2000" damping="0" />
        <QuadBendingSprings name="Bend" stiffness="20" damping="0" />
        <InteractionEllipsoidForceField template="Vec3,Rigid3" object1="@MS1" object2="@../RotatingObstacle/MS2" stiffness="1000" damping="1" center="0 0 0 0 -5 0" vradius="6 2 4   2 4 2" object2_forces="false" object2_invert="false" />
        <!--EllipsoidForceField stiffness="1000" damping="1" center="0 5 3" vradius="6 2 6" /-->
        <Node name="Visu">
            <OglModel name="Visual" color="green" />
            <IdentityMapping input="@.." output="@Visual" />
        </Node>
    </Node>
</Node>
def createScene(root_node):

   root = root_node.addChild('root', gravity="0.0 -2.0 0.0", dt="0.04")

   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.Response.Contact")
   root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
   root.addObject('RequiredPlugin', name="Sofa.Component.Engine.Select")
   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.ODESolver.Forward")
   root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.Spring")
   root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   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 showInteractionForceFields showVisual")
   root.addObject('CollisionPipeline', verbose="0")
   root.addObject('BruteForceBroadPhase', )
   root.addObject('BVHNarrowPhase', )
   root.addObject('CollisionResponse', name="Response")
   root.addObject('NewProximityIntersection', alarmDistance="0.002", contactDistance="0.001")

   rotating_obstacle = root.addChild('RotatingObstacle')

   rotating_obstacle.addObject('EulerExplicitSolver', name="odesolver", printLog="false")
   rotating_obstacle.addObject('MechanicalObject', name="MS2", template="Rigid3", position="0 5 3 0 0 0 1", velocity="0 0 0 -0.1 0 0")
   rotating_obstacle.addObject('UniformMass', totalMass="1")
   rotating_obstacle.addObject('PartialFixedProjectiveConstraint', indices="0", fixedDirections="1 1 1 0 0 0")

   square_cloth1 = root.addChild('SquareCloth1')

   square_cloth1.addObject('EulerImplicitSolver', name="odesolver", printLog="false", rayleighStiffness="0.1", rayleighMass="0.1")
   square_cloth1.addObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
   square_cloth1.addObject('MechanicalObject', name="MS1")
   square_cloth1.addObject('UniformMass', totalMass="100")
   square_cloth1.addObject('RegularGridTopology', nx="20", ny="1", nz="20", xmin="12", xmax="-12", ymin="7", ymax="7", zmin="-12", zmax="12")
   square_cloth1.addObject('BoxROI', name="box1", box="-12 7 12 -10 7 12")
   square_cloth1.addObject('FixedProjectiveConstraint', indices="@box1.indices")
   square_cloth1.addObject('BoxROI', name="box2", box="-12 7 12 -10 7 12")
   square_cloth1.addObject('FixedProjectiveConstraint', indices="@box2.indices")
   square_cloth1.addObject('MeshSpringForceField', name="Springs", stiffness="2000", damping="0")
   square_cloth1.addObject('QuadBendingSprings', name="Bend", stiffness="20", damping="0")
   square_cloth1.addObject('InteractionEllipsoidForceField', template="Vec3,Rigid3", object1="@MS1", object2="@../RotatingObstacle/MS2", stiffness="1000", damping="1", center="0 0 0 0 -5 0", vradius="6 2 4   2 4 2", object2_forces="false", object2_invert="false")

   visu = SquareCloth1.addChild('Visu')

   visu.addObject('OglModel', name="Visual", color="green")
   visu.addObject('IdentityMapping', input="@..", output="@Visual")