40 template<
typename T>
struct Box3;
66 template<
typename T>
struct Box3
70 #if (MTOOLS_TGX_EXTENSIONS)
71 #include <mtools/extensions/tgx/tgx_ext_Box3.inl>
95 constexpr Box3(
const T minx,
const T maxx,
const T miny,
const T maxy,
const T minz,
const T maxz) :
minX(minx),
maxX(maxx),
minY(miny),
maxY(maxy),
minZ(minz),
maxZ(maxz)
162 if (std::is_integral<T>::value)
182 if (std::is_integral<T>::value)
202 if (std::is_integral<T>::value)
352 (*this) = ((*this) & B);
422 (*this) = (*this) | v;
488 const T u =
lx() / 10;
491 const T v =
ly() / 10;
494 const T w =
lz() / 10;
507 const T u =
lx() / 8;
510 const T v =
ly() / 8;
513 const T w =
lz() / 8;
526 const T u =
lx() / 10;
539 const T u =
lx() / 10;
552 const T v =
ly() / 10;
565 const T v =
ly() / 10;
578 const T v =
lz() / 10;
591 const T v =
lz() / 10;
Utility/miscellaneous functions used throughout the library.
TGX_INLINE T min(const T &a, const T &b)
Don't know why but faster than fminf() for floats.
Definition: Misc.h:180
TGX_INLINE T max(const T &a, const T &b)
Don't know why but much faster than fmaxf() for floats.
Definition: Misc.h:184
Generic 3D Box [specializations iBox3, fBox3, dBox3].
Definition: Box3.h:67
Box3< T > operator|(const Vec3< T > &v) const
Return the smallest box containing this box and point v.
Definition: Box3.h:395
void left()
Move the box to the left by 1/10th of its width.
Definition: Box3.h:524
void operator&=(const Box3< T > &B)
Intersect this box with box B.
Definition: Box3.h:350
T minX
min horizontal (X) value (inclusive)
Definition: Box3.h:76
T maxY
max vertical (Y) value (inclusive)
Definition: Box3.h:79
T ly() const
Return the box height.
Definition: Box3.h:180
void zoomOut()
Zoom outside the box (ie increase its size by 1/10th).
Definition: Box3.h:486
bool operator>=(const Box3< T > &B) const
Return true if B is included in this box.
Definition: Box3.h:273
constexpr Box3(const T minx, const T maxx, const T miny, const T maxy, const T minz, const T maxz)
Constructor with explicit dimensions.
Definition: Box3.h:95
Vec3< T > center() const
Return the position of the box center as a 3 dimensional vector.
Definition: Box3.h:475
bool operator<=(const Box3< T > &B) const
Return true if this box is included in B.
Definition: Box3.h:288
bool equals(const Box3< T > &B) const
Return true if the boxes are equal.
Definition: Box3.h:220
void zoomIn()
Zoom inside the box (ie decrease its size by 1/8th).
Definition: Box3.h:505
constexpr Box3(const Vec3< T > &v)
Construct a box representing a single point.
Definition: Box3.h:103
void operator+=(const Vec3< T > &V)
Translate this box by a given vector.
Definition: Box3.h:429
T minY
min vertical (Y) value (inclusive)
Definition: Box3.h:78
void operator|=(const Vec3< T > &v)
Enlarge this box in order to contain point v.
Definition: Box3.h:420
T maxZ
max depth (Z) value (inclusive)
Definition: Box3.h:81
constexpr Box3()
default constructor: the box content is undefined.
Definition: Box3.h:87
bool contains(const Box3< T > &B) const
Return true if B is included in this box.
Definition: Box3.h:256
Box3(const Box3< T > &B)=default
default copy constructor.
bool operator>(const Box3< T > &B) const
Return true if B is strictly included in this box (i.e.
Definition: Box3.h:301
constexpr bool isEmpty() const
Return true if the box is empty.
Definition: Box3.h:136
Box3< T > operator+(const Vec3< T > &V) const
Return this box translated by v.
Definition: Box3.h:443
bool contains(const Vec3< T > &v) const
Return true if the box contains the point v.
Definition: Box3.h:243
void right()
Move the box to the right by 1/10th of its width.
Definition: Box3.h:537
T minZ
min depth (Z) value (inclusive)
Definition: Box3.h:80
void front()
Move the box front by 1/10th of its height.
Definition: Box3.h:576
bool operator<(const Box3< T > &B) const
Return true if this box is strictly included inside B (i.e.
Definition: Box3.h:314
bool operator==(const Box3< T > &B) const
Return true if the boxes are equal.
Definition: Box3.h:234
Box3< T > operator|(const Box3< T > &B) const
Return the smallest box containing both this box and B.
Definition: Box3.h:359
T lx() const
Return the box width.
Definition: Box3.h:160
void empty()
Make the box empty.
Definition: Box3.h:142
T lz() const
Return the box depth.
Definition: Box3.h:200
void operator-=(const Vec3< T > &V)
Translate the box by a given vector (substracted)
Definition: Box3.h:452
T maxX
max horizontal (X) value (inclusive)
Definition: Box3.h:77
Box3< T > operator-(const Vec3< T > &V) const
Return this box translated by v (substracted).
Definition: Box3.h:466
Box3< T > operator&(const Box3< T > &B) const
Return the intersection of this box and B.
Definition: Box3.h:323
void back()
Move the box back by 1/10th of its height.
Definition: Box3.h:589
void operator|=(const Box3< T > &B)
Enlarge this box in order to contain B.
Definition: Box3.h:386
void up()
Move the box up by 1/10th of its height.
Definition: Box3.h:550
void down()
Move the box down by 1/10th of its height.
Definition: Box3.h:563
Box3< T > & operator=(const Box3< T > &B)=default
default assignement operator.
T x
'x' coordinate (first dimension)
Definition: Vec2.h:72
T y
'y' coordinate (second dimension)
Definition: Vec2.h:73
Generic 3D vector [specializations iVec3, fVec3, dVec3].
Definition: Vec3.h:70
T z
'z' coordinate (third dimension)
Definition: Vec3.h:83