QtCraft API C++ classes QML types Handbook

QcAabb Struct

Axis-aligned bounding box in world space (metres). More...

Header: #include <common/core/QcAabb.h>

Public Functions

double clipX(const QcAabb &obstacle, double delta) const
double clipY(const QcAabb &obstacle, double delta) const
double clipZ(const QcAabb &obstacle, double delta) const
QcAabb expandedTowards(const QcVec3 &delta) const
bool intersects(const QcAabb &other) const
QcAabb moved(const QcVec3 &delta) const

Public Variables

QcVec3 max
QcVec3 min

Static Public Members

const double touchTolerance

Detailed Description

Member Function Documentation

[constexpr] double QcAabb::clipX(const QcAabb &obstacle, double delta) const

Returns the movement delta along X limited so this box does not enter obstacle. Only boxes that overlap on the two other axes can block; a box that already overlaps along the axis does not. Within touchTolerance a box counts as touching: a body that ended a clipped move a rounding error inside a fence post is still stopped by it, and one that slides along a wall a rounding error inside it is not stopped by the seam to the next block.

[constexpr] double QcAabb::clipY(const QcAabb &obstacle, double delta) const

Returns the movement delta along Y limited so this box does not enter obstacle, as clipX() does along X.

[constexpr] double QcAabb::clipZ(const QcAabb &obstacle, double delta) const

Returns the movement delta along Z limited so this box does not enter obstacle, as clipX() does along X.

[constexpr] QcAabb QcAabb::expandedTowards(const QcVec3 &delta) const

Returns the box grown on each axis in the direction of delta by its length: the space it sweeps through when moved by delta.

[constexpr] bool QcAabb::intersects(const QcAabb &other) const

Returns whether the box overlaps other (touching faces do not count).

[constexpr] QcAabb QcAabb::moved(const QcVec3 &delta) const

Returns the box shifted by delta.

Member Variable Documentation

QcVec3 QcAabb::max

The corner with the largest coordinates.

QcVec3 QcAabb::min

The corner with the smallest coordinates.

const double QcAabb::touchTolerance

Overlaps up to this depth are rounding from earlier clipped moves: they count as touching.