Skip to content

AttachProjectiveConstraint

This component belongs to the category of Projective Constraint. The AttachProjectiveConstraint works with a pair of objects and it projects the degrees of freedom (e.g. position) and their derivatives (e.g. velocity), so that both objects are attached. As being a projective constraint, this projective constraints ensures a geometrical connection between both objects at the end of the time step but it does not integrate the physics of both object (contrary to Lagrange based constraints).

Data

The AttachProjectiveConstraint can be initialized using three input data:

  • object1: link to the first model (MechanicalModel)
  • object2: link to the second model (MechanicalModel)
  • indices1: corresponding to the indices of the source points on the first model
  • indices2: corresponding to the indices of the fixed points on the second model
  • constraintFactor: allows for the partial application of the constraint using this factor per pair of points constrained (0=the constraint is released. 1=the constraint is fully constrained)
  • twoWay:
  • if true, this boolean projects the constraint vertices of both object1 and object2 towards their average degrees of freedom and derivatives:
    Deriv corr = (dx2-dx1)*0.5*responseFactor*getConstraintFactor(index);
          dx1 += corr;
          dx2 -= corr;
    
  • if false, the position of the object1 are projected onto the object2. Therefore, object2 only follows object1 without affecting the motion of object1
    dx2 = Deriv();
    

Usage

The AttachProjectiveConstraint requires two MechanicalObjects so that both degrees of freedom can be accessed and projected to the attached configuration. An integration scheme and a solver are also necessary to solve the linear system at each time step.

Example

This component is used as follows in XML format:

<AttachProjectiveConstraint name="AttachProjectiveConstraint" object1="@M1" object2="@M2" indices1="0 1 2" indices2="10 11 12" constraintFactor="1 1 1"/>

or using SofaPython3:

node.addObject('AttachProjectiveConstraint', object1="@M1", object2="@M2", indices1="0 1 2", indices2="10 11 12", constraintFactor="1 1 1")

An example scene involving a AttachProjectiveConstraint is available in examples/Component/Constraint/Projective/AttachProjectiveConstraint.scn

Target: Sofa.Component.Constraint.Projective

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

parents:

  • PairInteractionProjectiveConstraintSet

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
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
indices1 Indices of the source points on the first model
indices2 Indices of the fixed points on the second model
twoWay true if forces should be projected back from model2 to model1 0
freeRotations true to keep rotations free (only used for Rigid DOFs) 0
lastFreeRotation true to keep rotation of the last attached point free (only used for Rigid DOFs) 0
restRotations true to use rest rotations local offsets (only used for Rigid DOFs) 0
lastPos position at which the attach constraint should become inactive
lastDir direction from lastPos at which the attach coustraint should become inactive
clamp true to clamp particles at lastPos instead of freeing them. 0
minDistance the constraint become inactive if the distance between the points attached is bigger than minDistance. -1
positionFactor IN: Factor applied to projection of position 1
velocityFactor IN: Factor applied to projection of velocity 1
responseFactor IN: Factor applied to projection of force/acceleration 1
constraintFactor Constraint factor per pair of points constrained. 0 -> the constraint is released. 1 -> the constraint is fully constrained

Links:

Name Description
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used)
slaves Sub-objects used internally by this object
master nullptr for regular objects, or master object for which this object is one sub-objects
mechanicalStates List of mechanical states to which this component is associated
object1 First object associated to this component
object2 Second object associated to this component