Class aabb

Class Documentation

class acme::aabb

Axis-aligebd bounding box class container.

Axis-aligebd bounding box in 3D space and defined by a “maximum” and a “minimum” point.

Public Types

typedef std::shared_ptr<aabb const> ptr

Shared pointer to const aabb object used in AABBtree routines.

typedef std::pair<ptr, ptr> pairptr

Pair of pointers to const aabb objects used in AABBtree routines.

typedef std::vector<ptr> vecptr

Vector of pointers to const aabb objects used in AABBtree routines.

typedef std::vector<pairptr> vecpairptr

Vector of pairs of pointers to const aabb objects used in AABBtree routines.

Public Functions

aabb(const aabb&) = default

Box copy constructor.

aabb(aabb&&) = default

Box move constructor.

aabb &operator=(const aabb&) = default

Box assignment operator.

aabb &operator=(aabb&&) = default

Box move assignment operator.

aabb(void)

Box class constructor.

aabb(real min_x, real min_y, real min_z, real max_x, real max_y, real max_z, integer id = integer(0), integer ipos = integer(0))

Box class constructor.

Parameters
  • min_x – Input x value of aabb minimum point

  • min_y – Input y value of aabb minimum point

  • min_z – Input z value of aabb minimum point

  • max_x – Input x value of aabb maximum point

  • max_y – Input y value of aabb maximum point

  • max_z – Input z value of aabb maximum point

  • id – Input id value

  • ipos – Input rank value

aabb(point const &min, point const &max, integer id = integer(0), integer ipos = integer(0))

Box class constructor.

Parameters
  • min – Input aabb minimum point

  • max – Input aabb maximum point

  • id – Input aabb id value

  • ipos – Input aabb rank value

aabb(std::vector<aabb::ptr> const &boxes, integer id = integer(0), integer ipos = integer(0))

Box class constructor.

Parameters
  • boxes – Input reference to vector of boxes

  • id – Input aabb id value

  • ipos – Input aabb rank value

void clear(void)

Clear the aabb domain (set to Not-a-Number)

bool isApprox(aabb const &aabb_in, real tolerance = EPSILON) const

Check if aabb objects are (almost) equal.

Parameters
  • aabb_in – Input

  • tolerance – Tolerance

bool checkMaxMin(void) const

Check aabb max and min points.

bool updateMaxMin(void)

Update and check aabb max and min points.

point const &min(void) const

Get minimum point const reference.

point &min(void)

Get minimum point reference.

real const &min(integer i) const

Get aabb minimum i-th axis value const reference.

Parameters

i – Input i-th value

real &min(integer i)

Get aabb minimum i-th axis value reference.

Parameters

i – Input i-th value

void min(real x, real y, real z)

Set aabb minimum point.

Parameters
  • x – Input x value of aabb minimum point

  • y – Input y value of aabb minimum point

  • z – Input z value of aabb minimum point

point const &max(void) const

Get aabb maximum point const reference.

point &max(void)

Get aabb maximum point reference.

real const &max(integer i) const

Get aabb maximum i-th point axis value const reference.

Parameters

i – Input i-th value

real &max(integer i)

Get aabb maximum i-th point axis value.

Parameters

i – Input i-th value

void max(real x, real y, real z)

Set aabb maximum point.

Parameters
  • x – Input x value of aabb maximum point

  • y – Input y value of aabb maximum point

  • z – Input z value of aabb maximum point

bool intersects(aabb const &aabb_in) const

Detect if boxes collide.

Parameters

aabb_in – Input

void merged(aabb::vecptr const &boxes)

Build aabb with a vector of pointers to boxes.

Parameters

boxes – Input poiter to vector of boxes

real centerDistance(point const &point_in) const

Distance of a point to the aabb.

Parameters

point_in – Query point

real exteriorDistance(point const &point_in) const

Maximum distance of a point to the aabb.

Parameters

point_in – Query point

void clamp(point const &point0_in, point const &point1_in, point const &point2_in)

Resize the aabb as the minimum bounding aabb containing three input points.

Parameters
  • point0_in – Input point 0

  • point1_in – Input point 1

  • point2_in – Input point 2

void clamp(point const point_in[3])

Resize the aabb as the minimum bounding aabb containing three input points.

Return aabb id const reference

Parameters

point_in – Input points

integer const &id(void) const

Return aabb id reference.

integer &id(void)

Return aabb position const reference.

integer const &pos(void) const

Return aabb position reference.

integer &pos(void)
void translate(point const &vector_in)

Translate aabb by vector.

Parameters

vector_in – Input translation vector

bool isInside(point const &point_in, real tolerance = EPSILON) const

Check whether the point is inside the aabb.

Parameters
  • point_in – Query point

  • tolerance – Tolerance

bool isDegenerated(real tolerance = EPSILON) const

Check if aabb is degenerated.

Parameters

tolerance – Tolerance