123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #pragma once
- #include <Mathematics/Vector.h>
- namespace WwiseGTE
- {
- template <int N, typename Real>
- class AlignedBox
- {
- public:
-
-
- AlignedBox()
- {
- for (int i = 0; i < N; ++i)
- {
- min[i] = (Real)-1;
- max[i] = (Real)+1;
- }
- }
-
- AlignedBox(Vector<N, Real> const& inMin, Vector<N, Real> const& inMax)
- {
- for (int i = 0; i < N; ++i)
- {
- min[i] = inMin[i];
- max[i] = inMax[i];
- }
- }
-
-
-
-
- void GetCenteredForm(Vector<N, Real>& center, Vector<N, Real>& extent) const
- {
- center = (max + min) * (Real)0.5;
- extent = (max - min) * (Real)0.5;
- }
-
- Vector<N, Real> min, max;
- public:
-
- bool operator==(AlignedBox const& box) const
- {
- return min == box.min && max == box.max;
- }
- bool operator!=(AlignedBox const& box) const
- {
- return !operator==(box);
- }
- bool operator< (AlignedBox const& box) const
- {
- if (min < box.min)
- {
- return true;
- }
- if (min > box.min)
- {
- return false;
- }
- return max < box.max;
- }
- bool operator<=(AlignedBox const& box) const
- {
- return !box.operator<(*this);
- }
- bool operator> (AlignedBox const& box) const
- {
- return box.operator<(*this);
- }
- bool operator>=(AlignedBox const& box) const
- {
- return !operator<(box);
- }
- };
-
- template <typename Real>
- using AlignedBox2 = AlignedBox<2, Real>;
- template <typename Real>
- using AlignedBox3 = AlignedBox<3, Real>;
- }
|