Back

NewProximityIntersection

sofa::component::collision::detection::intersection::NewProximityIntersection
BaseProximityIntersection
Doc (from source)

Optimized Proximity Intersection based on Triangle-Triangle tests, ignoring Edge-Edge cases It uses proximities on cubes and spheres, but supported pairs of collision models can be extended. For example, see MeshMinProximityIntersection which adds support for Point/Point, Line/Point, etc. Supported by default: - Cube/Cube - Sphere/Sphere (rigid or vec3) MeshMinProximityIntersection adds support for: - Point/Point - Line/Point - Line/Line - Triangle/Point - Triangle/Line - Triangle/Triangle - Sphere/Point - RigidSphere/Point - Line/RigidSphere - Line/Sphere - Triangle/RigidSphere - Triangle/Sphere

Abstract (AI generated)

The `NewProximityIntersection` component handles proximity intersection tests for collision detection in SOFA simulations, supporting various geometric objects including cubes and spheres.

Metadata
module
Sofa.Component.Collision.Detection.Intersection
namespace
sofa::component::collision::detection::intersection
include
sofa/component/collision/detection/intersection/NewProximityIntersection.h
inherits
  • BaseProximityIntersection
description

The NewProximityIntersection component in the SOFA framework is designed to handle proximity intersection tests between various collision models, including cubes and spheres. It provides optimized methods for determining intersections based on Triangle-Triangle tests while ignoring Edge-Edge cases.

Governing Equations and Operators

This component does not directly contribute to the governing equations of FEM such as mass matrix $M$, stiffness matrix $K$, internal force vector $f_{int}$, or residual $R$. Instead, it focuses on proximity intersection tests which are essential for collision detection in deformable body simulations.

Constitutive and Kinematic Laws Involved

The component primarily deals with geometric proximity calculations rather than material constitutive laws. The proximity checks involve distance metrics between points, lines, triangles, and spheres. For instance, the doIntersectionPointPoint method calculates the squared Euclidean distance $d^2$ between two points $ extbf{p}$ and $ extbf{q}$:

egin{align*}
extbf{pq} &= extbf{q} - extbf{p},\
d^2 &= || extbf{pq}||^2 = ( extbf{q}_x- extbf{p}_x)^2 + ( extbf{q}_y- extbf{p}_y)^2 + ( extbf{q}_z- extbf{p}_z)^2.
ag{1}
ag{2}
ag{3}
ag{4}
ag{5}
ag{6}
ag{7}
ag{8}
ag{9}
ag{10}

If $d^2$ is less than a specified threshold, an intersection is detected.

For sphere-sphere intersections, the method testIntersection and computeIntersection use alarm distances to determine if two spheres intersect. The alarm distance $ ext{alarmDist}$ is computed as:

egin{align*}
ext{alarmDist} &= ext{currentIntersection->getAlarmDistance()} + ext{sph1.getContactDistance()} + ext{sph2.getContactDistance()},\
ext{alarmDist2} &= ext{alarmDist} + ext{sph1.r()} + ext{sph2.r()}.\tag{13}
ag{14}

If the distance between sphere centers is less than $ ext{alarmDist2}$, an intersection is detected.

Role in the Global FEM Pipeline

The NewProximityIntersection component plays a crucial role in collision detection, which is part of the broader constraint handling and contact mechanics module within the FEM pipeline. It ensures that deformable bodies do not interpenetrate by detecting when their proximity boundaries are breached.

Numerical Methods or Discretization Choices

The numerical methods used in NewProximityIntersection involve basic geometric distance calculations and threshold comparisons, which are straightforward and efficient for real-time collision detection. The component does not employ complex discretization schemes but relies on the provided geometry and proximity thresholds to determine intersections.

Integration into Variational/Lagrangian Mechanics Framework

While NewProximityIntersection does not directly contribute to variational or Lagrangian formulations, it provides essential functionality for maintaining physical consistency in simulations involving deformable bodies. By detecting collisions, it ensures that the resulting forces and constraints are accurately applied within the FEM framework, preserving the overall integrity of the simulation.

