ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
Loading...
Searching...
No Matches
math.hpp File Reference

Geometrical, mathematical functions and related structs used to answer some simple questions about shapes situated somewhere in the world. More...

#include <glm/glm.hpp>
#include "types.hpp"

Go to the source code of this file.

Namespaces

namespace  ToyMaker
 Namespace containing all class definitions and functions related to the ToyMaker engine.

Functions

std::pair< bool, glm::vec3 > ToyMaker::computeIntersection (const Ray &ray, const Plane &plane)
 Returns a bool-vector pair, with bool indicating whether a point of intersection was found, and the vector containing the point of intersection.
std::pair< bool, glm::vec3 > ToyMaker::computeIntersection (const Ray &ray, const AreaTriangle &triangle)
 Returns a bool-vector pair, with bool indicating whether a point of intersection was found, and the vector containing the point of intersection.
std::pair< uint8_t, std::pair< glm::vec3, glm::vec3 > > ToyMaker::computeIntersections (const Ray &ray, const AxisAlignedBounds &axisAlignedBounds)
 Returns an unsigned int and vector-pair pair, with unsigned indicating whether any and how many points of intersection were found with the AABB, and the vector containing the points of intersection.
std::pair< uint8_t, std::pair< glm::vec3, glm::vec3 > > ToyMaker::computeIntersections (const Ray &ray, const ObjectBounds &objectbounds)
 Returns an unsigned int and vector pair pair, with int indicating whether and how many points of intersection were found, and the vector containing the points of intersection.
bool ToyMaker::overlaps (const glm::vec3 &point, const ObjectBounds &bounds)
 Returns a bool value indicating whether point is contained by bounds.
bool ToyMaker::overlaps (const ObjectBounds &bounds, const glm::vec3 &point)
 Returns a bool value indicating whether point is contained by bounds.
bool ToyMaker::overlaps (const Ray &ray, const ObjectBounds &bounds)
 Returns a bool value indicating whether the ray passes through the object volume.
bool ToyMaker::overlaps (const ObjectBounds &bounds, const Ray &ray)
 Returns a bool value indicating whether the ray passes through the object volume.
bool ToyMaker::overlaps (const glm::vec3 &point, const AxisAlignedBounds &bounds)
 Returns whether point is contained by bounds.
bool ToyMaker::overlaps (const AxisAlignedBounds &bounds, const glm::vec3 &point)
 Returns whether point is contained by bounds.
bool ToyMaker::overlaps (const Ray &ray, const AxisAlignedBounds &bounds)
 Returns whether ray overlaps with bounds.
bool ToyMaker::overlaps (const AxisAlignedBounds &bounds, const Ray &ray)
 Returns whether ray overlaps with bounds.
bool ToyMaker::overlaps (const AxisAlignedBounds &one, const AxisAlignedBounds &two)
 Returns whether one overlaps two.
bool ToyMaker::overlaps (const ObjectBounds &one, const ObjectBounds &two)
 Returns whether one overlaps two.
bool ToyMaker::overlaps (const AxisAlignedBounds &one, const ObjectBounds &two)
 Returns whether one overlaps two.
bool ToyMaker::overlaps (const ObjectBounds &one, const AxisAlignedBounds &two)
 Returns whether one overlaps two.
template<typename T, typename U>
std::pair< bool, SimplexToyMaker::gjkOverlaps (const T &one, const U &two)
 GJK implementation based on Casey Muratori's video lecture, which is available here.
template<typename T, typename U>
Polytope ToyMaker::buildPolytope (const T &one, const U &two, const Simplex &gjkSimplex)
 EPA implementation, used to derive contact information for intersections between convex shapes.
template<typename T, typename U>
Collision ToyMaker::checkCollision (const T &one, const U &two)
 Checks whether a pair of convex 3D shapes are colliding, returning information about the collision if they are.
bool ToyMaker::contains (const glm::vec3 &point, const ObjectBounds &bounds)
 Returns whether point is contained by bounds.
bool ToyMaker::contains (const glm::vec3 &point, const AxisAlignedBounds &bounds)
 Returns whether point is contained by bounds.
bool ToyMaker::contains (const Ray &ray, const AxisAlignedBounds &bounds)
 Returns whether ray is contained by bounds.
bool ToyMaker::contains (const Ray &ray, const ObjectBounds &bounds)
 Returns whether ray is contained by bounds.
bool ToyMaker::contains (const AxisAlignedBounds &one, const AxisAlignedBounds &two)
 Returns whether one is contained by two.
bool ToyMaker::contains (const ObjectBounds &one, const AxisAlignedBounds &two)
 Returns whether one is contained by two.
std::pair< glm::vec3, glm::vec3 > ToyMaker::deriveTangents (const glm::vec3 &vector)
 Returns a pair of tangents to an input vector.
template<typename T, typename U>
glm::vec3 ToyMaker::minkowskiDifference (const T &one, const U &two, const glm::vec3 &along)
 Closely associated with GJK; finds the Minkowski difference between two shapes situated somewhere in the world.
template<typename T, typename U>
std::tuple< glm::vec3, glm::vec3, glm::vec3 > ToyMaker::minkowskiDifferenceFull (const T &one, const U &two, const glm::vec3 &along)
 Closely associated with GJK; finds the Minkowski difference between two shapes situated somewhere in the world.

Variables

static constexpr uint8_t ToyMaker::kMaxIterations { 64 }

Detailed Description

Geometrical, mathematical functions and related structs used to answer some simple questions about shapes situated somewhere in the world.

Author
Zoheb Shujauddin (zoheb.nosp@m.2424.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Version
0.3.2
Date
2025-09-08