Back

DirectSAP

The `DirectSAP` component in the SOFA framework is used for collision detection using the Sweep and Prune (SAP) algorithm. It serves as a bridge between broad-phase and narrow-phase collision detection components, adding backward compatibility by automatically including a `BruteForceBroadPhase` and a `DirectSAPNarrowPhase`. The component inherits from `BaseObject`, which is a foundational class in SOFA for simulation objects. Although it has an `init` method to initialize the component, it is marked as deprecated and users are advised to use separate BroadPhase and NarrowPhase components instead. This integration ensures that collision detection remains robust without requiring significant modifications to existing scenes.

abstract
The `DirectSAP` component automates collision detection using Sweep and Prune (SAP) for broad-phase and narrow-phase integration, ensuring backward compatibility in SOFA simulations.
sheet
# DirectSAP ## Overview The `DirectSAP` component is used for automated collision detection in the SOFA framework. It integrates both broad-phase (`BruteForceBroadPhase`) and narrow-phase (`DirectSAPNarrowPhase`) components to ensure backward compatibility, simplifying the setup of collision detection pipelines. However, it is marked as deprecated, and users are advised to use separate BroadPhase and NarrowPhase components for better performance and modularity. ## Practical Notes - **Deprecation Notice**: The `DirectSAP` component is deprecated. Users should consider using separate BroadPhase and NarrowPhase components for improved performance and flexibility. - **Numerical Stability**: While the Sweep and Prune (SAP) algorithm reduces the number of pairwise collision tests, it may not be optimal in scenarios with a large number of objects or complex geometries. Separate BroadPhase and NarrowPhase components can offer better numerical stability and efficiency.
description
The `DirectSAP` component in the SOFA framework is used for collision detection using the Sweep and Prune (SAP) algorithm. It serves as a bridge between broad-phase and narrow-phase collision detection components, adding backward compatibility by automatically including a `BruteForceBroadPhase` and a `DirectSAPNarrowPhase`. The component inherits from `BaseObject`, which is a foundational class in SOFA for simulation objects. Although it has an `init` method to initialize the component, it is marked as deprecated and users are advised to use separate BroadPhase and NarrowPhase components instead. This integration ensures that collision detection remains robust without requiring significant modifications to existing scenes.
maths
The `DirectSAP` component in the SOFA framework is designed for collision detection using the Sweep and Prune (SAP) algorithm. It primarily serves as a bridge between broad-phase and narrow-phase collision detection components, ensuring backward compatibility by automatically including specific sub-components. ### Mathematical and Physical Content 1. **Broad-Phase Detection**: - The `DirectSAP` component initializes the `BruteForceBroadPhase`, which is responsible for identifying pairs of objects that might be colliding (potential collision candidates). This broad-phase detection algorithm is essential in reducing the number of pairwise collision tests needed, as it only passes a subset of object pairs to the narrow phase. 2. **Narrow-Phase Detection**: - The `DirectSAP` component also initializes the `DirectSAPNarrowPhase`, which performs detailed collision detection on the pairs identified by the broad phase. This step typically involves precise geometric computations to determine if and where two objects are actually colliding. ### Numerical Methods or Discretization Choices - **Sweep and Prune (SAP)**: The SAP algorithm is a common approach for broad-phase collision detection, which sorts objects along one axis (typically the x-axis) at each frame. It then prunes pairs that cannot be colliding based on their order and extents in that axis. ### Fitting into the Broader Framework - **Collision Detection Pipeline**: In SOFA's broader variational/Lagrangian mechanics framework, collision detection is a critical step to ensure physical constraints are respected. The `DirectSAP` component fits into this pipeline by providing an integrated solution for both broad-phase and narrow-phase collision detection. ### Deprecation Notice - Although the `DirectSAP` component serves its purpose, it is marked as deprecated. Users are advised to use separate BroadPhase and NarrowPhase components directly for better performance and modularity. In summary, while the `DirectSAP` component itself does not perform complex mathematical or physical operations, it plays a crucial role in automating and simplifying collision detection by integrating broad-phase (`BruteForceBroadPhase`) and narrow-phase (`DirectSAPNarrowPhase`) components.
{
  "name": "DirectSAP",
  "main": {
    "name": "DirectSAP",
    "namespace": "sofa::component::collision::detection::algorithm",
    "module": "Sofa.Component.Collision.Detection.Algorithm",
    "include": "sofa/component/collision/detection/algorithm/DirectSAP.h",
    "doc": "Collision detection using sweep and prune.",
    "inherits": [
      "BaseObject"
    ],
    "templates": [],
    "data_fields": [],
    "links": [],
    "methods": [
      {
        "name": "init",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      }
    ]
  },
  "desc": {
    "description": "The `DirectSAP` component in the SOFA framework is used for collision detection using the Sweep and Prune (SAP) algorithm. It serves as a bridge between broad-phase and narrow-phase collision detection components, adding backward compatibility by automatically including a `BruteForceBroadPhase` and a `DirectSAPNarrowPhase`. The component inherits from `BaseObject`, which is a foundational class in SOFA for simulation objects. Although it has an `init` method to initialize the component, it is marked as deprecated and users are advised to use separate BroadPhase and NarrowPhase components instead. This integration ensures that collision detection remains robust without requiring significant modifications to existing scenes."
  },
  "maths": {
    "maths": "The `DirectSAP` component in the SOFA framework is designed for collision detection using the Sweep and Prune (SAP) algorithm. It primarily serves as a bridge between broad-phase and narrow-phase collision detection components, ensuring backward compatibility by automatically including specific sub-components.\n\n### Mathematical and Physical Content\n\n1. **Broad-Phase Detection**:\n   - The `DirectSAP` component initializes the `BruteForceBroadPhase`, which is responsible for identifying pairs of objects that might be colliding (potential collision candidates). This broad-phase detection algorithm is essential in reducing the number of pairwise collision tests needed, as it only passes a subset of object pairs to the narrow phase.\n\n2. **Narrow-Phase Detection**:\n   - The `DirectSAP` component also initializes the `DirectSAPNarrowPhase`, which performs detailed collision detection on the pairs identified by the broad phase. This step typically involves precise geometric computations to determine if and where two objects are actually colliding.\n\n### Numerical Methods or Discretization Choices\n\n- **Sweep and Prune (SAP)**: The SAP algorithm is a common approach for broad-phase collision detection, which sorts objects along one axis (typically the x-axis) at each frame. It then prunes pairs that cannot be colliding based on their order and extents in that axis.\n\n### Fitting into the Broader Framework\n\n- **Collision Detection Pipeline**: In SOFA's broader variational/Lagrangian mechanics framework, collision detection is a critical step to ensure physical constraints are respected. The `DirectSAP` component fits into this pipeline by providing an integrated solution for both broad-phase and narrow-phase collision detection.\n\n### Deprecation Notice\n\n- Although the `DirectSAP` component serves its purpose, it is marked as deprecated. Users are advised to use separate BroadPhase and NarrowPhase components directly for better performance and modularity.\n\nIn summary, while the `DirectSAP` component itself does not perform complex mathematical or physical operations, it plays a crucial role in automating and simplifying collision detection by integrating broad-phase (`BruteForceBroadPhase`) and narrow-phase (`DirectSAPNarrowPhase`) components."
  },
  "summary": {
    "abstract": "The `DirectSAP` component automates collision detection using Sweep and Prune (SAP) for broad-phase and narrow-phase integration, ensuring backward compatibility in SOFA simulations.",
    "sheet": "\n# DirectSAP\n\n## Overview\n\nThe `DirectSAP` component is used for automated collision detection in the SOFA framework. It integrates both broad-phase (`BruteForceBroadPhase`) and narrow-phase (`DirectSAPNarrowPhase`) components to ensure backward compatibility, simplifying the setup of collision detection pipelines. However, it is marked as deprecated, and users are advised to use separate BroadPhase and NarrowPhase components for better performance and modularity.\n\n## Practical Notes\n\n- **Deprecation Notice**: The `DirectSAP` component is deprecated. Users should consider using separate BroadPhase and NarrowPhase components for improved performance and flexibility.\n- **Numerical Stability**: While the Sweep and Prune (SAP) algorithm reduces the number of pairwise collision tests, it may not be optimal in scenarios with a large number of objects or complex geometries. Separate BroadPhase and NarrowPhase components can offer better numerical stability and efficiency."
  }
}