|
ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
|
Primitive for EPA algorithm. More...
#include <types.hpp>
Classes | |
| struct | Face |
| Stores the indices of a single face of this polytope. More... | |
Public Member Functions | |
| Polytope (const Simplex &simplex) | |
| Creates a polytope object out of a simplex. | |
| glm::vec3 | getNextSearch () const |
| Returns the next search direction for a point to add to the polytope. | |
| std::size_t | getNumFaces () const |
| std::size_t | getNumPoints () const |
| glm::vec3 | getClosestPoint () const |
| Returns the closest point to the origin on the triangle face closest to the origin. | |
| glm::vec3 | getClosestTriangleNormal () const |
| Returns the direction to the closest point on the polytope's surface from the origin. | |
| AreaTriangle | getClosestTriangle () const |
| Returns the closest polytope triangle. | |
| AreaTriangle | getClosestTriangleSupportA () const |
| Gets the points of shape A that were responsible for generating the closest triangle of the polytope. | |
| AreaTriangle | getClosestTriangleSupportB () const |
| Gets the points of shape B that were responsible for generating the closest triangle of the polytope. | |
| bool | append (const glm::vec3 &newPoint, const glm::vec3 &supportA, const glm::vec3 &supportB) |
| Appends a new point, replacing the topmost triangle in the polygon with 3 more triangles including the new point. | |
Private Member Functions | |
| Polytope () | |
| glm::vec3 | getTriangleCross (const Face &face) const |
| glm::vec3 | getTriangleNorm (const Face &face) const |
Private Attributes | |
| std::priority_queue< Face, std::vector< Face >, std::function< bool(const Face &, const Face &)> > | mFaces |
| The list of triangle faces representing this polytope. | |
| std::vector< glm::vec3 > | mPoints {} |
| List of points representing this polytope. | |
| std::vector< glm::vec3 > | mPointsSupportA {} |
| List of points representing support point A, where each point corresponds to the polytope point it generated in mPoints at the same index. | |
| std::vector< glm::vec3 > | mPointsSupportB {} |
| List of points representing support point B, where each point corresponds to the polytope point it generated in mPoints at the same index. | |
Primitive for EPA algorithm.
Represents a polygonal shape contained within the Minkowski difference of two intersecting shapes. Stores polytope faces in order of their proximity to the origin.
|
private |
Initializes an empty polytope
| Polytope::Polytope | ( | const Simplex & | simplex | ) |
Creates a polytope object out of a simplex.
Simplex must be a tetrahedron enclosing the origin – creation will fail otherwise.
| bool Polytope::append | ( | const glm::vec3 & | newPoint, |
| const glm::vec3 & | supportA, | ||
| const glm::vec3 & | supportB ) |
Appends a new point, replacing the topmost triangle in the polygon with 3 more triangles including the new point.
| newPoint | The new point to add to the polytope |
| supportA | The term on the LHS of the Minkowski difference that created newPoint |
| supportB | The term on the RHS of the Minkowski difference that created newPoint |
| false | New point is not beyond current closest point in latest search direction. |
| true | Successfully appended triangles including new point to the list. |
| AreaTriangle Polytope::getClosestTriangle | ( | ) | const |
Returns the closest polytope triangle.
This is useful when we want to find the barycentric coordinates of this triangle to derive contact points for a pair of intersecting shapes.
| glm::vec3 Polytope::getClosestTriangleNormal | ( | ) | const |
Returns the direction to the closest point on the polytope's surface from the origin.
Directly represents the contact normal between two objects.
|
inline |
Returns the number of faces that this polytope is comprised of