Skip to content

PolynomialRestShapeSpringsForceField

Simple elastic springs applied to given degrees of freedom between their current and rest shape position.

Vec3d

Templates:

  • Vec3d

Target: Sofa.Component.SolidMechanics.Spring

namespace: sofa::component::solidmechanics::spring

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 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
points points controlled by the rest shape springs
external_points points from the external Mechancial State that define the rest shape springs
polynomialStiffness coefficients for all spring polynomials
polynomialDegree vector of values that show polynomials degrees
recompute_indices Recompute indices (should be false for BBOX) 0
springColor spring color 0 1 0 1
initialLength initial virtual length of the spring
smoothShift denominator correction adding shift value 0
smoothScale denominator correction adding scale 1
Visualization
drawSpring draw Spring 0
showIndicesScale Scale for indices display. (default=0.02) 0.02
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>
external_rest_shape rest_shape can be defined by the position of an external Mechanical State MechanicalState<Vec3d>

Examples

PolynomialRestShapeSpringsForceField.scn

<Node name="root" dt="0.01" gravity="0 0 0">
    <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <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.Spring"/> <!-- Needed to use components [PolynomialRestShapeSpringsForceField] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <VisualStyle displayFlags="showForceFields"/>
    <DefaultAnimationLoop/>

    <Node name="Particle" bbox="-10 -10 -10 20 20 20" >
        <EulerImplicitSolver />
        <CGLinearSolver iterations="200" tolerance="1e-09" threshold="1e-09"/>
        <MechanicalObject template="Vec3" name="myParticle" rest_position="0 0 0" position="1.1 0 0" showObject="1" showObjectScale="10" />
        <UniformMass totalMass="1" />
        <PolynomialRestShapeSpringsForceField polynomialStiffness="10 10" polynomialDegree="2" points='0' smoothShift="0.0001" smoothScale='10000000' drawSpring='1' />
    </Node>
</Node>
def createScene(root_node):

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

   root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
   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.Visual")
   root.addObject('VisualStyle', displayFlags="showForceFields")
   root.addObject('DefaultAnimationLoop', )

   particle = root.addChild('Particle', bbox="-10 -10 -10 20 20 20")

   particle.addObject('EulerImplicitSolver', )
   particle.addObject('CGLinearSolver', iterations="200", tolerance="1e-09", threshold="1e-09")
   particle.addObject('MechanicalObject', template="Vec3", name="myParticle", rest_position="0 0 0", position="1.1 0 0", showObject="1", showObjectScale="10")
   particle.addObject('UniformMass', totalMass="1")
   particle.addObject('PolynomialRestShapeSpringsForceField', polynomialStiffness="10 10", polynomialDegree="2", points="0", smoothShift="0.0001", smoothScale="10000000", drawSpring="1")