11 #ifndef CAFU_MATH_BOUNDING_BOX_HPP_INCLUDED
12 #define CAFU_MATH_BOUNDING_BOX_HPP_INCLUDED
14 #include "Vector3.hpp"
16 #include "Templates/Array.hpp"
62 BB.
Min =
Min.AsVectorOfFloat();
63 BB.
Max =
Max.AsVectorOfFloat();
76 BB.
Min =
Min.AsVectorOfDouble();
77 BB.
Max =
Max.AsVectorOfDouble();
142 if (BB.Min.
x>BB.Max.
x) BB.Min.
x=BB.Max.
x=(BB.Min.
x+BB.Max.
x)*0.5f;
143 if (BB.Min.
y>BB.Max.
y) BB.Min.
y=BB.Max.
y=(BB.Min.
y+BB.Max.
y)*0.5f;
144 if (BB.Min.
z>BB.Max.
z) BB.Min.
z=BB.Max.
z=(BB.Min.
z+BB.Max.
z)*0.5f;
The bounding box is on both sides of the plane (i.e. it is intersected by the plane).
Definition: BoundingBox.hpp:31
The bounding box is on the back-side of the plane.
Definition: BoundingBox.hpp:30
This class represents a plane in three-dimensional space.
Definition: Plane3.hpp:26
bool IsInited() const
Returns whether this bounding-box has been initialized with at least one point in space...
Definition: BoundingBox.cpp:71
BoundingBox3T< T > GetOverallTranslationBox(const Vector3T< T > &Start, const Vector3T< T > &End) const
Returns the overall bounding box that is defined by translating (moving) this bounding box in a linea...
Definition: BoundingBox.cpp:122
BoundingBox3T()
The default constructor creates a bounding-box that is "uninitialized", i.e.
Definition: BoundingBox.cpp:15
BoundingBox3T< double > AsBoxOfDouble() const
Casts this BoundingBox3T<T> to a BoundingBox3T<double>, so that the cast is explicitly and easy to se...
Definition: BoundingBox.hpp:70
The bounding box is on the front-side of the plane.
Definition: BoundingBox.hpp:32
SideT
Information about on which side of a plane the bounding box is.
Definition: BoundingBox.hpp:28
Vector3T< T > Max
The maximum-coordinate corner of the bounding-box.
Definition: BoundingBox.hpp:210
bool Intersects(const BoundingBox3T< T > &BB) const
Determines whether this bounding box and BB intersect.
Definition: BoundingBox.cpp:150
T y
The y-component of this vector.
Definition: Vector3.hpp:41
Vector3T< T > Min
The minimum-coordinate corner of the bounding-box.
Definition: BoundingBox.hpp:209
void operator+=(const Vector3T< T > &A)
An equivalent to Insert(A), but more readable.
Definition: BoundingBox.hpp:100
This class represents a polymorphic 3-dimensional vector.
Definition: Misc.hpp:11
ArrayT< BoundingBox3T< T > > GetSplits(const Plane3T< T > &SplitPlane, const T PlaneThickness) const
Splits the quad that is defined by this bounding box and constructs new bounding boxes from the resul...
Definition: BoundingBox.cpp:383
T GetDistance(const Plane3T< T > &P) const
Determines the distance from the plane P to the nearest point of the BB.
Definition: BoundingBox.cpp:261
BoundingBox3T< float > AsBoxOfFloat() const
Casts this BoundingBox3T<T> to a BoundingBox3T<float>, so that the cast is explicitly and easy to see...
Definition: BoundingBox.hpp:56
bool Contains(const Vector3T< T > &A) const
Determines whether this bounding box contains A.
Definition: BoundingBox.cpp:140
SideT WhatSide(const Plane3T< T > &P, const T Epsilon=0) const
Determines on what side of plane P the this BB is.
Definition: BoundingBox.cpp:174
bool TraceRay(const Vector3T< T > &RayOrigin, const Vector3T< T > &RayDir, T &Fraction) const
Traces a ray against this bounding-box, and returns whether it was hit.
Definition: BoundingBox.cpp:333
void GetCornerVertices(Vector3T< T > *Vertices) const
Explicitly returns the eight corner vertices of this bounding box.
Definition: BoundingBox.cpp:368
void Insert(const Vector3T< T > &A)
Inserts A into this boundig-box, growing it appropriately.
Definition: BoundingBox.cpp:79
bool IntersectsOrTouches(const BoundingBox3T< T > &BB) const
Determines whether this bounding box and BB intersect or touch each other.
Definition: BoundingBox.cpp:162
T z
The z-component of this vector.
Definition: Vector3.hpp:42
void InsertValid(const BoundingBox3T< T > &BB)
Like Insert(BB), but with this version it suffices when BB is only valid, i.e.
Definition: BoundingBox.cpp:111
bool IsValid() const
Determines whether a bounding-box is valid.
Definition: BoundingBox.cpp:58
T x
The x-component of this vector.
Definition: Vector3.hpp:40
Vector3T< T > GetCenter() const
Returns the center point of the BB.
Definition: BoundingBox.hpp:178
Definition: Renderer.hpp:16
This class represents an axis-aligned bounding-box ("AABB") in 3-dimensional space.
Definition: BoundingBox.hpp:23
BoundingBox3T< T > GetEpsilonBox(const T Epsilon) const
This method returns a copy of this bounding box that is slightly enlarged by Epsilon (or shrunk if Ep...
Definition: BoundingBox.hpp:130