Ocular Engine
BoundsOBB.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_MATH_BOUNDS_OBB__H__
19 #define __H__OCULAR_MATH_BOUNDS_OBB__H__
20 
21 #include "Math/Bounds/Bounds.hpp"
22 #include "Math/Vector3.hpp"
23 
24 //------------------------------------------------------------------------------------------
25 
30 namespace Ocular
31 {
36  namespace Math
37  {
38  class Ray;
39  class BoundsSphere;
40  class BoundsAABB;
41  class Plane;
42 
56  class BoundsOBB : public Bounds
57  {
58  public:
59 
60  BoundsOBB(Vector3f const& center, Vector3f const& extents, Vector3f const& xDir, Vector3f const& yDir, Vector3f const& zDir);
61  BoundsOBB();
62  ~BoundsOBB();
63 
67  Vector3f const& getCenter() const;
68 
72  void setCenter(Vector3f const& center);
73 
78  Vector3f const& getExtents() const;
79 
83  void setExtents(Vector3f const& extents);
84 
88  Vector3f const& getDirectionX() const;
89 
93  void setDirectionX(Vector3f const& dirX);
94 
98  Vector3f const& getDirectionY() const;
99 
103  void setDirectionY(Vector3f const& dirY);
104 
108  Vector3f const& getDirectionZ() const;
109 
113  void setDirectionZ(Vector3f const& dirZ);
114 
115  //------------------------------------------------------------------------------
116  // Intersection and Containment Testing
117  //------------------------------------------------------------------------------
118 
125  bool intersects(Ray const& ray) const;
126 
133  bool intersects(BoundsSphere const& bounds) const;
134 
141  bool intersects(BoundsAABB const& bounds) const;
142 
143 
150  bool intersects(BoundsOBB const& bounds) const;
151 
175  bool intersects(Plane const& plane, IntersectionType* result = nullptr) const;
176 
177  protected:
178 
179  private:
180 
181  Vector3f m_Center;
182  Vector3f m_Extents;
183  Vector3f m_DirectionX;
184  Vector3f m_DirectionY;
185  Vector3f m_DirectionZ;
186  };
187  }
191 }
196 //------------------------------------------------------------------------------------------
197 
198 #endif
bool intersects(Ray const &ray) const
Definition: BoundsOBB.cpp:107
Vector3f const & getExtents() const
Definition: BoundsOBB.cpp:63
Vector3f const & getDirectionZ() const
Definition: BoundsOBB.cpp:93
Definition: Ray.hpp:47
Vector3f const & getCenter() const
Definition: BoundsOBB.cpp:53
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Definition: BoundsOBB.hpp:56
void setDirectionZ(Vector3f const &dirZ)
Definition: BoundsOBB.cpp:98
Vector3f const & getDirectionY() const
Definition: BoundsOBB.cpp:83
void setDirectionY(Vector3f const &dirY)
Definition: BoundsOBB.cpp:88
Definition: Plane.hpp:50
void setExtents(Vector3f const &extents)
Definition: BoundsOBB.cpp:68
void setCenter(Vector3f const &center)
Definition: BoundsOBB.cpp:58
Vector3f const & getDirectionX() const
Definition: BoundsOBB.cpp:73
Definition: Bounds.hpp:45
Definition: BoundsAABB.hpp:63
Definition: BoundsSphere.hpp:52
void setDirectionX(Vector3f const &dirX)
Definition: BoundsOBB.cpp:78