1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #pragma once
- #include <Mathematics/Vector.h>
- namespace WwiseGTE
- {
- template <int N, typename Real>
- class Ray
- {
- public:
-
-
- Ray()
- {
- origin.MakeZero();
- direction.MakeUnit(0);
- }
- Ray(Vector<N, Real> const& inOrigin, Vector<N, Real> const& inDirection)
- :
- origin(inOrigin),
- direction(inDirection)
- {
- }
-
- Vector<N, Real> origin, direction;
- public:
-
- bool operator==(Ray const& ray) const
- {
- return origin == ray.origin && direction == ray.direction;
- }
- bool operator!=(Ray const& ray) const
- {
- return !operator==(ray);
- }
- bool operator< (Ray const& ray) const
- {
- if (origin < ray.origin)
- {
- return true;
- }
- if (origin > ray.origin)
- {
- return false;
- }
- return direction < ray.direction;
- }
- bool operator<=(Ray const& ray) const
- {
- return !ray.operator<(*this);
- }
- bool operator> (Ray const& ray) const
- {
- return ray.operator<(*this);
- }
- bool operator>=(Ray const& ray) const
- {
- return !operator<(ray);
- }
- };
-
- template <typename Real>
- using Ray2 = Ray<2, Real>;
- template <typename Real>
- using Ray3 = Ray<3, Real>;
- }
|