|
NetDEM v1.0
|
GJK solver for convex geometries. More...
#include <solver_gjk_pw.hpp>
Public Member Functions | |
| SolverGJKPW () | |
| Default constructor for the SolverGJKPW class. | |
| SolverGJKPW (Particle *const p, Wall *const w) | |
| Constructor for the SolverGJKPW class. | |
| CollisionSolverPW * | Clone () const override |
| Creates a copy of the current collision solver. | |
| void | Init (Particle *const p, Wall *const w) override |
| Initializes the collision solver with a particle and a wall. | |
| bool | Detect () override |
| Detects collisions between a particle and a wall. | |
| void | ResolveInit (ContactPW *const cnt, double timestep) override |
| Initializes the contact resolution for a contact point. | |
| void | ResolveUpdate (ContactPW *const cnt, double timestep) override |
| Updates the contact resolution for a contact point. | |
| void | ResolveInit (CollisionGeometries *const cnt_geoms, double timestep) |
| Initializes the contact resolution for a set of collision geometries. | |
| void | ResolveUpdate (CollisionGeometries *const cnt_geoms, double timestep) |
| Updates the contact resolution for a set of collision geometries. | |
Public Member Functions inherited from netdem::CollisionSolverPW | |
| CollisionSolverPW () | |
| CollisionSolverPW (Particle *const p, Wall *const w) | |
| virtual bool | Detect (ContactPW *const cnt) |
| virtual | ~CollisionSolverPW () |
Public Attributes | |
| double | erosion_ratio_initial {0.01} |
| < The initial erosion ratio used by the solver. | |
| double | erosion_ratio_increment {0.01} |
| Whether to use erosion during collision detection. | |
| bool | use_erosion {false} |
| Whether to print debug logs during collision detection. | |
| bool | enable_logging {false} |
Public Attributes inherited from netdem::CollisionSolverPW | |
| Particle * | particle {nullptr} |
| Wall * | wall {nullptr} |
Protected Member Functions | |
| bool | GJK () |
| Implements the Gilbert-Johnson-Keerthi algorithm for collision detection. | |
| std::tuple< double, Vec3d, Vec3d > | GJK_EROSION () |
| Implements the Gilbert-Johnson-Keerthi algorithm with erosion for collision detection. | |
| std::tuple< double, Vec3d, Vec3d > | EPA () |
| Implements the Expanding Polytope Algorithm for collision resolution. | |
| std::tuple< Vec3d, bool > | GetContactPoint (Vec3d const &dir) |
| Computes the contact point given the contact normal. | |
| std::tuple< Vec3d, bool > | GetContactPoint_PlaneCase (Vec3d const &dir, const VecXT< Vec3d > &pos_vec_1, const VecXT< Vec3d > &pos_vec_2) |
| Computes the contact point in the case where one of the shapes is a plane. | |
| Vec3d | MinkowskiDiff (Vec3d const &dir, double erosion_ratio=0) |
| Computes the Minkowski difference between the two shapes along a given direction. | |
| void | UpdateSimplex (Simplex *const s, Vec3d *const dir, double *const min_dist, bool *const cnt_flag) |
| Updates the simplex after each GJK iteration based on the distance computed. | |
| void | UpdateSimplexLine (Simplex *const s, Vec3d *const dir, double *const min_dist, bool *const cnt_flag) |
| Updates the simplex for the line case. | |
| void | UpdateSimplexTriangle (Simplex *const s, Vec3d *const dir, double *const min_dist, bool *const cnt_flag) |
| Updates the simplex for the triangle case. | |
| void | UpdateSimplexTetrahedron (Simplex *const s, Vec3d *const dir, double *const min_dist, bool *const cnt_flag) |
| Updates the simplex for the tetrahedron case. | |
| std::tuple< Vec3d, double > | GetFacetNormal (Vec3d const &a, Vec3d const &b, Vec3d const &c) |
| Computes the normal and distance of a facet defined by three points. | |
| void | GetLooseEdges (VecXT< Vec2i > *const edges, Vec3i const &facet) |
| Computes the edges of a polygon defined by a set of vertices. | |
| void | GetIntersections (VecXT< Vec3d > *const intersects, Vec3d const &dir_n, Vec3d const &l1_p, Vec3d const &l1_w, Vec3d const &l2_p, Vec3d const &l2_w) |
| Computes the intersection points between two 3D line segments. | |
| void | GetIntersectionsAggresive (VecXT< Vec3d > *const intersects, Vec3d const &dir_n, Vec3d const &l1_p, Vec3d const &l1_w, Vec3d const &l2_p, Vec3d const &l2_w) |
| Same as GetInter sections, but uses a more aggressive intersection algorithm. | |
| void | SortVertices (VecXT< Vec3d > *const pos_vec, Vec3d const &dir_n) |
| Sorts the vertices of a polygon in counter-clockwise order relative to a given direction. | |
| bool | IsInsidePolygon (VecXT< Vec3d > const &pos_vec, Vec3d const &dir_n, Vec3d const &pos) |
| Determines whether a point is inside a polygon defined by a set of vertices. | |
| Vec3d | GetPolygonCentroid (VecXT< Vec3d > const &pos_vec, Vec3d const &dir_n) |
| Computes the centroid of a polygon defined by a set of vertices. | |
Protected Member Functions inherited from netdem::CollisionSolverPW | |
| void | InitBasicGeoms (CollisionGeometries *const cnt_geoms, double timestep) |
| void | UpdateBasicGeoms (CollisionGeometries *const cnt_geoms, double timestep, Vec3d const &dir_n_old) |
Protected Attributes | |
| Shape * | shape_1 {nullptr} |
| < The shapes involved in the collision. | |
| Shape * | shape_2 {nullptr} |
| The radii of the bounding spheres around the shapes. | |
| double | bound_sphere_radius_1 |
| double | bound_sphere_radius_2 |
| The position difference between the particles. | |
| Vec3d | dpos_12 |
| Vec3d | dpos_12_ref |
| The orientation difference between the particles. | |
| Vec4d | dquat_12 |
| Vec4d | dquat_12_conj |
| The simplex computed during GJK collision detection. | |
| Simplex | simplex_after_gjk |
GJK solver for convex geometries.
This class is a collision solver that uses the Gilbert-Johnson-Keerthi (GJK) algorithm to detect collisions between particles and walls with convex geometries. It extends the CollisionSolverPW class.
| netdem::SolverGJKPW::SolverGJKPW | ( | ) |
Default constructor for the SolverGJKPW class.
Constructor for the SolverGJKPW class.
| p | The particle involved in the collision. |
| w | The wall involved in the collision. |
|
overridevirtual |
Creates a copy of the current collision solver.
Implements netdem::CollisionSolverPW.
|
overridevirtual |
Detects collisions between a particle and a wall.
Implements netdem::CollisionSolverPW.
Implements the Expanding Polytope Algorithm for collision resolution.
Computes the contact point given the contact normal.
| dir | The contact normal. |
|
protected |
Computes the contact point in the case where one of the shapes is a plane.
| dir | The contact normal. |
| pos_vec_1 | The positions of the vertices of shape 1. |
| pos_vec_2 | The positions of the vertices of shape 2. |
|
inlineprotected |
Computes the normal and distance of a facet defined by three points.
| a | The first point of the facet. |
| b | The second point of the facet. |
| c | The third point of the facet. |
|
protected |
Computes the intersection points between two 3D line segments.
| intersects | The output vector of intersection points. |
| dir_n | The direction of the line segments. |
| l1_p | The starting point of the first line segment. |
| l1_w | The ending point of the first line segment. |
| l2_p | The starting point of the second line segment. |
| l2_w | The ending point of the second line segment. |
|
protected |
Same as GetInter sections, but uses a more aggressive intersection algorithm.
| intersects | The output vector of intersection points. |
| dir_n | The direction of the line segments. |
| l1_p | The starting point of the first line segment. |
| l1_w | The ending point of the first line segment. |
| l2_p | The starting point of the second line segment. |
| l2_w | The ending point of the second line segment. |
|
protected |
Computes the edges of a polygon defined by a set of vertices.
| edges | The output vector of edges. |
| facet | The indices of the vertices defining the polygon. |
|
protected |
Computes the centroid of a polygon defined by a set of vertices.
| pos_vec | The vertices defining the polygon. |
| dir_n | The normal vector of the polygon. |
|
protected |
Implements the Gilbert-Johnson-Keerthi algorithm for collision detection.
Implements the Gilbert-Johnson-Keerthi algorithm with erosion for collision detection.
Initializes the collision solver with a particle and a wall.
| p | The particle involved in the collision. |
| w | The wall involved in the collision. |
Reimplemented from netdem::CollisionSolverPW.
|
protected |
Determines whether a point is inside a polygon defined by a set of vertices.
| pos_vec | The vertices defining the polygon. |
| dir_n | The normal vector of the polygon. |
| pos | The point to test for containment. |
|
inlineprotected |
Computes the Minkowski difference between the two shapes along a given direction.
| dir | The direction to compute the Minkowski difference along. |
| erosion_ratio | The amount of erosion to apply to the shapes. |
| void netdem::SolverGJKPW::ResolveInit | ( | CollisionGeometries *const | cnt_geoms, |
| double | timestep ) |
Initializes the contact resolution for a set of collision geometries.
| cnt_geoms | The collision geometries to resolve. |
| timestep | The simulation time step size. |
|
overridevirtual |
Initializes the contact resolution for a contact point.
| cnt | The contact point to resolve. |
| timestep | The simulation time step size. |
Implements netdem::CollisionSolverPW.
| void netdem::SolverGJKPW::ResolveUpdate | ( | CollisionGeometries *const | cnt_geoms, |
| double | timestep ) |
Updates the contact resolution for a set of collision geometries.
| cnt_geoms | The collision geometries to resolve. |
| timestep | The simulation time step size. |
|
overridevirtual |
Updates the contact resolution for a contact point.
| cnt | The contact point to resolve. |
| timestep | The simulation time step size. |
Implements netdem::CollisionSolverPW.
|
protected |
Sorts the vertices of a polygon in counter-clockwise order relative to a given direction.
| pos_vec | The input and output vector of vertices. |
| dir_n | The direction to sort the vertices relative to. |
|
protected |
Updates the simplex after each GJK iteration based on the distance computed.
| s | The current simplex. |
| dir | The search direction for the next iteration. |
| min_dist | The minimum distance between the shapes. |
| cnt_flag | A flag indicating whether a contact has been detected. |
|
protected |
Updates the simplex for the line case.
| s | The current simplex. |
| dir | The search direction for the next iteration. |
| min_dist | The minimum distance between the shapes. |
| cnt_flag | A flag indicating whether a contact has been detected. |
|
protected |
Updates the simplex for the tetrahedron case.
| s | The current simplex. |
| dir | The search direction for the next iteration. |
| min_dist | The minimum distance between the shapes. |
| cnt_flag | A flag indicating whether a contact has been detected. |
|
protected |
Updates the simplex for the triangle case.
| s | The current simplex. |
| dir | The search direction for the next iteration. |
| min_dist | The minimum distance between the shapes. |
| cnt_flag | A flag indicating whether a contact has been detected. |
|
protected |
|
protected |
The position difference between the particles.
|
protected |
|
protected |
The orientation difference between the particles.
|
protected |
|
protected |
The simplex computed during GJK collision detection.
| bool netdem::SolverGJKPW::enable_logging {false} |
| double netdem::SolverGJKPW::erosion_ratio_increment {0.01} |
Whether to use erosion during collision detection.
| double netdem::SolverGJKPW::erosion_ratio_initial {0.01} |
< The initial erosion ratio used by the solver.
The incremental change in erosion ratio.
|
protected |
< The shapes involved in the collision.
|
protected |
The radii of the bounding spheres around the shapes.
|
protected |
| bool netdem::SolverGJKPW::use_erosion {false} |
Whether to print debug logs during collision detection.