Skip to content

ParabolicProjectiveConstraint

Apply a parabolic trajectory to given points.

Rigid3d

Templates:

  • Rigid3d

Target: Sofa.Component.Constraint.Projective

namespace: sofa::component::constraint::projective

parents:

  • ProjectiveConstraintSet

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
group ID of the group containing this constraint. This ID is used to specify which constraints are solved by which solver, by specifying in each solver which groups of constraints it should handle. 0
endTime The constraint stops acting after the given value. Use a negative value for infinite constraints -1
indices Indices of the constrained points
P1 first point of the parabol
P2 second point of the parabol
P3 third point of the parabol
BeginTime Begin Time of the motion
EndTime End Time of the motion
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>
topology link to the topology container BaseMeshTopology

Vec3d

Templates:

  • Vec3d

Target: Sofa.Component.Constraint.Projective

namespace: sofa::component::constraint::projective

parents:

  • ProjectiveConstraintSet

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
group ID of the group containing this constraint. This ID is used to specify which constraints are solved by which solver, by specifying in each solver which groups of constraints it should handle. 0
endTime The constraint stops acting after the given value. Use a negative value for infinite constraints -1
indices Indices of the constrained points
P1 first point of the parabol
P2 second point of the parabol
P3 third point of the parabol
BeginTime Begin Time of the motion
EndTime End Time of the motion
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>
topology link to the topology container BaseMeshTopology

Examples

ParabolicProjectiveConstraint.scn

<Node dt="0.01" multiThreadSimulation="0" name="root" time="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 [NewProximityIntersection] -->
    <RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [SphereCollisionModel TriangleCollisionModel] -->
    <RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
    <RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [ParabolicProjectiveConstraint] -->
    <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader SphereLoader] -->
    <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <RequiredPlugin name="Sofa.Component.Mapping.NonLinear"/> <!-- Needed to use components [RigidMapping] -->
    <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.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->

    <DefaultAnimationLoop/>
    <VisualStyle displayFlags="showVisual showBehaviorModels" />
    <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="LiverParabolic">
        <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 template="Rigid3" name="DOFs" position="0 0 0 0 0 0 1" />
        <UniformMass name="mass" totalMass="1" showAxisSizeFactor="0.1" />
        <ParabolicProjectiveConstraint name="parabol" indices="0" P1="1 0 0" P2="5 3 1" P3="7 6 -5" BeginTime="0.5" EndTime="1.5" />
        <Node name="Visu">
            <MeshOBJLoader name="meshLoader_1" filename="mesh/liver-smooth.obj" handleSeams="1" />
            <OglModel name="VisualModel" src="@meshLoader_1" color="red" />
            <RigidMapping input="@.." output="@VisualModel" name="visual mapping" />
        </Node>
        <Node name="Surf">
        <SphereLoader filename="mesh/liver.sph" />
            <MechanicalObject position="@[-1].position" />
            <SphereCollisionModel name="CollisionModel" listRadius="@[-2].listRadius" />
            <RigidMapping name="sphere mapping" />
        </Node>
    </Node>
    <Node name="CubeFixed">
        <MeshOBJLoader name="loader" filename="mesh/cube.obj" />
        <MeshTopology src="@loader" />
        <MechanicalObject src="@loader" scale="20" dz="-35" />
        <TriangleCollisionModel simulated="0" moving="0" />
        <MeshOBJLoader name="meshLoader_0" filename="mesh/cube.obj" scale="20" handleSeams="1" />
        <OglModel name="Visual" src="@meshLoader_0" color="gray" dz="-35" />
    </Node>
</Node>
def createScene(root_node):

   root = root_node.addChild('root', dt="0.01", multiThreadSimulation="0", time="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.NonLinear")
   root.addObject('RequiredPlugin', name="Sofa.Component.Mass")
   root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
   root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Constant")
   root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
   root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
   root.addObject('DefaultAnimationLoop', )
   root.addObject('VisualStyle', displayFlags="showVisual showBehaviorModels")
   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")

   liver_parabolic = root.addChild('LiverParabolic')

   liver_parabolic.addObject('EulerImplicitSolver', name="cg_odesolver", printLog="false", rayleighStiffness="0.1", rayleighMass="0.1")
   liver_parabolic.addObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
   liver_parabolic.addObject('MechanicalObject', template="Rigid3", name="DOFs", position="0 0 0 0 0 0 1")
   liver_parabolic.addObject('UniformMass', name="mass", totalMass="1", showAxisSizeFactor="0.1")
   liver_parabolic.addObject('ParabolicProjectiveConstraint', name="parabol", indices="0", P1="1 0 0", P2="5 3 1", P3="7 6 -5", BeginTime="0.5", EndTime="1.5")

   visu = LiverParabolic.addChild('Visu')

   visu.addObject('MeshOBJLoader', name="meshLoader_1", filename="mesh/liver-smooth.obj", handleSeams="1")
   visu.addObject('OglModel', name="VisualModel", src="@meshLoader_1", color="red")
   visu.addObject('RigidMapping', input="@..", output="@VisualModel", name="visual mapping")

   surf = LiverParabolic.addChild('Surf')

   surf.addObject('SphereLoader', filename="mesh/liver.sph")
   surf.addObject('MechanicalObject', position="@[-1].position")
   surf.addObject('SphereCollisionModel', name="CollisionModel", listRadius="@[-2].listRadius")
   surf.addObject('RigidMapping', name="sphere mapping")

   cube_fixed = root.addChild('CubeFixed')

   cube_fixed.addObject('MeshOBJLoader', name="loader", filename="mesh/cube.obj")
   cube_fixed.addObject('MeshTopology', src="@loader")
   cube_fixed.addObject('MechanicalObject', src="@loader", scale="20", dz="-35")
   cube_fixed.addObject('TriangleCollisionModel', simulated="0", moving="0")
   cube_fixed.addObject('MeshOBJLoader', name="meshLoader_0", filename="mesh/cube.obj", scale="20", handleSeams="1")
   cube_fixed.addObject('OglModel', name="Visual", src="@meshLoader_0", color="gray", dz="-35")