Skip to content

BilateralLagrangianConstraint

This component belongs to the category of Constraint Laws used for the Lagrange constraint resolution and inherits from the PairInteractionConstraint. The BilateralLagrangianConstraint defines an holonomic constraint law between a pair of simulated body, i.e. the constraint defined between the pair of objects must have an equality form:

Such a constraint is suited for attachment cases or sliding joints. For an attachment case, if the vertex i of object 1 and the vertex j of object 2 are attached, the holonomic constraint law can be written as .

For a BilateralLagrangianConstraint, the constraint matrix (derivative of the constraint law) corresponds to:

  • for object 1
  • for object 2

As all constraint laws, the BilateralLagrangianConstraint will be called in the following functions and for the following steps:

  • getConstraintViolation(): project the free velocity in the constraint space and compute the free interpenetration
  • buildConstraintMatrix(): build the compliance made up of and

Data

As a PairInteractionConstraint, the BilateralLagrangianConstraint requires the following Data:

  • object1: link towards the object 1 to constraint
  • object2: link towards the object 2 to constraint
  • first_point: index of the constraint on the first model (object 1)
  • second_point: index of the constraint on the second model (object 2)

Usage

The BilateralLagrangianConstraint can only be used in the context of Lagrange constraint resolution. The scene must therefore contain:

  • a FreeMotionAnimationLoop
  • a ConstraintSolver

Moreover, each constrained object must define in its node a ConstraintCorrection so that the corrective motion can be applied.

Example

This component is used as follows in XML format:

<BilateralLagrangianConstraint template="Vec3d" object1="@CUBE_2/Constraints/points" object2="@CUBE_4/Constraints/points" first_point="1" second_point="0" />

or using SofaPython3:

node.addObject('BilateralLagrangianConstraint', template='Vec3d' object1='@CUBE_2/Constraints/points' object2='@CUBE_4/Constraints/points' first_point='1' second_point='0')

An example scene involving a BilateralLagrangianConstraint is available in examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_PGS.scn