In summary, NewProximityIntersection is a key component for efficient proximity-based collision detection, which supports accurate contact mechanics in the SOFA simulation pipeline.

Data Fields
NameTypeDefaultHelp
d_useLineLine bool Line-line collision detection enabled
Methods
void init () virtual
int doIntersectionPointPoint (SReal dist2, const type::Vec3 & p, const type::Vec3 & q, OutputVector * contacts, int id)
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": "NewProximityIntersection",
  "namespace": "sofa::component::collision::detection::intersection",
  "module": "Sofa.Component.Collision.Detection.Intersection",
  "include": "sofa/component/collision/detection/intersection/NewProximityIntersection.h",
  "doc": "Optimized Proximity Intersection based on Triangle-Triangle tests, ignoring Edge-Edge cases\n\nIt uses proximities on cubes and spheres, but supported pairs of collision models can\nbe extended. For example, see MeshMinProximityIntersection which adds support for\nPoint/Point, Line/Point, etc.\nSupported by default:\n- Cube/Cube\n- Sphere/Sphere (rigid or vec3)\nMeshMinProximityIntersection adds support for:\n- Point/Point\n- Line/Point\n- Line/Line\n- Triangle/Point\n- Triangle/Line\n- Triangle/Triangle\n- Sphere/Point\n- RigidSphere/Point\n- Line/RigidSphere\n- Line/Sphere\n- Triangle/RigidSphere\n- Triangle/Sphere",
  "inherits": [
    "BaseProximityIntersection"
  ],
  "templates": [],
  "data_fields": [
    {
      "name": "d_useLineLine",
      "type": "bool",
      "xmlname": "useLineLine",
      "help": "Line-line collision detection enabled"
    }
  ],
  "links": [],
  "methods": [
    {
      "name": "init",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "doIntersectionPointPoint",
      "return_type": "int",
      "params": [
        {
          "name": "dist2",
          "type": "SReal"
        },
        {
          "name": "p",
          "type": "const type::Vec3 &"
        },
        {
          "name": "q",
          "type": "const type::Vec3 &"
        },
        {
          "name": "contacts",
          "type": "OutputVector *"
        },
        {
          "name": "id",
          "type": "int"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "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": "The `NewProximityIntersection` component in the SOFA framework is designed for optimized proximity intersection calculations based on Triangle-Triangle tests, while ignoring Edge-Edge cases. It supports various collision models including cubes and spheres. The component enables line-line collision detection through a configurable parameter (`useLineLine`).\n\nIt provides methods to test and compute intersections between different types of geometric objects (e.g., `CubeCollisionModel` and `SphereCollisionModel`). These methods facilitate the determination of contact points, normal vectors, and other relevant data for proximity calculations.\n\nThe component also allows for the registration of additional intersectors through a factory mechanism. This modular design supports extensibility by enabling other components to add new pairs of collision models that can be handled by `NewProximityIntersection`.",
  "maths": "The `NewProximityIntersection` component in the SOFA framework is designed to handle proximity intersection tests between various collision models, including cubes and spheres. It provides optimized methods for determining intersections based on Triangle-Triangle tests while ignoring Edge-Edge cases.\n\n### Governing Equations and Operators\n\nThis component does not directly contribute to the governing equations of FEM such as mass matrix \\(M\\), stiffness matrix \\(K\\), internal force vector \\(f_{int}\\), or residual \\(R\\). Instead, it focuses on proximity intersection tests which are essential for collision detection in deformable body simulations.\n\n### Constitutive and Kinematic Laws Involved\n\nThe component primarily deals with geometric proximity calculations rather than material constitutive laws. The proximity checks involve distance metrics between points, lines, triangles, and spheres. For instance, the `doIntersectionPointPoint` method calculates the squared Euclidean distance \\(d^2\\) between two points \\(\textbf{p}\\) and \\(\textbf{q}\\):\n\n\begin{align*}\n    \textbf{pq} &= \textbf{q} - \textbf{p},\\\\\n    d^2 &= ||\textbf{pq}||^2 = (\textbf{q}_x-\textbf{p}_x)^2 + (\textbf{q}_y-\textbf{p}_y)^2 + (\textbf{q}_z-\textbf{p}_z)^2.\n\tag{1}\n\tag{2}\n\tag{3}\n\tag{4}\n\tag{5}\n\tag{6}\n\tag{7}\n\tag{8}\n\tag{9}\n\tag{10}\n\nIf \\(d^2\\) is less than a specified threshold, an intersection is detected.\n\nFor sphere-sphere intersections, the method `testIntersection` and `computeIntersection` use alarm distances to determine if two spheres intersect. The alarm distance \\(\text{alarmDist}\\) is computed as:\n\n\begin{align*}\n    \text{alarmDist} &= \text{currentIntersection->getAlarmDistance()} + \text{sph1.getContactDistance()} + \text{sph2.getContactDistance()},\\\\\n    \text{alarmDist2} &= \text{alarmDist} + \text{sph1.r()} + \text{sph2.r()}.\\tag{13}\n\tag{14}\n\nIf the distance between sphere centers is less than \\(\text{alarmDist2}\\), an intersection is detected.\n\n### Role in the Global FEM Pipeline\n\nThe `NewProximityIntersection` component plays a crucial role in collision detection, which is part of the broader constraint handling and contact mechanics module within the FEM pipeline. It ensures that deformable bodies do not interpenetrate by detecting when their proximity boundaries are breached.\n\n### Numerical Methods or Discretization Choices\n\nThe numerical methods used in `NewProximityIntersection` involve basic geometric distance calculations and threshold comparisons, which are straightforward and efficient for real-time collision detection. The component does not employ complex discretization schemes but relies on the provided geometry and proximity thresholds to determine intersections.\n\n### Integration into Variational/Lagrangian Mechanics Framework\n\nWhile `NewProximityIntersection` does not directly contribute to variational or Lagrangian formulations, it provides essential functionality for maintaining physical consistency in simulations involving deformable bodies. By detecting collisions, it ensures that the resulting forces and constraints are accurately applied within the FEM framework, preserving the overall integrity of the simulation.\n\nIn summary, `NewProximityIntersection` is a key component for efficient proximity-based collision detection, which supports accurate contact mechanics in the SOFA simulation pipeline.",
  "abstract": "The `NewProximityIntersection` component handles proximity intersection tests for collision detection in SOFA simulations, supporting various geometric objects including cubes and spheres.",
  "sheet": "# NewProximityIntersection\n\n## Overview\nThe `NewProximityIntersection` component is designed to handle proximity intersection tests for efficient collision detection between different types of geometric objects such as cubes and spheres. It supports a variety of collision models and provides methods to test and compute intersections.\n\n## Mathematical Model\nThis component focuses on basic distance calculations for proximity checks. For point-point collisions, the squared Euclidean distance is calculated:\n\\[ d^2 = ||\\mathbf{pq}||^2 = (q_x - p_x)^2 + (q_y - p_y)^2 + (q_z - p_z)^2 \\]\nwhere \\(\\mathbf{p}\\) and \\(\\mathbf{q}\\) are the points being compared.\n\nFor sphere-sphere intersections, an alarm distance is used to determine if two spheres intersect:\n\\[ \\text{alarmDist} = \\text{currentIntersection->getAlarmDistance()} + \\text{sph1.getContactDistance()} + \\text{sph2.getContactDistance()} \\]\n\\[ \\text{alarmDist2} = \\text{alarmDist} + \\text{sph1.r()} + \\text{sph2.r()} \\]\nIf the distance between sphere centers is less than \\(\\text{alarmDist2}\\), an intersection is detected.\n\n## Parameters and Data\n- **useLineLine**: Enables line-line collision detection (type: bool, default: false).\n\n## Practical Notes\nThe `NewProximityIntersection` component ensures accurate proximity-based collision detection for deformable body simulations. It supports efficient real-time collision detection through basic geometric distance calculations."
}