// Copyright (c) 2023 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "dawnlibs.hpp" #include "assert/assert.hpp" #include "util/mathutils.hpp" namespace Dawn { bool_t boxCheckCollision( glm::vec2 posA, glm::vec2 minA, glm::vec2 maxA, glm::vec2 posB, glm::vec2 minB, glm::vec2 maxB, glm::vec2 velocity, glm::vec2 &normal, float_t &entryTime, float_t &exitTime, glm::vec2 &entryPoint, glm::vec2 &exitPoint ); /** * Checks if two boxes are colliding. * * @param posA Position of the first box. * @param minA Minimum point on the first box. * @param maxA Maximum point on the first box. * @param posB Position of the second box. * @param minB Minimum point on the second box. * @param maxB Maximum point on the second box. * @return True if the boxes are colliding with each other, false otherwise. */ bool_t boxIsBoxColliding( glm::vec2 posA, glm::vec2 minA, glm::vec2 maxA, glm::vec2 posB, glm::vec2 minB, glm::vec2 maxB ); /** * Checks if a given point is within the 2D Boundaries of an object. * * @param point Point to test. * @param min Minimum point on the box. * @param max Maximum point on the box. * @return True if the point is within the box. */ static bool_t boxIsPointInside(glm::vec2 point, glm::vec2 min, glm::vec2 max); }