|
NetDEM v1.0
|
GJK solver for convex geometries. More...
#include <solver_gjk_pp.hpp>
Public Member Functions | |
| SolverGJKPP () | |
| Default constructor for SolverGJKPP. | |
| SolverGJKPP (Particle *const p1, Particle *const p2) | |
| Constructor for SolverGJKPP. | |
| CollisionSolverPP * | Clone () const override |
| Creates a copy of this collision solver. | |
| void | Init (Particle *const p1, Particle *const p2) override |
| Initializes the collision solver with two particles. | |
| bool | Detect () override |
| Detects collisions between the two particles. | |
| void | ResolveInit (ContactPP *const cnt, double timestep) override |
| Initializes the contact point between two particles at time t = 0. | |
| void | ResolveUpdate (ContactPP *const cnt, double timestep) override |
| Updates the contact point between two particles at time t > 0. | |
| void | ResolveInit (CollisionGeometries *const cnt_geoms, double timestep) |
| Initializes the contact geometries between two particles at time t = 0. | |
| void | ResolveUpdate (CollisionGeometries *const cnt_geoms, double timestep) |
| Updates the contact geometries between two particles at time t > 0. | |
Public Member Functions inherited from netdem::CollisionSolverPP | |
| CollisionSolverPP () | |
| CollisionSolverPP (Particle *const p1, Particle *const p2) | |
| virtual bool | Detect (ContactPP *const cnt) |
| virtual | ~CollisionSolverPP () |
Public Attributes | |
| double | erosion_ratio_initial {0.01} |
| < The initial ratio of erosion for the terrain. | |
| double | erosion_ratio_increment {0.01} |
| Whether to use erosion for the terrain or not. | |
| bool | use_erosion {false} |
| bool | enable_logging {false} |
| Flag to determine whether logging is enabled. | |
Public Attributes inherited from netdem::CollisionSolverPP | |
| Particle * | particle_1 {nullptr} |
| Particle * | particle_2 {nullptr} |
Protected Member Functions | |
| bool | GJK () |
| Runs the Gilbert-Johnson-Keerthi algorithm. | |
| std::tuple< double, Vec3d, Vec3d > | GJK_EROSION () |
| Runs the Gilbert-Johnson-Keerthi algorithm with erosion applied. | |
| std::tuple< double, Vec3d, Vec3d > | EPA () |
| Runs the Expanding Polytope Algorithm. | |
| std::tuple< Vec3d, bool > | GetContactPoint (Vec3d const &dir) |
| Computes the contact point along a given direction. | |
| 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 of 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 used in the Gilbert-Johnson-Keerthi algorithm. | |
| void | UpdateSimplexLine (Simplex *const s, Vec3d *const dir, double *const min_dist, bool *const cnt_flag) |
| Updates the simplex when it contains a line segment. | |
| void | UpdateSimplexTriangle (Simplex *const s, Vec3d *const dir, double *const min_dist, bool *const cnt_flag) |
| Updates the simplex when it contains a triangle. | |
| void | UpdateSimplexTetrahedron (Simplex *const s, Vec3d *const dir, double *const min_dist, bool *const cnt_flag) |
| Updates the simplex when it contains a tetrahedron. | |
| std::tuple< Vec3d, double > | GetFacetNormal (Vec3d const &a, Vec3d const &b, Vec3d const &c) |
| Computes the normal and distance from origin of a facet defined by three vertices. | |
| void | GetLooseEdges (VecXT< Vec2i > *const edges, Vec3i const &facet) |
| Computes the edges of a triangle that could potentially be involved in a collision. | |
| void | GetIntersections (VecXT< Vec3d > *const intersects, Vec3d const &dir_n, Vec3d const &l1_p1, Vec3d const &l1_p2, Vec3d const &l2_p1, Vec3d const &l2_p2) |
| Computes the intersection points of two line segments. | |
| void | GetIntersectionsAggresive (VecXT< Vec3d > *const intersects, Vec3d const &dir_n, Vec3d const &l1_p1, Vec3d const &l1_p2, Vec3d const &l2_p1, Vec3d const &l2_p2) |
| Computes the intersection points of two line segments using a more aggressive algorithm. | |
| void | SortVertices (VecXT< Vec3d > *const pos_vec, Vec3d const &dir_n) |
| Sorts the vertices of a polygon based on their distance to a given point. | |
| bool | IsInsidePolygon (VecXT< Vec3d > const &pos_vec, Vec3d const &dir_n, Vec3d const &pos) |
| Determines whether a point is inside a polygon. | |
| Vec3d | GetPolygonCentroid (VecXT< Vec3d > const &pos_vec, Vec3d const &dir_n) |
| Computes the centroid of a polygon. | |
Protected Member Functions inherited from netdem::CollisionSolverPP | |
| void | InitBasicGeoms (CollisionGeometries *const cnt_geoms, double timestep) |
| void | UpdateBasicGeoms (CollisionGeometries *const cnt_geoms, double timestep, Vec3d const &dir_n_old) |
| Update the basic contact geometries associated with a collision. | |
Protected Attributes | |
| Shape * | shape_1 {nullptr} |
| Shape * | shape_2 {nullptr} |
| double | bound_sphere_radius_1 |
| double | bound_sphere_radius_2 |
| Vec3d | dpos_12 |
| Vec3d | dpos_12_ref |
| Vec4d | dquat_12 |
| Vec4d | dquat_12_conj |
| Simplex | simplex_after_gjk |
GJK solver for convex geometries.
| netdem::SolverGJKPP::SolverGJKPP | ( | ) |
Default constructor for SolverGJKPP.
Constructor for SolverGJKPP.
| p1 | The first particle. |
| p2 | The second particle. |
|
overridevirtual |
Creates a copy of this collision solver.
Implements netdem::CollisionSolverPP.
|
overridevirtual |
Detects collisions between the two particles.
Implements netdem::CollisionSolverPP.
Runs the Expanding Polytope Algorithm.
Computes the contact point along a given direction.
| dir | The direction to compute the contact point along. |
|
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 from origin of a facet defined by three vertices.
| a | The first vertex. |
| b | The second vertex. |
| c | The third vertex. |
|
protected |
Computes the intersection points of two line segments.
| intersects | The output vector of intersection points. |
| dir_n | The direction of the line segments. |
| l1_p1 | The starting point of the first line segment. |
| l1_p2 | The ending point of the first line segment. |
| l2_p1 | The starting point of the second line segment. |
| l2_p2 | The ending point of the second line segment. |
|
protected |
Computes the intersection points of two line segments using a more aggressive algorithm.
| intersects | The output vector of intersection points. |
| dir_n | The direction of the line segments. |
| l1_p1 | The starting point of the first line segment. |
| l1_p2 | The ending point of the first line segment. |
| l2_p1 | The starting point of the second line segment. |
| l2_p2 | The ending point of the second line segment. |
|
protected |
Computes the edges of a triangle that could potentially be involved in a collision.
| edges | The output vector of edges. |
| facet | The indices of the vertices defining the triangle. |
|
protected |
Computes the centroid of a polygon.
| pos_vec | The vector of vertices defining the polygon. |
| dir_n | The normal of the polygon. |
|
protected |
Runs the Gilbert-Johnson-Keerthi algorithm.
Runs the Gilbert-Johnson-Keerthi algorithm with erosion applied.
Initializes the collision solver with two particles.
| p1 | The first particle. |
| p2 | The second particle. |
Reimplemented from netdem::CollisionSolverPP.
|
protected |
Determines whether a point is inside a polygon.
| pos_vec | The vector of vertices defining the polygon. |
| dir_n | The normal of the polygon. |
| pos | The position of the point to test. |
|
inlineprotected |
Computes the Minkowski difference of two shapes along a given direction.
| dir | The direction to compute the Minkowski difference along. |
| erosion_ratio | The erosion ratio to apply. |
| void netdem::SolverGJKPP::ResolveInit | ( | CollisionGeometries *const | cnt_geoms, |
| double | timestep ) |
Initializes the contact geometries between two particles at time t = 0.
| cnt_geoms | The contact geometries. |
| timestep | The simulation timestep. |
|
overridevirtual |
Initializes the contact point between two particles at time t = 0.
| cnt | The contact point. |
| timestep | The simulation timestep. |
Implements netdem::CollisionSolverPP.
| void netdem::SolverGJKPP::ResolveUpdate | ( | CollisionGeometries *const | cnt_geoms, |
| double | timestep ) |
Updates the contact geometries between two particles at time t > 0.
| cnt_geoms | The contact geometries. |
| timestep | The simulation timestep. |
|
overridevirtual |
Updates the contact point between two particles at time t > 0.
| cnt | The contact point. |
| timestep | The simulation timestep. |
Implements netdem::CollisionSolverPP.
|
protected |
Sorts the vertices of a polygon based on their distance to a given point.
| pos_vec | The vector of vertices to sort. |
| dir_n | The direction to sort the vertices in. |
|
protected |
Updates the simplex used in the Gilbert-Johnson-Keerthi algorithm.
| s | The simplex to update. |
| dir | The search direction. |
| min_dist | The minimum distance between the two shapes. |
| cnt_flag | A flag indicating whether a contact has been found. |
|
protected |
Updates the simplex when it contains a line segment.
| s | The simplex to update. |
| dir | The search direction. |
| min_dist | The minimum distance between the two shapes. |
| cnt_flag | A flag indicating whether a contact has been found. |
|
protected |
Updates the simplex when it contains a tetrahedron.
| s | The simplex to update. |
| dir | The search direction. |
| min_dist | The minimum distance between the two shapes. |
| cnt_flag | A flag indicating whether a contact has been found. |
|
protected |
Updates the simplex when it contains a triangle.
| s | The simplex to update. |
| dir | The search direction. |
| min_dist | The minimum distance between the two shapes. |
| cnt_flag | A flag indicating whether a contact has been found. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| bool netdem::SolverGJKPP::enable_logging {false} |
Flag to determine whether logging is enabled.
| double netdem::SolverGJKPP::erosion_ratio_increment {0.01} |
Whether to use erosion for the terrain or not.
| double netdem::SolverGJKPP::erosion_ratio_initial {0.01} |
< The initial ratio of erosion for the terrain.
The increment ratio of erosion for the terrain.
|
protected |
|
protected |
|
protected |
| bool netdem::SolverGJKPP::use_erosion {false} |