|
ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
|
Primitive for GJK algorithm. More...
#include <types.hpp>
Public Member Functions | |
| bool | append (const glm::vec3 &candidatePoint, const glm::vec3 &supportA, const glm::vec3 &supportB) |
| Adds a new point to the simplex. | |
| void | reorder (const std::vector< uint8_t > reorderedIndices) |
| Replaces the current simplex with points from a new list (which will usually have as many or fewer points). | |
| std::pair< bool, glm::vec3 > | evaluate () |
| Tries to find a 3-simplex that encloses the origin. | |
Public Attributes | |
| std::array< glm::vec3, 4 > | mPoints |
| Points representing the simplex, derived by finding the Minksowski difference of support points on two convex shapes. | |
| std::array< glm::vec3, 4 > | mPointsSupportA |
| The point on the LHS of the Minkowski difference, where each index corresponds to a point on mPoints. | |
| std::array< glm::vec3, 4 > | mPointsSupportB |
| The point on the RHS of the Minkowski difference, where each index corresponds to a point on mPoints. | |
| uint8_t | mNPoints { 0 } |
| The number of points in this simplex. | |
Private Member Functions | |
| std::pair< bool, glm::vec3 > | doSimplex4 () |
| glm::vec3 | doSimplex3 () |
| glm::vec3 | doSimplex2 () |
Primitive for GJK algorithm.
Stores up to 4 points which should enclose the origin in the Minkowski different of two shapes (if those shapes intersect).
|
inline |
Adds a new point to the simplex.
| false | A duplicate was found, and this point could not be added |
| true | Appended new point successfully |
| std::pair< bool, glm::vec3 > Simplex::evaluate | ( | ) |
Tries to find a 3-simplex that encloses the origin.
Implementation of the simplex evaluation/simplification test in GJK, an algorithm for determining whether 2 convex shapes intersect. When they do intersect, this simplex forms a tetrahedron containing point (0, 0, 0).