Contact
The `Contact` component in the SOFA framework is responsible for handling contact response between pairs of models. It is dynamically created by the `ContactManager`, and it persists across iterations to maintain contact history via new id data in `DetectionOutput`. The `Contact` object typically creates and initializes real response components such as InteractionForceField or Constraints, and it appears dynamically within the scenegraph. The component interacts with other SOFA components through its API, which includes methods like `getCollisionModels`, `setDetectionOutputs`, `createResponse`, and `removeResponse`. These methods are virtual and pure-virtual to ensure that derived classes provide concrete implementations. The `Contact` object also supports controlling whether it should remain active (`keepAlive`) even when the objects are no longer in collision. Usage of this component involves configuring contact detection and response behaviors within simulations, primarily through its API methods and interactions with other components like `DetectionOutput`, `InteractionForceField`, and `Constraint`. The `Contact` object itself is abstract and serves as a base for more specific contact handling implementations.
- abstract
- The `Contact` component handles contact response between pairs of models in SOFA simulations, dynamically created by the ContactManager to persist across iterations and maintain contact history via DetectionOutput.
- sheet
- # Contact **Overview** The `Contact` component is an abstract base class responsible for handling contact response between pairs of models within a SOFA simulation. It is dynamically created by the `ContactManager`, persists across iterations, and maintains contact history through new id data in `DetectionOutput`. This component typically creates and initializes real response components such as InteractionForceField or Constraints. **Dependencies and Connections** The `Contact` object interacts with other SOFA components via its API methods. It requires the `ContactManager` for dynamic creation, exchanges data with `CollisionModel`, and initializes specific contact handling mechanisms like `InteractionForceField` and `Constraint`. The component is part of the scene graph and fits into the broader simulation framework by managing contact detection and response.
- description
- The `Contact` component in the SOFA framework is responsible for handling contact response between pairs of models. It is dynamically created by the `ContactManager`, and it persists across iterations to maintain contact history via new id data in `DetectionOutput`. The `Contact` object typically creates and initializes real response components such as InteractionForceField or Constraints, and it appears dynamically within the scenegraph. The component interacts with other SOFA components through its API, which includes methods like `getCollisionModels`, `setDetectionOutputs`, `createResponse`, and `removeResponse`. These methods are virtual and pure-virtual to ensure that derived classes provide concrete implementations. The `Contact` object also supports controlling whether it should remain active (`keepAlive`) even when the objects are no longer in collision. Usage of this component involves configuring contact detection and response behaviors within simulations, primarily through its API methods and interactions with other components like `DetectionOutput`, `InteractionForceField`, and `Constraint`. The `Contact` object itself is abstract and serves as a base for more specific contact handling implementations.
- maths
- <maths_md_description> ### Mathematical and Physical Description of the `Contact` Component in SOFA Framework The `Contact` component in the SOFA framework is an abstract base class responsible for handling contact response between pairs of models. It plays a crucial role in maintaining physical interactions within simulations, particularly where objects come into close proximity or collision. #### Key Concepts and Methods: 1. **Persistent Contact Handling**: - The `Contact` object persists across iterations to maintain the history of contacts via new id data in `DetectionOutput`. This is essential for tracking contact dynamics over time. 2. **Creation by `ContactManager`**: - The `ContactManager` dynamically creates instances of `Contact`, ensuring that all necessary contact responses are managed throughout the simulation. 3. **Interaction with Other Components**: - The `Contact` object interacts with other SOFA components through its API methods, including `getCollisionModels`, `setDetectionOutputs`, `createResponse`, and `removeResponse`. These methods ensure proper initialization and cleanup of contact handling mechanisms. 4. **Virtual Methods for Customization**: - Methods like `getCollisionModels`, `setDetectionOutputs`, `createResponse`, and `removeResponse` are virtual and pure-virtual, allowing derived classes to provide specific implementations tailored to different types of contacts or interactions. 5. **Keep-Alive Mechanism**: - The `keepAlive` method controls whether a contact should remain active even when the objects are no longer in collision. This is useful for maintaining certain physical properties or constraints beyond direct collisions. #### Mathematical and Physical Models Involved: The `Contact` component involves several mathematical and physical models, primarily related to collision detection and response mechanisms. Here are some key aspects: 1. **Collision Detection**: - Collision detection is a fundamental aspect of the `Contact` object’s functionality. It typically involves geometric algorithms to determine whether two or more objects intersect or come close enough to initiate contact. 2. **Response Mechanisms**: - Once a collision is detected, the response mechanisms are triggered. This can involve enforcing constraints (e.g., non-penetration), applying forces (e.g., repulsive forces to prevent overlap), and updating velocities based on impulse calculations. 3. **Force Fields**: - The `Contact` object may interact with force fields such as the `InteractionForceField`, which applies specific forces between colliding objects. These forces can be computed based on physical principles like Hooke's Law for springs or more complex models depending on the material properties and geometry of the interacting objects. 4. **Constraint Solvers**: - For rigid-body dynamics, constraint solvers may be employed to enforce constraints such as non-penetration conditions. These solvers typically solve systems of equations derived from physical principles like Newton's laws of motion and Lagrangian mechanics. #### Example Usage and Configuration: The `Contact` component can be configured within a SOFA simulation to handle various types of contact scenarios, including: - **Point-to-Surface Contacts**: Where one object is treated as a point and the other as a surface. The response could involve calculating forces based on the distance between the point and the closest surface. - **Surface-to-Surface Contacts**: Involving more complex interactions where both objects are surfaces. Here, methods like penalty-based approaches or constraint solvers can be used to handle the contacts. In summary, the `Contact` component in SOFA is a crucial element for handling physical interactions and maintaining the integrity of simulations involving object collisions. Its abstract nature allows for flexibility and customization through derived classes, ensuring that diverse contact scenarios can be accurately modeled.</maths_md_description>
{
"name": "Contact",
"main": {
"name": "Contact",
"namespace": "sofa::core::collision",
"module": "Sofa.framework.Core",
"include": "sofa/core/collision/Contact.h",
"doc": "contact response component handling the response between a pair of models\n- Dynamically created by the ContactManager\n -# Persistent between iterations\n -# New id data in DetectionOutput allow to keep an history of a contact\n- In most cases : create and initialize the real response component\n -#InteractionForceField, Constraint, ...\n- Contact object dynamically appears in the scenegraph",
"inherits": [
"BaseObject"
],
"templates": [],
"data_fields": [],
"links": [],
"methods": [
{
"name": "getCollisionModels",
"return_type": "std::pair<core::CollisionModel *, core::CollisionModel *>",
"params": [],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "setDetectionOutputs",
"return_type": "void",
"params": [
{
"name": "outputs",
"type": "DetectionOutputVector *"
}
],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "createResponse",
"return_type": "void",
"params": [
{
"name": "group",
"type": "objectmodel::BaseContext *"
}
],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "removeResponse",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"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": "",
"type": "bool"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "Create",
"return_type": "int",
"params": [
{
"name": "type",
"type": "const int &"
},
{
"name": "model1",
"type": "core::CollisionModel *"
},
{
"name": "model2",
"type": "core::CollisionModel *"
},
{
"name": "intersectionMethod",
"type": "Intersection *"
},
{
"name": "verbose",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
}
]
},
"desc": {
"description": "The `Contact` component in the SOFA framework is responsible for handling contact response between pairs of models. It is dynamically created by the `ContactManager`, and it persists across iterations to maintain contact history via new id data in `DetectionOutput`. The `Contact` object typically creates and initializes real response components such as InteractionForceField or Constraints, and it appears dynamically within the scenegraph.\n\nThe component interacts with other SOFA components through its API, which includes methods like `getCollisionModels`, `setDetectionOutputs`, `createResponse`, and `removeResponse`. These methods are virtual and pure-virtual to ensure that derived classes provide concrete implementations. The `Contact` object also supports controlling whether it should remain active (`keepAlive`) even when the objects are no longer in collision.\n\nUsage of this component involves configuring contact detection and response behaviors within simulations, primarily through its API methods and interactions with other components like `DetectionOutput`, `InteractionForceField`, and `Constraint`. The `Contact` object itself is abstract and serves as a base for more specific contact handling implementations."
},
"maths": {
"maths": "<maths_md_description>\n\n### Mathematical and Physical Description of the `Contact` Component in SOFA Framework\n\nThe `Contact` component in the SOFA framework is an abstract base class responsible for handling contact response between pairs of models. It plays a crucial role in maintaining physical interactions within simulations, particularly where objects come into close proximity or collision.\n\n#### Key Concepts and Methods:\n\n1. **Persistent Contact Handling**:\n - The `Contact` object persists across iterations to maintain the history of contacts via new id data in `DetectionOutput`. This is essential for tracking contact dynamics over time.\n\n2. **Creation by `ContactManager`**:\n - The `ContactManager` dynamically creates instances of `Contact`, ensuring that all necessary contact responses are managed throughout the simulation.\n\n3. **Interaction with Other Components**:\n - The `Contact` object interacts with other SOFA components through its API methods, including `getCollisionModels`, `setDetectionOutputs`, `createResponse`, and `removeResponse`. These methods ensure proper initialization and cleanup of contact handling mechanisms.\n\n4. **Virtual Methods for Customization**:\n - Methods like `getCollisionModels`, `setDetectionOutputs`, `createResponse`, and `removeResponse` are virtual and pure-virtual, allowing derived classes to provide specific implementations tailored to different types of contacts or interactions.\n\n5. **Keep-Alive Mechanism**:\n - The `keepAlive` method controls whether a contact should remain active even when the objects are no longer in collision. This is useful for maintaining certain physical properties or constraints beyond direct collisions.\n\n#### Mathematical and Physical Models Involved:\n\nThe `Contact` component involves several mathematical and physical models, primarily related to collision detection and response mechanisms. Here are some key aspects:\n\n1. **Collision Detection**:\n - Collision detection is a fundamental aspect of the `Contact` object’s functionality. It typically involves geometric algorithms to determine whether two or more objects intersect or come close enough to initiate contact.\n\n2. **Response Mechanisms**:\n - Once a collision is detected, the response mechanisms are triggered. This can involve enforcing constraints (e.g., non-penetration), applying forces (e.g., repulsive forces to prevent overlap), and updating velocities based on impulse calculations.\n\n3. **Force Fields**:\n - The `Contact` object may interact with force fields such as the `InteractionForceField`, which applies specific forces between colliding objects. These forces can be computed based on physical principles like Hooke's Law for springs or more complex models depending on the material properties and geometry of the interacting objects.\n\n4. **Constraint Solvers**:\n - For rigid-body dynamics, constraint solvers may be employed to enforce constraints such as non-penetration conditions. These solvers typically solve systems of equations derived from physical principles like Newton's laws of motion and Lagrangian mechanics.\n\n#### Example Usage and Configuration:\n\nThe `Contact` component can be configured within a SOFA simulation to handle various types of contact scenarios, including:\n\n- **Point-to-Surface Contacts**: Where one object is treated as a point and the other as a surface. The response could involve calculating forces based on the distance between the point and the closest surface.\n\n- **Surface-to-Surface Contacts**: Involving more complex interactions where both objects are surfaces. Here, methods like penalty-based approaches or constraint solvers can be used to handle the contacts.\n\nIn summary, the `Contact` component in SOFA is a crucial element for handling physical interactions and maintaining the integrity of simulations involving object collisions. Its abstract nature allows for flexibility and customization through derived classes, ensuring that diverse contact scenarios can be accurately modeled.</maths_md_description>"
},
"summary": {
"abstract": "The `Contact` component handles contact response between pairs of models in SOFA simulations, dynamically created by the ContactManager to persist across iterations and maintain contact history via DetectionOutput.",
"sheet": "# Contact\n\n**Overview**\n\nThe `Contact` component is an abstract base class responsible for handling contact response between pairs of models within a SOFA simulation. It is dynamically created by the `ContactManager`, persists across iterations, and maintains contact history through new id data in `DetectionOutput`. This component typically creates and initializes real response components such as InteractionForceField or Constraints.\n\n**Dependencies and Connections**\n\nThe `Contact` object interacts with other SOFA components via its API methods. It requires the `ContactManager` for dynamic creation, exchanges data with `CollisionModel`, and initializes specific contact handling mechanisms like `InteractionForceField` and `Constraint`. The component is part of the scene graph and fits into the broader simulation framework by managing contact detection and response."
}
}