Saga
Saga Game Engine
|
Classes | |
struct | Saga::Geometry::Triangle |
Represents a 3D triangle, equipped with some utility functions. More... | |
Functions | |
std::optional< float > | Saga::Geometry::rayBoxCollision (glm::vec3 rayOrigin, glm::vec3 rayDir, glm::vec3 cornerBotLeft, glm::vec3 cornerTopRight) |
Find the intersection time t between a ray and a box. | |
glm::vec2 | Saga::Geometry::detectCircleCollision (const glm::vec2 &aPos, const float &aRadius, const glm::vec2 &bPos, const float &bRadius) |
Detect if two circles overlap. If they do, output the minimum translation vector from the first circle for both to not be colliding. | |
std::optional< std::tuple< float, float > > | Saga::Geometry::rayUnitCircleAtOriginIntersection (const glm::vec2 &origin, const glm::vec2 &rayDirection) |
Find the entrance and exit times t between a unit circle at the origin and a ray. | |
glm::vec3 | Saga::Geometry::detectAACylinderCylinderCollision (float height0, float radius0, glm::vec3 pos0, float height1, float radius1, glm::vec3 pos1) |
Find the minimum translation vector for two axis-aligned cylinders. If the two cylinders are not penetrating, then return the zero vector. | |
std::optional< std::tuple< float, glm::vec3 > > | Saga::Geometry::movingCylinderCylinderIntersection (float height0, float radius0, glm::vec3 pos0, float height1, float radius1, glm::vec3 pos1, glm::vec3 dir) |
Find the earliest time between intersection of two cylinders, one of which is moving. It must be the case that the two cylinders are not penetrating at the start. | |
std::optional< float > | Saga::Geometry::rayEllipsoidIntersection (const glm::vec3 &rayOrigin, const glm::vec3 &rayDirection, const glm::vec3 &position, const glm::vec3 &radius) |
Find the intersection time t between a ray and an axis-aligned ellipsoid. | |
std::optional< float > | Saga::Geometry::rayUnitSphereAtOriginIntersection (const glm::vec3 &origin, const glm::vec3 &rayDirection) |
Find the intersection time t between a unit sphere at the origin and a ray. | |
std::optional< float > | Saga::Geometry::unitSphereTriangleCollision (const glm::vec3 &pos, const glm::vec3 &dir, const glm::vec3 &a, const glm::vec3 &b, const glm::vec3 &c) |
Find the intersection time t between a moving unit sphere with a triangle. | |
std::optional< float > | Saga::Geometry::movingEllipsoidEllipsoidIntersection (const glm::vec3 &ellipsoidPos0, const glm::vec3 &ellipsoidDir0, const glm::vec3 &ellipsoidRadius0, const glm::vec3 &ellipsoidPos1, const glm::vec3 &ellipsoidRadius1) |
Find the intersection between two moving axis-aligned ellipsoids. | |
std::optional< float > | Saga::Geometry::ellipsoidTriangleCollision (const glm::vec3 &ellipsoidPos, const glm::vec3 &ellipsoidDir, const glm::vec3 &ellipsoidRadius, const glm::vec3 &a, const glm::vec3 &b, const glm::vec3 &c) |
Find the intersection time t between a moving ellipsoid and a triangle. | |
std::optional< float > | Saga::Geometry::unitSphereEdgeCollision (const glm::vec3 &pos, const glm::vec3 &dir, const glm::vec3 &c, const glm::vec3 &d) |
Find collision between a moving unit sphere and an edge (line segment) in 3D. | |
float | Saga::Geometry::detectLineSegmentCollision (const float &alo, const float &ahi, const float &blo, const float &bhi) |
Detect collision (and return minimum translation vector) of two line segments. | |
std::optional< float > | Saga::Geometry::rayTriangleIntersection (const glm::vec3 &origin, const glm::vec3 &rayDirection, Triangle triangle) |
Find the intersection time t where a ray and triangle intersects. Does not detect intersections to the back side of the triangle. | |
glm::vec3 | Saga::Geometry::getClosestPoint (const glm::vec3 pointPos, Triangle triangle) |
Find the closest point between a point and a triangle. | |
glm::vec3 Saga::Geometry::detectAACylinderCylinderCollision | ( | float | height0, |
float | radius0, | ||
glm::vec3 | pos0, | ||
float | height1, | ||
float | radius1, | ||
glm::vec3 | pos1 | ||
) |
Find the minimum translation vector for two axis-aligned cylinders. If the two cylinders are not penetrating, then return the zero vector.
height0 | height of the first cylinder. |
radius0 | radius of the first cylinder. |
pos0 | position of the first cylinder. |
height1 | height of the second cylinder. |
radius1 | radius of the second cylinder. |
pos1 | position of the second cylinder. |
glm::vec2 Saga::Geometry::detectCircleCollision | ( | const glm::vec2 & | aPos, |
const float & | aRadius, | ||
const glm::vec2 & | bPos, | ||
const float & | bRadius | ||
) |
Detect if two circles overlap. If they do, output the minimum translation vector from the first circle for both to not be colliding.
aPos | center of the first circle. |
aRadius | radius of the first circle. |
bPos | center of the second circle. |
bRadius | radius of the second circle. |
float Saga::Geometry::detectLineSegmentCollision | ( | const float & | alo, |
const float & | ahi, | ||
const float & | blo, | ||
const float & | bhi | ||
) |
Detect collision (and return minimum translation vector) of two line segments.
alo | starting point of the first line segment. |
ahi | ending point of the first line segment. Must be at least the starting point. |
blo | starting point of the second line segment. |
bhi | ending point of the second line segment. Must be at least the starting point. |
std::optional< float > Saga::Geometry::ellipsoidTriangleCollision | ( | const glm::vec3 & | ellipsoidPos, |
const glm::vec3 & | ellipsoidDir, | ||
const glm::vec3 & | ellipsoidRadius, | ||
const glm::vec3 & | a, | ||
const glm::vec3 & | b, | ||
const glm::vec3 & | c | ||
) |
Find the intersection time t between a moving ellipsoid and a triangle.
ellipsoidPos | position of the ellipsoid. |
ellipsoidDir | direction of the ellipsoid. |
ellipsoidRadius | radius of the ellipsoid. |
a | triangle first point in counter-clockwise order. |
b | triangle second point in counter-clockwise order. |
c | triangle third point in counter-clockwise order. |
glm::vec3 Saga::Geometry::getClosestPoint | ( | const glm::vec3 | pointPos, |
Triangle | triangle | ||
) |
Find the closest point between a point and a triangle.
pointPos | position of the point in cartesian coordinate. |
triangle | the triangle. |
std::optional< std::tuple< float, glm::vec3 > > Saga::Geometry::movingCylinderCylinderIntersection | ( | float | height0, |
float | radius0, | ||
glm::vec3 | pos0, | ||
float | height1, | ||
float | radius1, | ||
glm::vec3 | pos1, | ||
glm::vec3 | dir | ||
) |
Find the earliest time between intersection of two cylinders, one of which is moving. It must be the case that the two cylinders are not penetrating at the start.
height0 | height of the first cylinder. |
radius0 | radius of the first cylinder. |
pos0 | position of the first cylinder. |
height1 | height of the second cylinder. |
radius1 | radius of the second cylinder. |
pos1 | position of the second cylinder. |
dir | the direction of the first cylinder. |
std::optional< float > Saga::Geometry::movingEllipsoidEllipsoidIntersection | ( | const glm::vec3 & | ellipsoidPos0, |
const glm::vec3 & | ellipsoidDir0, | ||
const glm::vec3 & | ellipsoidRadius0, | ||
const glm::vec3 & | ellipsoidPos1, | ||
const glm::vec3 & | ellipsoidRadius1 | ||
) |
Find the intersection between two moving axis-aligned ellipsoids.
ellipsoidPos0 | position of the first ellipsoid. |
ellipsoidDir0 | direction that the first ellipsoid is moving. |
ellipsoidRadius0 | radius of the first ellipsoid. |
ellipsoidPos1 | position of the second ellipsoid. |
ellipsoidRadius1 | radius of the second ellipsoid. |
std::optional< float > Saga::Geometry::rayBoxCollision | ( | glm::vec3 | rayOrigin, |
glm::vec3 | rayDir, | ||
glm::vec3 | cornerBotLeft, | ||
glm::vec3 | cornerTopRight | ||
) |
Find the intersection time t between a ray and a box.
rayOrigin | origin of the ray. |
rayDir | direction of the ray |
cornerbotLeft | bottom left corner of the box. |
cornerTopRIght | upper right corner of the box. |
std::optional< float > Saga::Geometry::rayEllipsoidIntersection | ( | const glm::vec3 & | rayOrigin, |
const glm::vec3 & | rayDirection, | ||
const glm::vec3 & | position, | ||
const glm::vec3 & | radius | ||
) |
Find the intersection time t between a ray and an axis-aligned ellipsoid.
origin | origin of the ray. |
rayDirection | direction of the ray. |
position | position of the ellipsoid. |
radius | radius of the ellipsoid. |
std::optional< float > Saga::Geometry::rayTriangleIntersection | ( | const glm::vec3 & | origin, |
const glm::vec3 & | rayDirection, | ||
Triangle | triangle | ||
) |
Find the intersection time t where a ray and triangle intersects. Does not detect intersections to the back side of the triangle.
origin | origin of the ray. |
rayDirection | direction of the ray. |
triangle | the triangle. |
std::optional< std::tuple< float, float > > Saga::Geometry::rayUnitCircleAtOriginIntersection | ( | const glm::vec2 & | origin, |
const glm::vec2 & | rayDirection | ||
) |
Find the entrance and exit times t between a unit circle at the origin and a ray.
origin | origin of the ray. |
rayDirection | direction of the ray. |
std::optional< float > Saga::Geometry::rayUnitSphereAtOriginIntersection | ( | const glm::vec3 & | origin, |
const glm::vec3 & | rayDirection | ||
) |
Find the intersection time t between a unit sphere at the origin and a ray.
origin | origin of the ray. |
rayDirection | direction of the ray. |
std::optional< float > Saga::Geometry::unitSphereEdgeCollision | ( | const glm::vec3 & | pos, |
const glm::vec3 & | dir, | ||
const glm::vec3 & | c, | ||
const glm::vec3 & | d | ||
) |
Find collision between a moving unit sphere and an edge (line segment) in 3D.
pos | position of the sphere. |
dir | direction the sphere is moving in. |
c | an endpoint of the line segment. |
d | another endpoint of the line segment. |
std::optional< float > Saga::Geometry::unitSphereTriangleCollision | ( | const glm::vec3 & | pos, |
const glm::vec3 & | dir, | ||
const glm::vec3 & | a, | ||
const glm::vec3 & | b, | ||
const glm::vec3 & | c | ||
) |
Find the intersection time t between a moving unit sphere with a triangle.
pos | position of the unit sphere. |
dir | direction of the unit sphere. |
a | triangle first point in counter-clockwise order. |
b | triangle second point in counter-clockwise order. |
c | triangle third point in counter-clockwise order. |