Dawn/archive/physics/3d/AABB3D.hpp

30 lines
714 B
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
namespace Dawn {
struct AABB3D {
glm::vec3 min;
glm::vec3 max;
};
/**
* Checks whether two 3D AABB are intersecting or not.
*
* @param cube1 First cube.
* @param cube2 Second cube.
* @return True if the two cubes are intersecting, otherwise false.
*/
bool_t aabb3dIntersect(struct AABB3D cube1, struct AABB3D cube2);
bool_t aabb3dSweep(
glm::vec3 pos1, glm::vec3 size1, glm::vec3 vel1,
glm::vec3 pos2, glm::vec3 size2, glm::vec3 vel2,
float_t& fraction
);
}