Back

StickContactConstraint

sofa::component::collision::response::contact::StickContactConstraint
Contact, ContactIdentifier
Abstract (AI generated)

The `StickContactConstraint` component enforces stick-like contact constraints between various collision models by creating bilateral Lagrangian constraints and managing detection outputs within SOFA simulations.

Metadata
module
Sofa.Component.Collision.Response.Contact
namespace
sofa::component::collision::response::contact
include
sofa/component/collision/response/contact/StickContactConstraint.h
inherits
  • Contact
  • ContactIdentifier
templates
  • LineCollisionModel<sofa::sofa::defaulttype::Vec3Types>, LineCollisionModel<sofa::sofa::defaulttype::Vec3Types>
  • LineCollisionModel<sofa::sofa::defaulttype::Vec3Types>, PointCollisionModel<sofa::sofa::defaulttype::Vec3Types>
  • LineCollisionModel<sofa::sofa::defaulttype::Vec3Types>, SphereCollisionModel<sofa::sofa::defaulttype::Vec3Types>
  • PointCollisionModel<sofa::sofa::defaulttype::Vec3Types>, PointCollisionModel<sofa::sofa::defaulttype::Vec3Types>
  • SphereCollisionModel<sofa::sofa::defaulttype::Vec3Types>, PointCollisionModel<sofa::sofa::defaulttype::Vec3Types>
  • SphereCollisionModel<sofa::sofa::defaulttype::Vec3Types>, SphereCollisionModel<sofa::sofa::defaulttype::Vec3Types>
  • TriangleCollisionModel<sofa::sofa::defaulttype::Vec3Types>, LineCollisionModel<sofa::sofa::defaulttype::Vec3Types>
  • TriangleCollisionModel<sofa::sofa::defaulttype::Vec3Types>, PointCollisionModel<sofa::sofa::defaulttype::Vec3Types>
  • TriangleCollisionModel<sofa::sofa::defaulttype::Vec3Types>, SphereCollisionModel<sofa::sofa::defaulttype::Vec3Types>
  • TriangleCollisionModel<sofa::sofa::defaulttype::Vec3Types>, TriangleCollisionModel<sofa::sofa::defaulttype::Vec3Types>
description

The StickContactConstraint component in the SOFA framework is designed to handle contact constraints between various types of collision models, particularly for stick-like contacts. It inherits from the Contact and ContactIdentifier classes, indicating its role in managing contact interactions within a broader simulation context.

Governing Equations and Operators

The primary mathematical operations performed by this component involve creating bilateral Lagrangian constraints that enforce stick-like behavior at points of collision between different objects. These constraints are formulated as:
egin{equation}
\mathbf{J} \left(\mathbf{x}_1 - \mathbf{x}_2\right) = 0
\end{equation}
where $\mathbf{J}$ is the Jacobian matrix representing the geometric relationship between points of contact, and $\mathbf{x}_1$ and $\mathbf{x}_2$ are the positions of corresponding points on the two colliding objects.

Constitutive or Kinematic Laws Involved

The component does not directly involve constitutive laws (such as stress-strain relationships) but rather enforces geometric constraints. The kinematic law involves maintaining a fixed distance between contact points, which is computed based on the initial distance plus any additional distances due to the contact detection outputs.

Role in the Global FEM Pipeline

Within the global FEM pipeline:
- Assembly Phase: It contributes to assembling the Jacobian and residual terms for enforcing constraints. The constraints are added to the system of equations through Lagrange multipliers, leading to a saddle-point problem.
- Time Integration: Constraints are updated at each time step during implicit integration schemes such as Backward Euler or Newmark-type methods.
- Nonlinear Solve: The constraints contribute to the nonlinear residual and Jacobian in Newton-Raphson iterations for solving the system of equations.

Numerical Methods or Discretization Choices

The component utilizes numerical methods for:
- Filtering out duplicate contacts using a small threshold distance $\epsilon$ (e.g., $ 0.00000001f $).
- Mapping detection outputs to mechanical states via mappers such as BarycentricContactMapper, IdentityContactMapper, and RigidContactMapper.

Integration into Variational / Lagrangian Mechanics Framework

In the broader variational mechanics framework:
- The component fits within a unified physics-based simulation pipeline grounded in variational mechanics, where it enforces geometric constraints that ensure physical consistency across different components of the simulation.
- By creating bilateral constraints and updating them at each time step, StickContactConstraint helps maintain the mechanical integrity of simulated systems by enforcing stick-like contacts.

