5#ifndef DCPP_AABBOX_3D_HPP_INCLUDED 
    6#define DCPP_AABBOX_3D_HPP_INCLUDED 
    8#include <duckcpp/core/engine/irrMath.hpp> 
    9#include <duckcpp/core/engine/plane3d.hpp> 
   10#include <duckcpp/core/engine/line3d.hpp> 
   32        aabbox3d(T minx, T miny, T minz, T maxx, T maxy, T maxz): 
MinEdge(minx, miny, minz), 
MaxEdge(maxx, maxy, maxz) {}
 
  122            const T radius = 
getExtent().getLength() / 2;
 
 
  138            return e.
X * e.
Y * e.
Z;
 
 
  145            return 2*(e.
X*e.
Y + e.
X*e.
Z + e.
Y*e.
Z);
 
 
  168            edges[0].set(middle.
X + diag.
X, middle.
Y + diag.
Y, middle.
Z + diag.
Z);
 
  169            edges[1].set(middle.
X + diag.
X, middle.
Y - diag.
Y, middle.
Z + diag.
Z);
 
  170            edges[2].set(middle.
X + diag.
X, middle.
Y + diag.
Y, middle.
Z - diag.
Z);
 
  171            edges[3].set(middle.
X + diag.
X, middle.
Y - diag.
Y, middle.
Z - diag.
Z);
 
  172            edges[4].set(middle.
X - diag.
X, middle.
Y + diag.
Y, middle.
Z + diag.
Z);
 
  173            edges[5].set(middle.
X - diag.
X, middle.
Y - diag.
Y, middle.
Z + diag.
Z);
 
  174            edges[6].set(middle.
X - diag.
X, middle.
Y + diag.
Y, middle.
Z - diag.
Z);
 
  175            edges[7].set(middle.
X - diag.
X, middle.
Y - diag.
Y, middle.
Z - diag.
Z);
 
 
  282                    (
T)(
line.getLength() * 0.5));
 
 
  326            if (
plane.Normal.X > (
T)0)
 
  332            if (
plane.Normal.Y > (
T)0)
 
  338            if (
plane.Normal.Z > (
T)0)
 
  345                return ISREL3D_FRONT;
 
  348                return ISREL3D_CLIPPED;
 
 
 
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
 
aabbox3d(const vector3d< T > &init)
Constructor with only one point.
Definition aabbox3d.hpp:30
 
dcpp::nub::vector3d< T > getBottomCenter() const
Get the bottom center position of the bounding box.
Definition aabbox3d.hpp:367
 
dcpp::nub::vector3d< T > getLeftCenter() const
Get the left center position of the bounding box.
Definition aabbox3d.hpp:397
 
void addInternalBox(const aabbox3d< T > &b)
Adds another bounding box.
Definition aabbox3d.hpp:82
 
T getVolume() const
Get the volume enclosed by the box in cubed units.
Definition aabbox3d.hpp:135
 
aabbox3d< T > getInterpolated(const aabbox3d< T > &other, dcpp::float32_kt d) const
Calculates a new interpolated bounding box.
Definition aabbox3d.hpp:208
 
void reset(const vector3d< T > &initValue)
Resets the bounding box to a one-point box.
Definition aabbox3d.hpp:65
 
aabbox3d()
Default Constructor.
Definition aabbox3d.hpp:26
 
EIntersectionRelation3D classifyPlaneRelation(const plane3d< T > &plane) const
Classifies a relation with a plane.
Definition aabbox3d.hpp:321
 
bool operator==(const aabbox3d< T > &other) const
Equality operator.
Definition aabbox3d.hpp:38
 
void reset(const aabbox3d< T > &initValue)
Resets the bounding box.
Definition aabbox3d.hpp:58
 
vector3d< T > getExtent() const
Get extent of the box (maximal distance of two points in the box)
Definition aabbox3d.hpp:113
 
bool isEmpty() const
Check if the box is empty.
Definition aabbox3d.hpp:129
 
void reset(T x, T y, T z)
Resets the bounding box to a one-point box.
Definition aabbox3d.hpp:50
 
