1 #ifndef AXISALIGNEDBOXTEMPLATE_HPP
2 #define AXISALIGNEDBOXTEMPLATE_HPP
4 #include "blub/serialization/access.hpp"
5 #include "blub/serialization/nameValuePair.hpp"
7 #include "blub/core/globals.hpp"
14 template <
typename vector3Type>
32 bool operator == (
const t_thisClass& other)
const
34 return other.getMinimum() == m_min && other.getMaximum() == m_max;
37 void setMinimumAndMaximum(
const vector3Type& min,
const vector3Type& max)
43 const vector3Type& getMinimum(
void)
const
48 const vector3Type& getMaximum(
void)
const
53 vector3Type getSize(
void)
const
58 vector3Type getCenter(
void)
const
60 return (m_min + m_max) / 2;
63 bool isInside(
const vector3Type& in)
const
65 return in >= m_min && in <= m_max;
68 bool isInside(
const t_thisClass& in)
const
70 return in.isInside(m_min) && in.isInside(m_max);
73 void extend(
const t_thisClass& ext)
79 extend(ext.getMinimum());
80 extend(ext.getMaximum());
82 void extend(
const vector3Type& ext)
86 setMinimumAndMaximum(m_min.getMinimum(ext), m_max.getMaximum(ext));
89 setMinimumAndMaximum(ext, ext);
94 return m_max >= m_min;
97 typename vector3Type::t_valueType getVolume()
99 const vector3Type size(getSize());
100 return size.x * size.y * size.z;
105 BLUB_SERIALIZATION_ACCESS
107 template <
class formatType>
108 void serialize(formatType & readWrite,
const uint32& version)
112 readWrite & serialization::nameValuePair::create(
"min", m_min);
113 readWrite & serialization::nameValuePair::create(
"max", m_max);
127 #endif // AXISALIGNEDBOXTEMPLATE_HPP
Definition: axisAlignedBoxTemplate.hpp:15
Definition: deadlineTimer.hpp:10