PointCollisionModel
Collision model which represents a set of points.
The PointCollisionModel represents objects as collections of points for efficient collision detection and response.
- module
- Sofa.Component.Collision.Geometry
- namespace
- sofa::component::collision::geometry
- include
- sofa/component/collision/geometry/PointCollisionModel.h
- inherits
-
- CollisionModel
- templates
-
- sofa::defaulttype::Vec3Types
- description
The PointCollisionModel is a collision model that represents objects as collections of points for the purpose of collision detection. It does not contribute to the governing equations or operators in the context of FEM simulation, such as mass matrix $M$, stiffness matrix $K$, internal force $f_{int}$, or residual $R$. Instead, its role is primarily related to geometric and topological aspects used during the constraint handling phase.
Governing Equations and Operators
- No Contribution: The PointCollisionModel does not directly influence the global governing equations of motion. It is a structural component focused on collision detection and does not participate in the computation of forces or displacements within the FEM framework.
Constitutive or Kinematic Laws Involved
- None: There are no constitutive laws (such as strain measures, stress tensors, hyperelastic potentials) or kinematic laws involved directly related to this component. The primary concern is geometric data management and collision detection logic.
Role in the Global FEM Pipeline
- Collision Handling: It represents a set of points for collision purposes. This involves:
- Geometric representation (points, normals).
- Computation of bounding volumes (e.g., bounding boxes or trees) to efficiently detect potential collisions.
- Constraint handling during collision response (though it does not directly enforce constraints).
- Initialization and Updating: During initialization (
initmethod), the component sets up its internal state based on the mechanical model's data. It also updates normals if required, which is critical for some collision detection algorithms.
Numerical Methods or Discretization Choices
- Point Representation: Points are represented by their positions ($\mathbf{p}$) and velocities ($\mathbf{v}$), which are retrieved from the MechanicalState associated with the component.
- Bounding Volume Computation: It computes bounding volumes (e.g., cubes or boxes) for each point, which are used to detect potential collisions efficiently. The method
computeBoundingTreeupdates these bounding volumes based on the current state of points and their normals.
Integration into Variational / Lagrangian Mechanics Framework
- Geometric Representation: While it does not contribute directly to variational principles or Lagrangian mechanics, its role is essential in enforcing physical constraints such as collision avoidance. This indirectly supports the broader framework by ensuring that mechanical models do not interpenetrate.
- Bounding Volumes and Normals: The bounding volumes and computed normals are used to efficiently handle and resolve collisions, which can influence the overall dynamic behavior of a system during simulation steps.
Key Conceptual Insight
The PointCollisionModel is primarily focused on geometric collision detection and does not participate in the core numerical methods or constitutive models. Its role is to provide an efficient and accurate mechanism for identifying potential collisions between objects in the simulation, thereby supporting constraint handling and ensuring physically consistent behavior.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
d_bothSide |
bool | |
activate collision on both side of the point model (when surface normals are defined on these points) |
d_computeNormals |
bool | |
activate computation of normal vectors (required for some collision detection algorithms) |
d_displayFreePosition |
bool | |
Display Collision Model Points free position(in green) |
Links
| Name | Type | Help |
|---|---|---|
l_topology |
link to the topology container |
Methods
void
drawCollisionModel
(const core::visual::VisualParams * vparams)
virtual
void
init
()
virtual
void
resize
(int size)
void
computeBoundingTree
(int maxDepth)
virtual
void
computeContinuousBoundingTree
(SReal dt, ContinuousIntersectionTypeFlag continuousIntersectionFlag, int maxDepth)
virtual
void
draw
(const core::visual::VisualParams * , int index)
bool
canCollideWithElement
(int index, CollisionModel * model2, int index2)
core::behavior::MechanicalState<DataTypes> *
getMechanicalState
()
Deriv
getNormal
(int index)
const Deriv &
velocity
(int index)
bool
canCreate
(T *& obj, core::objectmodel::BaseContext * context, core::objectmodel::BaseObjectDescription * arg)
void
computeBBox
(const core::ExecParams * params, bool onlyVisible)
virtual
void
updateNormals
()
sofa::core::topology::BaseMeshTopology *
getCollisionTopology
()
virtual
{
"name": "PointCollisionModel",
"namespace": "sofa::component::collision::geometry",
"module": "Sofa.Component.Collision.Geometry",
"include": "sofa/component/collision/geometry/PointCollisionModel.h",
"doc": "Collision model which represents a set of points.",
"inherits": [
"CollisionModel"
],
"templates": [
"sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "d_bothSide",
"type": "bool",
"xmlname": "bothSide",
"help": "activate collision on both side of the point model (when surface normals are defined on these points)"
},
{
"name": "d_computeNormals",
"type": "bool",
"xmlname": "computeNormals",
"help": "activate computation of normal vectors (required for some collision detection algorithms)"
},
{
"name": "d_displayFreePosition",
"type": "bool",
"xmlname": "displayFreePosition",
"help": "Display Collision Model Points free position(in green)"
}
],
"links": [
{
"name": "l_topology",
"target": "BaseMeshTopology",
"kind": "single",
"xmlname": "topology",
"help": "link to the topology container"
}
],
"methods": [
{
"name": "drawCollisionModel",
"return_type": "void",
"params": [
{
"name": "vparams",
"type": "const core::visual::VisualParams *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "init",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "resize",
"return_type": "void",
"params": [
{
"name": "size",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeBoundingTree",
"return_type": "void",
"params": [
{
"name": "maxDepth",
"type": "int"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeContinuousBoundingTree",
"return_type": "void",
"params": [
{
"name": "dt",
"type": "SReal"
},
{
"name": "continuousIntersectionFlag",
"type": "ContinuousIntersectionTypeFlag"
},
{
"name": "maxDepth",
"type": "int"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "draw",
"return_type": "void",
"params": [
{
"name": "",
"type": "const core::visual::VisualParams *"
},
{
"name": "index",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "canCollideWithElement",
"return_type": "bool",
"params": [
{
"name": "index",
"type": "int"
},
{
"name": "model2",
"type": "CollisionModel *"
},
{
"name": "index2",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getMechanicalState",
"return_type": "core::behavior::MechanicalState<DataTypes> *",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getNormal",
"return_type": "Deriv",
"params": [
{
"name": "index",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "velocity",
"return_type": "const Deriv &",
"params": [
{
"name": "index",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "canCreate",
"return_type": "bool",
"params": [
{
"name": "obj",
"type": "T *&"
},
{
"name": "context",
"type": "core::objectmodel::BaseContext *"
},
{
"name": "arg",
"type": "core::objectmodel::BaseObjectDescription *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "computeBBox",
"return_type": "void",
"params": [
{
"name": "params",
"type": "const core::ExecParams *"
},
{
"name": "onlyVisible",
"type": "bool"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "updateNormals",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getCollisionTopology",
"return_type": "sofa::core::topology::BaseMeshTopology *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": "The PointCollisionModel is a collision model designed to represent objects as collections of points in space for the purpose of collision detection and response.",
"parameters": [
{
"name": "draw",
"description": "Method to draw individual elements (points) within the collision model. Takes an index parameter, but currently does not perform any drawing."
},
{
"name": "computeBBox",
"description": "Computes the bounding box for the collision model based on the current positions of all points. The method checks if only visible elements should be considered and sets the bounding box value accordingly."
},
{
"name": "drawCollisionModel",
"description": "Renders the entire collision model using visual parameters provided by the core framework. Draws points and optionally lines representing normals at each point, as well as free positions of points if enabled in settings. Utilizes wireframe display mode for visualization when specified."
}
],
"methods_used": [
{
"name": "drawPoints",
"description": "Draws a set of points with specified size and color."
},
{
"name": "drawLines",
"description": "Draws lines between pairs of points with specified line width and color."
},
{
"name": "setPolygonMode",
"description": "Sets whether to draw in wireframe mode or not."
}
],
"attributes_used": [
{
"name": "mstate",
"description": "Represents the state of motion for each point, including its position and velocity."
},
{
"name": "normals",
"description": "Array storing normal vectors at each point, used to represent surface orientation at discrete locations within the collision model."
}
],
"usage_examples": [
{
"example": "This component is typically used in simulations where objects are represented by a dense set of points rather than continuous surfaces. It enables detailed collision detection and response based on point-level interactions.",
"context": "Physics simulation, robotics, virtual environments"
}
],
"maths": "The PointCollisionModel is a collision model that represents objects as collections of points for the purpose of collision detection. It does not contribute to the governing equations or operators in the context of FEM simulation, such as mass matrix $M$, stiffness matrix $K$, internal force $f_{int}$, or residual $R$. Instead, its role is primarily related to geometric and topological aspects used during the constraint handling phase.\n\n### Governing Equations and Operators\n- **No Contribution:** The PointCollisionModel does not directly influence the global governing equations of motion. It is a structural component focused on collision detection and does not participate in the computation of forces or displacements within the FEM framework.\n\n### Constitutive or Kinematic Laws Involved\n- **None:** There are no constitutive laws (such as strain measures, stress tensors, hyperelastic potentials) or kinematic laws involved directly related to this component. The primary concern is geometric data management and collision detection logic.\n\n### Role in the Global FEM Pipeline\n- **Collision Handling:** It represents a set of points for collision purposes. This involves:\n - Geometric representation (points, normals).\n - Computation of bounding volumes (e.g., bounding boxes or trees) to efficiently detect potential collisions.\n - Constraint handling during collision response (though it does not directly enforce constraints).\n- **Initialization and Updating:** During initialization (`init` method), the component sets up its internal state based on the mechanical model's data. It also updates normals if required, which is critical for some collision detection algorithms.\n\n### Numerical Methods or Discretization Choices\n- **Point Representation:** Points are represented by their positions ($\\mathbf{p}$) and velocities ($\\mathbf{v}$), which are retrieved from the MechanicalState associated with the component.\n- **Bounding Volume Computation:** It computes bounding volumes (e.g., cubes or boxes) for each point, which are used to detect potential collisions efficiently. The method `computeBoundingTree` updates these bounding volumes based on the current state of points and their normals.\n\n### Integration into Variational / Lagrangian Mechanics Framework\n- **Geometric Representation:** While it does not contribute directly to variational principles or Lagrangian mechanics, its role is essential in enforcing physical constraints such as collision avoidance. This indirectly supports the broader framework by ensuring that mechanical models do not interpenetrate.\n- **Bounding Volumes and Normals:** The bounding volumes and computed normals are used to efficiently handle and resolve collisions, which can influence the overall dynamic behavior of a system during simulation steps.\n\n### Key Conceptual Insight\nThe PointCollisionModel is primarily focused on geometric collision detection and does not participate in the core numerical methods or constitutive models. Its role is to provide an efficient and accurate mechanism for identifying potential collisions between objects in the simulation, thereby supporting constraint handling and ensuring physically consistent behavior.",
"abstract": "The PointCollisionModel represents objects as collections of points for efficient collision detection and response.",
"sheet": "# PointCollisionModel\n\n**Overview:**\nThe PointCollisionModel is a component designed to represent objects as sets of points, facilitating efficient collision detection and response. It inherits from the `CollisionModel` class and requires a topology container (`BaseMeshTopology`) to define its structure.\n\n**Parameters and Data:*\n- **bothSide (bool):** Activates collision on both sides of the point model when surface normals are defined. Default is false.\n- **computeNormals (bool):** Enables computation of normal vectors, necessary for certain collision detection algorithms. Default is false.\n- **displayFreePosition (bool):** Displays the free position of collision points in green. Default is false.\n\n**Dependencies and Connections:**\nThe PointCollisionModel requires a `BaseMeshTopology` component to define its topological structure. It interacts with other components for collision detection, such as force fields or constraint solvers, by providing geometric information about point positions and normals."
}