18 #include <glm/glm.hpp>
30 AACube(
const AABox& other);
31 AACube(
const Extents& other);
32 AACube(
const glm::vec3& corner,
float size);
36 void setBox(
const glm::vec3& corner,
float scale);
37 glm::vec3 getFarthestVertex(
const glm::vec3& normal)
const;
38 glm::vec3 getNearestVertex(
const glm::vec3& normal)
const;
39 void scale(
float scale);
40 const glm::vec3& getCorner()
const {
return _corner; }
41 float getScale()
const {
return _scale; }
42 glm::vec3 getDimensions()
const {
return glm::vec3(_scale,_scale,_scale); }
43 float getLargestDimension()
const {
return _scale; }
45 glm::vec3 calcCenter()
const;
46 glm::vec3 calcTopFarLeft()
const;
47 glm::vec3 getVertex(BoxVertex vertex)
const;
49 const glm::vec3& getMinimumPoint()
const {
return _corner; }
50 glm::vec3 getMaximumPoint()
const {
return calcTopFarLeft(); }
52 bool contains(
const glm::vec3& point)
const;
53 bool contains(
const AACube& otherCube)
const;
54 bool touches(
const AACube& otherCube)
const;
55 bool contains(
const AABox& otherBox)
const;
56 bool touches(
const AABox& otherBox)
const;
57 bool expandedContains(
const glm::vec3& point,
float expansion)
const;
58 bool expandedIntersectsSegment(
const glm::vec3& start,
const glm::vec3& end,
float expansion)
const;
59 bool findRayIntersection(
const glm::vec3& origin,
const glm::vec3& direction,
const glm::vec3& invDirection,
60 float& distance, BoxFace& face, glm::vec3& surfaceNormal)
const;
61 bool findParabolaIntersection(
const glm::vec3& origin,
const glm::vec3& velocity,
const glm::vec3& acceleration,
62 float& parabolicDistance, BoxFace& face, glm::vec3& surfaceNormal)
const;
63 bool touchesSphere(
const glm::vec3& center,
float radius)
const;
64 bool findSpherePenetration(
const glm::vec3& center,
float radius, glm::vec3& penetration)
const;
65 bool findCapsulePenetration(
const glm::vec3& start,
const glm::vec3& end,
float radius, glm::vec3& penetration)
const;
67 AABox clamp(
const glm::vec3& min,
const glm::vec3& max)
const;
68 AABox clamp(
float min,
float max)
const;
70 AACube& operator += (
const glm::vec3& point);
72 bool containsNaN()
const;
75 glm::vec3 getClosestPointOnFace(
const glm::vec3& point, BoxFace face)
const;
76 glm::vec3 getClosestPointOnFace(
const glm::vec4& origin,
const glm::vec4& direction, BoxFace face)
const;
77 glm::vec4 getPlane(BoxFace face)
const;
79 static BoxFace getOppositeFace(BoxFace face);
85 inline bool operator==(
const AACube& a,
const AACube& b) {
86 return a.getCorner() == b.getCorner() && a.getScale() == b.getScale();
89 inline bool operator!=(
const AACube& a,
const AACube& b) {
90 return a.getCorner() != b.getCorner() || a.getScale() != b.getScale();
93 inline QDebug operator<<(QDebug debug,
const AACube& cube) {
95 << cube.getCorner().x <<
"," << cube.getCorner().y <<
"," << cube.getCorner().z <<
" ) to ("
96 << cube.calcTopFarLeft().x <<
"," << cube.calcTopFarLeft().y <<
"," << cube.calcTopFarLeft().z <<
") size: ("
97 << cube.getDimensions().x <<
"," << cube.getDimensions().y <<
"," << cube.getDimensions().z <<
")"