MinProximityIntersection
A set of methods to compute if two primitives are close enough to consider they collide. Basic intersection methods using proximities It uses proximities on cubes and spheres, but supported pairs of collision models can be extended. For example, see MeshMinProximityIntersection which adds support for additional types of intersection. Supported by default: - Cube/Cube - Sphere/Sphere (rigid or vec3) MeshMinProximityIntersection adds support for: - Point/Point (if d_usePointPoint is true) - Line/Point (if d_useLinePoint is true) - Line/Line (if d_useLineLine is true) - Triangle/Point - Sphere/Point (if d_useSphereTriangle is true) - RigidSphere/Point (if d_useSphereTriangle is true) - Triangle/Sphere (if d_useSphereTriangle is true) - Triangle/RigidSphere (if d_useSphereTriangle is true) - Line/Sphere (if d_useSphereTriangle is true) - Line/RigidSphere (if d_useSphereTriangle is true) Note that MeshMinProximityIntersection ignores Triangle/Line and Triangle/Triangle intersections. Datas can be set to ignore some pairs of collision models (d_useSphereTriangle, d_usePointPoint, etc).
The `MinProximityIntersection` component determines if geometric primitives (cubes, spheres) are close enough to be considered intersecting and supports various types of collision models through configurable parameters.
- module
- Sofa.Component.Collision.Detection.Intersection
- namespace
- sofa::component::collision::detection::intersection
- include
- sofa/component/collision/detection/intersection/MinProximityIntersection.h
- inherits
-
- BaseProximityIntersection
- summary
- details
-
- MinProximityIntersection is derived from BaseProximityIntersection and extends its functionality to support various types of collision models, including cubes and spheres. It can be further extended through other components like MeshMinProximityIntersection for additional intersection tests.
- The component supports default intersections between the following pairs:
- - Cube/Cube
- - Sphere/Sphere (rigid or vec3)
- Additional intersection types that can be enabled include:
- - Point/Point
- - Line/Point
- - Line/Line
- - Triangle/Point
- - Sphere/Point
- - RigidSphere/Point
- - Triangle/Sphere
- - Triangle/RigidSphere
- - Line/Sphere
- - Line/RigidSphere
- Intersection types can be enabled or disabled using the following data fields:
- - d_useSphereTriangle: Activates Sphere-Triangle intersection tests.
- - d_usePointPoint: Activates Point-Point intersection tests.
- - d_useSurfaceNormals: Computes norms of detection outputs by considering surface normals.
- - d_useLinePoint: Activates Line-Point intersection tests.
- - d_useLineLine: Activates Line-Line intersection tests.
- methods
-
{ "computeIntersection(Cube\u0026 cube1, Cube\u0026 cube2, OutputVector* contacts, const core::collision::Intersection* currentIntersection)": "Computes intersections between two cubes and stores contact points in an output vector.", "computeIntersection(SphereType1\u0026 sph1, SphereType2\u0026 sph2, OutputVector* contacts, const core::collision::Intersection* currentIntersection)": "Computes intersections between two spheres and stores contact points in an output vector.", "getUseSurfaceNormals() const": "Returns whether to compute norms of detection outputs by considering surface normals.", "init()": "Initializes the intersectors for Cube and Sphere collision models. It also adds additional supported pairs from other components like MeshMinProximityIntersection.", "testIntersection(Cube\u0026 cube1, Cube\u0026 cube2, const core::collision::Intersection* currentIntersection)": "Tests if two cubes are in proximity based on the current intersection settings.", "testIntersection(SphereType1\u0026 sph1, SphereType2\u0026 sph2, const core::collision::Intersection* currentIntersection)": "Tests if two spheres are within the alarm distance based on their contact distances." } - usage
-
- MinProximityIntersection is used to determine whether geometric primitives are close enough to be considered intersecting. This class provides basic methods for proximity checks and can be extended by other components to support additional intersection types.
Mathematical and Physical Description of MinProximityIntersection
Governing Equations or Operators
- Test Intersection: The
testIntersectionmethods determine if two geometric primitives are within a specified proximity threshold. These tests do not compute exact intersections but rather check for closeness based on predefined distances. - For Cubes:
$$ \text{testIntersection}(\text{cube1}, \text{cube2}) = egin{cases} \text{True}, & \text{if the cubes are within a certain alarm distance}\\ \text{False}, & \text{otherwise} \end{cases}$$ - For Spheres:
$$ \text{testIntersection}(\text{sph1}, \text{sph2}) = egin{cases} \text{True}, & \text{if the spheres are within an alarm distance given by } d_{alarm} + r_1 + r_2\\ \text{False}, & \text{otherwise} \end{cases}$$
where $d_{alarm}$ is the alarm distance, and $r_1$, $r_2$ are the radii of spheres. - Compute Intersection: The
computeIntersectionmethods compute contact points between two geometric primitives. These methods store the computed contacts in an output vector. - For Cubes:
$$ \text{computeIntersection}(\text{cube1}, \text{cube2}) = \begin{cases} \text{contacts}, & \text{the contact points between the cubes} \end{cases}$$ - For Spheres:
$$ \text{computeIntersection}(\text{sph1}, \text{sph2}) = \begin{cases} \text{contacts}, & \text{the contact points between the spheres based on alarm and contact distances} \end{cases}$$
Constitutive or Kinematic Laws Involved
- Proximity Tests: The proximity tests are based on geometric distances and do not involve constitutive laws directly. However, they rely on the definition of radii for spheres and bounding boxes for cubes.
- For spheres: $d_{alarm} = d_{currentAlarm} + r_1 + r_2$, where $d_{currentAlarm}$ is the alarm distance from the current intersection settings.
Role in the Global FEM Pipeline
- Assembly: The
MinProximityIntersectioncomponent contributes to the assembly phase by identifying potential contact points between geometric primitives. These contacts are essential for enforcing constraints and handling interactions between different parts of a deformable object or multiple objects. - Time Integration: Proximity checks do not directly contribute to time integration but provide necessary information for constraint enforcement during each time step, ensuring that objects do not interpenetrate.
- Nonlinear Solve: The intersection data is used in the nonlinear solve phase to enforce contact and collision constraints through Lagrange multipliers or other methods.
Numerical Methods or Discretization Choices
- Proximity Checking: The proximity checks are based on simple geometric comparisons, which do not involve complex numerical integration schemes. They rely on bounding volumes (cubes) and surface distances (spheres) to determine if two primitives are close enough for collision detection.
- Intersection Computation: Intersection computation involves finding contact points within the defined alarm distance, ensuring that contacts are only considered when necessary based on predefined thresholds.
Variational / Lagrangian Mechanics Framework
- Constraints and Contacts: The
MinProximityIntersectioncomponent fits into the broader variational framework by identifying potential constraints (contacts) between different geometric primitives. These constraints can be used to enforce physical laws such as non-penetration, which are critical for maintaining the integrity of deformable bodies during simulation.
Summary
The MinProximityIntersection class in SOFA is responsible for basic intersection methods using proximities between cubes and spheres. It supports various types of collision models and can be extended to support additional intersections through other components like MeshMinProximityIntersection. The component plays a crucial role in identifying potential contact points, which are essential for enforcing physical constraints during FEM-based simulations.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
d_useSphereTriangle |
bool | |
activate Sphere-Triangle intersection tests |
d_usePointPoint |
bool | |
activate Point-Point intersection tests |
d_useSurfaceNormals |
bool | |
Compute the norms of the Detection Outputs by considering the normals of the surfaces involved. |
d_useLinePoint |
bool | |
activate Line-Point intersection tests |
d_useLineLine |
bool | |
activate Line-Line intersection tests |
Methods
void
init
()
virtual
bool
getUseSurfaceNormals
()
bool
testIntersection
(collision::geometry::Cube & cube1, collision::geometry::Cube & cube2, const core::collision::Intersection * currentIntersection)
virtual
int
computeIntersection
(collision::geometry::Cube & cube1, collision::geometry::Cube & cube2, OutputVector * contacts, const core::collision::Intersection * currentIntersection)
virtual
bool
testIntersection
(SphereType1 & sph1, SphereType2 & sph2, const core::collision::Intersection * currentIntersection)
int
computeIntersection
(SphereType1 & sph1, SphereType2 & sph2, OutputVector * contacts, const core::collision::Intersection * currentIntersection)
{
"name": "MinProximityIntersection",
"namespace": "sofa::component::collision::detection::intersection",
"module": "Sofa.Component.Collision.Detection.Intersection",
"include": "sofa/component/collision/detection/intersection/MinProximityIntersection.h",
"doc": "A set of methods to compute if two primitives are close enough to consider they collide.\n\nBasic intersection methods using proximities\nIt uses proximities on cubes and spheres, but supported pairs of collision models can\nbe extended. For example, see MeshMinProximityIntersection which adds support for\nadditional types of intersection.\nSupported by default:\n- Cube/Cube\n- Sphere/Sphere (rigid or vec3)\nMeshMinProximityIntersection adds support for:\n- Point/Point (if d_usePointPoint is true)\n- Line/Point (if d_useLinePoint is true)\n- Line/Line (if d_useLineLine is true)\n- Triangle/Point\n- Sphere/Point (if d_useSphereTriangle is true)\n- RigidSphere/Point (if d_useSphereTriangle is true)\n- Triangle/Sphere (if d_useSphereTriangle is true)\n- Triangle/RigidSphere (if d_useSphereTriangle is true)\n- Line/Sphere (if d_useSphereTriangle is true)\n- Line/RigidSphere (if d_useSphereTriangle is true)\nNote that MeshMinProximityIntersection ignores Triangle/Line and Triangle/Triangle intersections.\nDatas can be set to ignore some pairs of collision models (d_useSphereTriangle, d_usePointPoint, etc).",
"inherits": [
"BaseProximityIntersection"
],
"templates": [],
"data_fields": [
{
"name": "d_useSphereTriangle",
"type": "bool",
"xmlname": "useSphereTriangle",
"help": "activate Sphere-Triangle intersection tests"
},
{
"name": "d_usePointPoint",
"type": "bool",
"xmlname": "usePointPoint",
"help": "activate Point-Point intersection tests"
},
{
"name": "d_useSurfaceNormals",
"type": "bool",
"xmlname": "useSurfaceNormals",
"help": "Compute the norms of the Detection Outputs by considering the normals of the surfaces involved."
},
{
"name": "d_useLinePoint",
"type": "bool",
"xmlname": "useLinePoint",
"help": "activate Line-Point intersection tests"
},
{
"name": "d_useLineLine",
"type": "bool",
"xmlname": "useLineLine",
"help": "activate Line-Line intersection tests"
}
],
"links": [],
"methods": [
{
"name": "init",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getUseSurfaceNormals",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "testIntersection",
"return_type": "bool",
"params": [
{
"name": "cube1",
"type": "collision::geometry::Cube &"
},
{
"name": "cube2",
"type": "collision::geometry::Cube &"
},
{
"name": "currentIntersection",
"type": "const core::collision::Intersection *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeIntersection",
"return_type": "int",
"params": [
{
"name": "cube1",
"type": "collision::geometry::Cube &"
},
{
"name": "cube2",
"type": "collision::geometry::Cube &"
},
{
"name": "contacts",
"type": "OutputVector *"
},
{
"name": "currentIntersection",
"type": "const core::collision::Intersection *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "testIntersection",
"return_type": "bool",
"params": [
{
"name": "sph1",
"type": "SphereType1 &"
},
{
"name": "sph2",
"type": "SphereType2 &"
},
{
"name": "currentIntersection",
"type": "const core::collision::Intersection *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeIntersection",
"return_type": "int",
"params": [
{
"name": "sph1",
"type": "SphereType1 &"
},
{
"name": "sph2",
"type": "SphereType2 &"
},
{
"name": "contacts",
"type": "OutputVector *"
},
{
"name": "currentIntersection",
"type": "const core::collision::Intersection *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": {
"summary": "The MinProximityIntersection class provides basic intersection methods using proximities between geometric primitives such as cubes and spheres in the SOFA framework.",
"details": [
"MinProximityIntersection is derived from BaseProximityIntersection and extends its functionality to support various types of collision models, including cubes and spheres. It can be further extended through other components like MeshMinProximityIntersection for additional intersection tests.",
"The component supports default intersections between the following pairs:",
"- Cube/Cube",
"- Sphere/Sphere (rigid or vec3)",
"Additional intersection types that can be enabled include:",
"- Point/Point",
"- Line/Point",
"- Line/Line",
"- Triangle/Point",
"- Sphere/Point",
"- RigidSphere/Point",
"- Triangle/Sphere",
"- Triangle/RigidSphere",
"- Line/Sphere",
"- Line/RigidSphere",
"Intersection types can be enabled or disabled using the following data fields:",
"- d_useSphereTriangle: Activates Sphere-Triangle intersection tests.",
"- d_usePointPoint: Activates Point-Point intersection tests.",
"- d_useSurfaceNormals: Computes norms of detection outputs by considering surface normals.",
"- d_useLinePoint: Activates Line-Point intersection tests.",
"- d_useLineLine: Activates Line-Line intersection tests."
],
"methods": {
"init()": "Initializes the intersectors for Cube and Sphere collision models. It also adds additional supported pairs from other components like MeshMinProximityIntersection.",
"getUseSurfaceNormals() const": "Returns whether to compute norms of detection outputs by considering surface normals.",
"testIntersection(Cube& cube1, Cube& cube2, const core::collision::Intersection* currentIntersection)": "Tests if two cubes are in proximity based on the current intersection settings.",
"computeIntersection(Cube& cube1, Cube& cube2, OutputVector* contacts, const core::collision::Intersection* currentIntersection)": "Computes intersections between two cubes and stores contact points in an output vector.",
"testIntersection(SphereType1& sph1, SphereType2& sph2, const core::collision::Intersection* currentIntersection)": "Tests if two spheres are within the alarm distance based on their contact distances.",
"computeIntersection(SphereType1& sph1, SphereType2& sph2, OutputVector* contacts, const core::collision::Intersection* currentIntersection)": "Computes intersections between two spheres and stores contact points in an output vector."
},
"usage": [
"MinProximityIntersection is used to determine whether geometric primitives are close enough to be considered intersecting. This class provides basic methods for proximity checks and can be extended by other components to support additional intersection types."
]
},
"maths": "### Mathematical and Physical Description of `MinProximityIntersection`\n\n#### Governing Equations or Operators\n- **Test Intersection**: The `testIntersection` methods determine if two geometric primitives are within a specified proximity threshold. These tests do not compute exact intersections but rather check for closeness based on predefined distances.\n - For **Cubes**:\n \\[ \\text{testIntersection}(\\text{cube1}, \\text{cube2}) = \begin{cases} \n \\text{True}, & \\text{if the cubes are within a certain alarm distance}\\\\\n \\text{False}, & \\text{otherwise}\n \\end{cases}\\]\n - For **Spheres**:\n \\[ \\text{testIntersection}(\\text{sph1}, \\text{sph2}) = \begin{cases} \n \\text{True}, & \\text{if the spheres are within an alarm distance given by } d_{alarm} + r_1 + r_2\\\\\n \\text{False}, & \\text{otherwise}\n \\end{cases}\\]\n where \\(d_{alarm}\\) is the alarm distance, and \\(r_1\\), \\(r_2\\) are the radii of spheres.\n- **Compute Intersection**: The `computeIntersection` methods compute contact points between two geometric primitives. These methods store the computed contacts in an output vector.\n - For **Cubes**:\n \\[ \\text{computeIntersection}(\\text{cube1}, \\text{cube2}) = \\begin{cases} \n \\text{contacts}, & \\text{the contact points between the cubes}\n \\end{cases}\\]\n - For **Spheres**:\n \\[ \\text{computeIntersection}(\\text{sph1}, \\text{sph2}) = \\begin{cases} \n \\text{contacts}, & \\text{the contact points between the spheres based on alarm and contact distances}\n \\end{cases}\\]\n\n#### Constitutive or Kinematic Laws Involved\n- **Proximity Tests**: The proximity tests are based on geometric distances and do not involve constitutive laws directly. However, they rely on the definition of radii for spheres and bounding boxes for cubes.\n - For spheres: \\(d_{alarm} = d_{currentAlarm} + r_1 + r_2\\), where \\(d_{currentAlarm}\\) is the alarm distance from the current intersection settings.\n\n#### Role in the Global FEM Pipeline\n- **Assembly**: The `MinProximityIntersection` component contributes to the assembly phase by identifying potential contact points between geometric primitives. These contacts are essential for enforcing constraints and handling interactions between different parts of a deformable object or multiple objects.\n- **Time Integration**: Proximity checks do not directly contribute to time integration but provide necessary information for constraint enforcement during each time step, ensuring that objects do not interpenetrate.\n- **Nonlinear Solve**: The intersection data is used in the nonlinear solve phase to enforce contact and collision constraints through Lagrange multipliers or other methods.\n\n#### Numerical Methods or Discretization Choices\n- **Proximity Checking**: The proximity checks are based on simple geometric comparisons, which do not involve complex numerical integration schemes. They rely on bounding volumes (cubes) and surface distances (spheres) to determine if two primitives are close enough for collision detection.\n- **Intersection Computation**: Intersection computation involves finding contact points within the defined alarm distance, ensuring that contacts are only considered when necessary based on predefined thresholds.\n\n#### Variational / Lagrangian Mechanics Framework\n- **Constraints and Contacts**: The `MinProximityIntersection` component fits into the broader variational framework by identifying potential constraints (contacts) between different geometric primitives. These constraints can be used to enforce physical laws such as non-penetration, which are critical for maintaining the integrity of deformable bodies during simulation.\n\n#### Summary\nThe `MinProximityIntersection` class in SOFA is responsible for basic intersection methods using proximities between cubes and spheres. It supports various types of collision models and can be extended to support additional intersections through other components like MeshMinProximityIntersection. The component plays a crucial role in identifying potential contact points, which are essential for enforcing physical constraints during FEM-based simulations.",
"abstract": "The `MinProximityIntersection` component determines if geometric primitives (cubes, spheres) are close enough to be considered intersecting and supports various types of collision models through configurable parameters.",
"sheet": "# MinProximityIntersection\n\n## Overview\nThe `MinProximityIntersection` class provides basic intersection methods using proximities between geometric primitives such as cubes and spheres. It extends the functionality from `BaseProximityIntersection` to support additional intersection tests for different types of collision models.\n\n## Mathematical Model\n### Test Intersection\n- **Cubes**:\n \\[ \text{testIntersection}(\\text{cube1}, \\text{cube2}) = \\begin{cases} \n \\text{True}, & \\text{if the cubes are within a certain alarm distance}\\\\\n \\text{False}, & \\text{otherwise}\n \\end{cases}\\]\n- **Spheres**:\n \\[ \text{testIntersection}(\\text{sph1}, \\text{sph2}) = \\begin{cases} \n \\text{True}, & \\text{if the spheres are within an alarm distance given by } d_{alarm} + r_1 + r_2\\\\\n \\text{False}, & \\text{otherwise}\n \\end{cases}\\]\nwhere \\(d_{alarm}\\) is the alarm distance, and \\(r_1\\), \\(r_2\\) are the radii of spheres.\n\n### Compute Intersection\n- **Cubes**:\n \\[ \text{computeIntersection}(\\text{cube1}, \\text{cube2}) = \\begin{cases} \n \\text{contacts}, & \\text{the contact points between the cubes}\n \\end{cases}\\]\n- **Spheres**:\n \\[ \text{computeIntersection}(\\text{sph1}, \\text{sph2}) = \\begin{cases} \n \\text{contacts}, & \\text{the contact points between the spheres based on alarm and contact distances}\n \\end{cases}\\]\n\n## Parameters and Data\n- **d_useSphereTriangle**: Activates Sphere-Triangle intersection tests.\n- **d_usePointPoint**: Activates Point-Point intersection tests.\n- **d_useSurfaceNormals**: Computes norms of detection outputs by considering surface normals.\n- **d_useLinePoint**: Activates Line-Point intersection tests.\n- **d_useLineLine**: Activates Line-Line intersection tests."
}