T getArea() const
Get the surface area of the box in squared units.
Definition aabbox3d.hpp:142
 
void repair()
Repairs the box.
Definition aabbox3d.hpp:180
 
bool operator!=(const aabbox3d< T > &other) const
Inequality operator.
Definition aabbox3d.hpp:42
 
bool intersectsWithBox(const aabbox3d< T > &other) const
Determines if the axis-aligned box intersects with another axis-aligned box.
Definition aabbox3d.hpp:270
 
dcpp::nub::vector3d< T > getRightCenter() const
Get the right center position of the bounding box.
Definition aabbox3d.hpp:407
 
dcpp::nub::vector3d< T > getFrontCenter() const
Get the front center position of the bounding box.
Definition aabbox3d.hpp:377
 
bool intersectsWithLine(const vector3d< T > &linemiddle, const vector3d< T > &linevect, T halflength) const
Tests if the box intersects with a line.
Definition aabbox3d.hpp:290
 
vector3d< T > MaxEdge
The far edge.
Definition aabbox3d.hpp:418
 
aabbox3d< T > intersect(const aabbox3d< T > &other) const
Returns the intersection of this box with another, if possible.
Definition aabbox3d.hpp:248
 
void addInternalPoint(T x, T y, T z)
Adds a point to the bounding box.
Definition aabbox3d.hpp:93
 
bool isPointInside(const vector3d< T > &p) const
Determines if a point is within this box.
Definition aabbox3d.hpp:219
 
bool isFullInside(const aabbox3d< T > &other) const
Check if this box is completely inside the 'other' box.
Definition aabbox3d.hpp:241
 
bool intersectsWithLine(const line3d< T > &line) const
Tests if the box intersects with a line.
Definition aabbox3d.hpp:279
 
bool isPointTotalInside(const vector3d< T > &p) const
Determines if a point is within this box and not its borders.
Definition aabbox3d.hpp:230
 
T getRadius() const
Get radius of the bounding sphere.
Definition aabbox3d.hpp:120
 
vector3d< T > getCenter() const
Get center of the bounding box.
Definition aabbox3d.hpp:106
 
void getEdges(vector3d< T > *edges) const
Stores all 8 edges of the box into an array.
Definition aabbox3d.hpp:150
 
dcpp::nub::vector3d< T > getBackCenter() const
Get the back center position of the bounding box.
Definition aabbox3d.hpp:387
 
dcpp::nub::vector3d< T > getTopCenter() const
Get the top center position of the bounding box.
Definition aabbox3d.hpp:357
 
aabbox3d(const vector3d< T > &min, const vector3d< T > &max)
Constructor with min edge and max edge.
Definition aabbox3d.hpp:28
 
aabbox3d(T minx, T miny, T minz, T maxx, T maxy, T maxz)
Constructor with min edge and max edge as single values, not vectors.
Definition aabbox3d.hpp:32
 
vector3d< T > MinEdge
The near edge.
Definition aabbox3d.hpp:415
 
void addInternalPoint(const vector3d< T > &p)
Adds a point to the bounding box.
Definition aabbox3d.hpp:74
 
3d vector template class with lots of operators and methods.
Definition vector3d.hpp:32
 
T X
X coordinate of the vector.
Definition vector3d.hpp:459
 
T Y
Y coordinate of the vector.
Definition vector3d.hpp:462
 
T Z
Z coordinate of the vector.
Definition vector3d.hpp:465
 
const T & min_(const T &a, const T &b)
returns minimum of two values. Own implementation to get rid of the STL (VS6 problems)
Definition irrMath.hpp:121
 
EIntersectionRelation3D
Enumeration for intersection relations of 3d objects.
Definition plane3d.hpp:18
 
const T & max_(const T &a, const T &b)
returns maximum of two values. Own implementation to get rid of the STL (VS6 problems)
Definition irrMath.hpp:135
 
As of Duckcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
 
float float32_kt
32 bit floating point variable.
Definition irrTypes.hpp:108