Data Fields
NameTypeDefaultHelp
d_keepAlive bool set to true to keep this contact alive even after collisions are no longer detected
Methods
void activateMappers ()
bool keepAlive () virtual
void setKeepAlive (bool val) virtual
void cleanup () virtual
std::pair<core::CollisionModel *, core::CollisionModel *> getCollisionModels () virtual
void setDetectionOutputs (OutputVector * outputs) virtual
void createResponse (core::objectmodel::BaseContext * group) virtual
void removeResponse () virtual
{
  "name": "StickContactConstraint",
  "namespace": "sofa::component::collision::response::contact",
  "module": "Sofa.Component.Collision.Response.Contact",
  "include": "sofa/component/collision/response/contact/StickContactConstraint.h",
  "doc": "",
  "inherits": [
    "Contact",
    "ContactIdentifier"
  ],
  "templates": [
    "LineCollisionModel<sofa::sofa::defaulttype::Vec3Types>, LineCollisionModel<sofa::sofa::defaulttype::Vec3Types>",
    "LineCollisionModel<sofa::sofa::defaulttype::Vec3Types>, PointCollisionModel<sofa::sofa::defaulttype::Vec3Types>",
    "LineCollisionModel<sofa::sofa::defaulttype::Vec3Types>, SphereCollisionModel<sofa::sofa::defaulttype::Vec3Types>",
    "PointCollisionModel<sofa::sofa::defaulttype::Vec3Types>, PointCollisionModel<sofa::sofa::defaulttype::Vec3Types>",
    "SphereCollisionModel<sofa::sofa::defaulttype::Vec3Types>, PointCollisionModel<sofa::sofa::defaulttype::Vec3Types>",
    "SphereCollisionModel<sofa::sofa::defaulttype::Vec3Types>, SphereCollisionModel<sofa::sofa::defaulttype::Vec3Types>",
    "TriangleCollisionModel<sofa::sofa::defaulttype::Vec3Types>, LineCollisionModel<sofa::sofa::defaulttype::Vec3Types>",
    "TriangleCollisionModel<sofa::sofa::defaulttype::Vec3Types>, PointCollisionModel<sofa::sofa::defaulttype::Vec3Types>",
    "TriangleCollisionModel<sofa::sofa::defaulttype::Vec3Types>, SphereCollisionModel<sofa::sofa::defaulttype::Vec3Types>",
    "TriangleCollisionModel<sofa::sofa::defaulttype::Vec3Types>, TriangleCollisionModel<sofa::sofa::defaulttype::Vec3Types>"
  ],
  "data_fields": [
    {
      "name": "d_keepAlive",
      "type": "bool",
      "xmlname": "keepAlive",
      "help": "set to true to keep this contact alive even after collisions are no longer detected"
    }
  ],
  "links": [],
  "methods": [
    {
      "name": "activateMappers",
      "return_type": "void",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "keepAlive",
      "return_type": "bool",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "setKeepAlive",
      "return_type": "void",
      "params": [
        {
          "name": "val",
          "type": "bool"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "cleanup",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getCollisionModels",
      "return_type": "std::pair<core::CollisionModel *, core::CollisionModel *>",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "setDetectionOutputs",
      "return_type": "void",
      "params": [
        {
          "name": "outputs",
          "type": "OutputVector *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "createResponse",
      "return_type": "void",
      "params": [
        {
          "name": "group",
          "type": "core::objectmodel::BaseContext *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "removeResponse",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `StickContactConstraint` is a SOFA component designed to handle contact constraints between different collision models, specifically for stick-like contacts in the context of interactive simulations. This component inherits from `Contact` and `ContactIdentifier`, indicating its role in managing contact interactions within the collision response framework.\n\nIt supports various collision model types including points, lines, spheres, and triangles. The component is responsible for creating bilateral Lagrangian constraints that enforce stick-like contacts between colliding objects. It manages these constraints by activating mappers to map detection outputs onto mechanical states and ensuring that the constraints are appropriately added or removed from the simulation node.\n\nKey interactions include:\n- `keepAlive`: A boolean flag that determines whether a contact should remain active even after collisions are no longer detected. This is useful for maintaining physical consistency in dynamic simulations.\n- `cleanup`: Cleans up resources and removes created constraints when necessary.\n- `setDetectionOutputs`: Processes the detection outputs to filter out duplicate contacts.\n\nThe `StickContactConstraint` also interacts with other components through methods like `createResponse`, `removeResponse`, and `getCollisionModels`. Practical usage involves configuring the collision models, setting up intersection methods, and managing contact constraints within a simulation scenario.",
  "maths": "The `StickContactConstraint` component in the SOFA framework is designed to handle contact constraints between various types of collision models, particularly for stick-like contacts. It inherits from the `Contact` and `ContactIdentifier` classes, indicating its role in managing contact interactions within a broader simulation context.\n\n### Governing Equations and Operators\n\nThe primary mathematical operations performed by this component involve creating bilateral Lagrangian constraints that enforce stick-like behavior at points of collision between different objects. These constraints are formulated as:\n\begin{equation}\n\\mathbf{J} \\left(\\mathbf{x}_1 - \\mathbf{x}_2\\right) = 0\n\\end{equation}\nwhere $\\mathbf{J}$ is the Jacobian matrix representing the geometric relationship between points of contact, and $\\mathbf{x}_1$ and $\\mathbf{x}_2$ are the positions of corresponding points on the two colliding objects.\n\n### Constitutive or Kinematic Laws Involved\n\nThe component does not directly involve constitutive laws (such as stress-strain relationships) but rather enforces geometric constraints. The kinematic law involves maintaining a fixed distance between contact points, which is computed based on the initial distance plus any additional distances due to the contact detection outputs.\n\n### Role in the Global FEM Pipeline\n\nWithin the global FEM pipeline:\n- **Assembly Phase**: It contributes to assembling the Jacobian and residual terms for enforcing constraints. The constraints are added to the system of equations through Lagrange multipliers, leading to a saddle-point problem.\n- **Time Integration**: Constraints are updated at each time step during implicit integration schemes such as Backward Euler or Newmark-type methods.\n- **Nonlinear Solve**: The constraints contribute to the nonlinear residual and Jacobian in Newton-Raphson iterations for solving the system of equations.\n\n### Numerical Methods or Discretization Choices\n\nThe component utilizes numerical methods for:\n- Filtering out duplicate contacts using a small threshold distance $\\epsilon$ (e.g., \\( 0.00000001f \\)).\n- Mapping detection outputs to mechanical states via mappers such as `BarycentricContactMapper`, `IdentityContactMapper`, and `RigidContactMapper`.\n\n### Integration into Variational / Lagrangian Mechanics Framework\n\nIn the broader variational mechanics framework:\n- The component fits within a unified physics-based simulation pipeline grounded in variational mechanics, where it enforces geometric constraints that ensure physical consistency across different components of the simulation.\n- By creating bilateral constraints and updating them at each time step, `StickContactConstraint` helps maintain the mechanical integrity of simulated systems by enforcing stick-like contacts.",
  "abstract": "The `StickContactConstraint` component enforces stick-like contact constraints between various collision models by creating bilateral Lagrangian constraints and managing detection outputs within SOFA simulations.",
  "sheet": "# StickContactConstraint\n\n## Overview\nThe `StickContactConstraint` is a SOFA component designed to handle stick-like contact constraints between different types of collision models, including points, lines, spheres, and triangles. It inherits from the `Contact` and `ContactIdentifier` classes, indicating its role in managing contact interactions within the broader simulation context.\n\n## Mathematical Model\nThe primary mathematical operations performed by this component involve creating bilateral Lagrangian constraints that enforce stick-like behavior at points of collision between different objects. These constraints are formulated as:\n\\[ \\mathbf{J} (\\mathbf{x}_1 - \\mathbf{x}_2) = 0 \\]\nwhere $\\mathbf{J}$ is the Jacobian matrix representing the geometric relationship between points of contact, and $\\mathbf{x}_1$ and $\\mathbf{x}_2$ are the positions of corresponding points on the two colliding objects.\n\n## Parameters and Data\n- **keepAlive**: A boolean flag that determines whether a contact should remain active even after collisions are no longer detected. This is useful for maintaining physical consistency in dynamic simulations.\n\n## Dependencies and Connections\nThe `StickContactConstraint` interacts with other components through methods like `createResponse`, `removeResponse`, and `getCollisionModels`. It typically requires collision models to be defined and configured, as well as intersection methods for detecting contacts. The component fits into the scene graph by managing contact constraints and ensuring that they are appropriately added or removed from the simulation node.\n\n## Practical Notes\n- **Configuration Caveats**: Ensure that appropriate collision models and intersection methods are set up to detect stick-like contacts accurately.\n- **Numerical Stability Considerations**: Use a small threshold distance $\\epsilon$ (e.g., $0.00000001f$) for filtering out duplicate contacts.\n- **Known Limitations**: The component is designed specifically for stick-like contacts and may not be suitable for other types of contact constraints."
}