Ocular Engine
Ray.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_MATH_RAY__H__
19 #define __H__OCULAR_MATH_RAY__H__
20 
21 #include "Math/Vector3.hpp"
22 
23 //------------------------------------------------------------------------------------------
24 
29 namespace Ocular
30 {
35  namespace Math
36  {
37  class BoundsSphere;
38  class BoundsAABB;
39  class BoundsOBB;
40  class Plane;
41 
47  class Ray
48  {
49  public:
50 
57  Ray(Vector3f const& origin, Vector3f const& direction);
58 
59  Ray();
60  ~Ray();
61 
65  void setOrigin(Vector3f const& origin);
66 
70  void setDirection(Vector3f const& direction);
71 
75  Vector3f const& getOrigin() const;
76 
80  Vector3f const& getDirection() const;
81 
85  Vector3f getPointAlong(float distance) const;
86 
87  //------------------------------------------------------------------------------
88  // Intersection and Containment Testing
89  //------------------------------------------------------------------------------
90 
97  bool intersects(Point3f const& point) const;
98 
105  bool intersects(Ray const& other) const;
106 
116  bool intersects(Ray const& other, Point3f& point, float& distance) const;
117 
124  bool intersects(BoundsSphere const& bounds) const;
125 
139  bool intersects(BoundsSphere const& bounds, Point3f& point, float& distance) const;
140 
147  bool intersects(BoundsAABB const& bounds) const;
148 
162  bool intersects(BoundsAABB const& bounds, Point3f& point, float& distance) const;
163 
170  bool intersects(BoundsOBB const& bounds) const;
171 
185  bool intersects(BoundsOBB const& bounds, Point3f& point, float& distance) const;
186 
196  bool intersects(Plane const& plane) const;
197 
210  bool intersects(Plane const& plane, Vector3f& point, float& distance) const;
211 
212  protected:
213 
214  private:
215 
216  Vector3f m_Origin;
217  Vector3f m_Direction;
218 
219  };
220  }
224 }
229 //------------------------------------------------------------------------------------------
230 
231 #endif
bool intersects(Point3f const &point) const
Definition: Ray.cpp:87
Vector3f const & getOrigin() const
Definition: Ray.cpp:63
Vector3f const & getDirection() const
Definition: Ray.cpp:68
Definition: Ray.hpp:47
Vector3f getPointAlong(float distance) const
Definition: Ray.cpp:73
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Definition: BoundsOBB.hpp:56
void setDirection(Vector3f const &direction)
Definition: Ray.cpp:58
void setOrigin(Vector3f const &origin)
Definition: Ray.cpp:53
Definition: Plane.hpp:50
Definition: BoundsAABB.hpp:63
Definition: BoundsSphere.hpp:52