|
physics
|
#include <glm/ext.hpp>#include <iostream>#include <vector>#include <map>#include <stack>#include <glm/glm.hpp>Go to the source code of this file.
Functions | |
| vec3 | findOrthogonal (vec3 v) |
| Find a vector that is orthogonal to v. More... | |
| mat3 | formOrthogonalBasis (vec3 const &v) |
| Given the vector, v, generate two other orthogonal vectors thus creating a coordinate frame. More... | |
| mat3 | orthonormalizeOrientation (mat3 m) |
| Normalize all vectors in the matrix, m. More... | |
| mat3 | skewSymmetric (vec3 const &v) |
| Return a skew-symmetric (cross product matrix) for the vector, v. More... | |
| vector< vec3 > | getAABBVertices (const vec3 &_min, const vec3 &_max) |
| Get the 6 vertices that define the corners of the AABB defined by the min and max points. More... | |
| float | clamp (float value, float _min, float _max) |
| Clamp the value between the min and max values. More... | |
| vec3 | matrixMultiply (const mat4 &m, const vec3 &v) |
| Multiply a matrix with a vec3. More... | |
| vector< float > | getAABB (const vector< vec3 > &vertices) |
| Return a vector of floats representing the min and max values (minX, minY, minZ, maxX, maxY, maxZ) of the input vertices. More... | |
| bool | AABBOverlap (const vec3 &_min1, const vec3 &_max1, const vec3 &_min2, const vec3 &_max2) |
| AABB collision detection. More... | |
| float | pointLineIntersection (const vec3 &p3, const vec3 &p1, const vec3 &p2) |
| Point and line collision,. More... | |
| float | distPointToTriangle (const vec3 &point, const vec3 &v1, const vec3 &v2, const vec3 &v3) |
| Distance from a point to a triangle. More... | |
| vec2 | lineSegmentIntersection (const vec3 &p1, const vec3 &p2, const vec3 &p3, const vec3 &p4) |
| Collision detection between two line segments, returns t1,t2, where the closest points on each line are p1 + t1 * p2, p3 + t2 * p4. More... | |
| vec2 | closestPointsOnLineSegments (const vec3 &p1, const vec3 &p2, const vec3 &p3, const vec3 &p4) |
| Collision detection between two line segments, returns t1,t2, where the closest points on each line are p1 + t1 * p2, p3 + t2 * p4. More... | |
| float | pointPlaneDistance (const vec3 &point, const vec3 &planePosition, const vec3 &planeNormal) |
| Distance between a point and a plane. More... | |
| vec3 | pointLineSegmentIntersection (vec3 p, vec3 l1, vec3 l2) |
| Closest point on a line segment to a point. More... | |
| vec3 | pointQuadIntersection (vec3 pt, vec3 t1, vec3 t2, vec3 t3, vec3 t4) |
| Closest point on a quad to a point. More... | |
| vec3 | pointTriangleIntersection (vec3 pt, vec3 t1, vec3 t2, vec3 t3, unsigned int &type) |
| Closest point on a triangle to a point. More... | |
| bool | clipPolygonToPlane (vector< vec3 > &polygon, const vec3 &plane_pos, const vec3 &plane_normal, vector< vector< int > > &contactIDs, unsigned int planeIndex) |
| Sutherland-Hodgeman clipping algorithm. More... | |
| bool | buildMinkowskiFace (const vec3 &a, const vec3 &b, const vec3 &b_x_a, const vec3 &c, const vec3 &d, const vec3 &d_x_c) |
| Minkowski difference to early out some checks in SAT. More... | |
| vec3 | closestPointOnCircle (vec3 p, vec3 plane_position, vec3 plane_normal, float r) |
| Return closest point on a circle to a point, p. More... | |
| float | spherePlaneCollision (vec3 sphereCentre, vec3 planeNormal, vec3 pointOnPlane) |
| Sphere plane collision detection. More... | |
| bool | rayTriangleCollision (vec3 planeIntersection, vec3 planeNormal, vec3 v1, vec3 v2, vec3 v3) |
| Ray triangle collision detection. More... | |
| vec3 | closestPointOnLineSegment (vec3 A, vec3 B, vec3 point) |
| closest point on line segment, A, B, to point. More... | |
| vec3 | closestPointOnOBB (vec3 point, float box_dX2, float box_dY2, float box_dZ2, vec3 box_position, mat3 box_orientation) |
| Returns closest point on OBB, from point. More... | |
| mat3 | parallelAxis (vec3 r) |
| Parallel Axis Theorem (Nyguen-Steiner) More... | |
| vec3 | getPos (mat4 m) |
| Get position from a model matrix. More... | |
| bool AABBOverlap | ( | const vec3 & | _min1, |
| const vec3 & | _max1, | ||
| const vec3 & | _min2, | ||
| const vec3 & | _max2 | ||
| ) |
AABB collision detection.
| bool buildMinkowskiFace | ( | const vec3 & | a, |
| const vec3 & | b, | ||
| const vec3 & | b_x_a, | ||
| const vec3 & | c, | ||
| const vec3 & | d, | ||
| const vec3 & | d_x_c | ||
| ) |
Minkowski difference to early out some checks in SAT.
| float clamp | ( | float | value, |
| float | _min, | ||
| float | _max | ||
| ) |
Clamp the value between the min and max values.
| bool clipPolygonToPlane | ( | vector< vec3 > & | polygon, |
| const vec3 & | plane_pos, | ||
| const vec3 & | plane_normal, | ||
| vector< vector< int > > & | contactIDs, | ||
| unsigned int | planeIndex | ||
| ) |
Sutherland-Hodgeman clipping algorithm.
| vec3 closestPointOnCircle | ( | vec3 | p, |
| vec3 | plane_position, | ||
| vec3 | plane_normal, | ||
| float | r | ||
| ) |
Return closest point on a circle to a point, p.
| vec3 closestPointOnLineSegment | ( | vec3 | A, |
| vec3 | B, | ||
| vec3 | point | ||
| ) |
closest point on line segment, A, B, to point.
| vec3 closestPointOnOBB | ( | vec3 | point, |
| float | box_dX2, | ||
| float | box_dY2, | ||
| float | box_dZ2, | ||
| vec3 | box_position, | ||
| mat3 | box_orientation | ||
| ) |
Returns closest point on OBB, from point.
| vec2 closestPointsOnLineSegments | ( | const vec3 & | p1, |
| const vec3 & | p2, | ||
| const vec3 & | p3, | ||
| const vec3 & | p4 | ||
| ) |
Collision detection between two line segments, returns t1,t2, where the closest points on each line are p1 + t1 * p2, p3 + t2 * p4.
| float distPointToTriangle | ( | const vec3 & | point, |
| const vec3 & | v1, | ||
| const vec3 & | v2, | ||
| const vec3 & | v3 | ||
| ) |
Distance from a point to a triangle.
| vec3 findOrthogonal | ( | vec3 | v | ) |
Find a vector that is orthogonal to v.
| mat3 formOrthogonalBasis | ( | vec3 const & | v | ) |
Given the vector, v, generate two other orthogonal vectors thus creating a coordinate frame.
| vector<float> getAABB | ( | const vector< vec3 > & | vertices | ) |
Return a vector of floats representing the min and max values (minX, minY, minZ, maxX, maxY, maxZ) of the input vertices.
| vector<vec3> getAABBVertices | ( | const vec3 & | _min, |
| const vec3 & | _max | ||
| ) |
Get the 6 vertices that define the corners of the AABB defined by the min and max points.
| vec3 getPos | ( | mat4 | m | ) |
Get position from a model matrix.
| vec2 lineSegmentIntersection | ( | const vec3 & | p1, |
| const vec3 & | p2, | ||
| const vec3 & | p3, | ||
| const vec3 & | p4 | ||
| ) |
Collision detection between two line segments, returns t1,t2, where the closest points on each line are p1 + t1 * p2, p3 + t2 * p4.
| vec3 matrixMultiply | ( | const mat4 & | m, |
| const vec3 & | v | ||
| ) |
Multiply a matrix with a vec3.
| mat3 orthonormalizeOrientation | ( | mat3 | m | ) |
Normalize all vectors in the matrix, m.
| mat3 parallelAxis | ( | vec3 | r | ) |
Parallel Axis Theorem (Nyguen-Steiner)
| float pointLineIntersection | ( | const vec3 & | p3, |
| const vec3 & | p1, | ||
| const vec3 & | p2 | ||
| ) |
Point and line collision,.
| vec3 pointLineSegmentIntersection | ( | vec3 | p, |
| vec3 | l1, | ||
| vec3 | l2 | ||
| ) |
Closest point on a line segment to a point.
| float pointPlaneDistance | ( | const vec3 & | point, |
| const vec3 & | planePosition, | ||
| const vec3 & | planeNormal | ||
| ) |
Distance between a point and a plane.
| vec3 pointQuadIntersection | ( | vec3 | pt, |
| vec3 | t1, | ||
| vec3 | t2, | ||
| vec3 | t3, | ||
| vec3 | t4 | ||
| ) |
Closest point on a quad to a point.
| vec3 pointTriangleIntersection | ( | vec3 | pt, |
| vec3 | t1, | ||
| vec3 | t2, | ||
| vec3 | t3, | ||
| unsigned int & | type | ||
| ) |
Closest point on a triangle to a point.
| bool rayTriangleCollision | ( | vec3 | planeIntersection, |
| vec3 | planeNormal, | ||
| vec3 | v1, | ||
| vec3 | v2, | ||
| vec3 | v3 | ||
| ) |
Ray triangle collision detection.
| mat3 skewSymmetric | ( | vec3 const & | v | ) |
Return a skew-symmetric (cross product matrix) for the vector, v.
| float spherePlaneCollision | ( | vec3 | sphereCentre, |
| vec3 | planeNormal, | ||
| vec3 | pointOnPlane | ||
| ) |
Sphere plane collision detection.
1.8.13