Documentation

AxisAlignedBB
in package

Table of Contents

$maxX  : float
$maxY  : float
$maxZ  : float
$minX  : float
$minY  : float
$minZ  : float
__construct()  : mixed
__toString()  : mixed
addCoord()  : AxisAlignedBB
Returns a new AxisAlignedBB extended by the specified X, Y and Z.
calculateIntercept()  : RayTraceResult|null
Performs a ray-trace and calculates the point on the AABB's edge nearest the start position that the ray-trace collided with. Returns a RayTraceResult with colliding vector closest to the start position.
calculateXOffset()  : float
calculateYOffset()  : float
calculateZOffset()  : float
contract()  : $this
Insets the bounds of this AxisAlignedBB by the specified X, Y and Z.
contractedCopy()  : AxisAlignedBB
Returns a contracted clone of this AxisAlignedBB.
expand()  : $this
Outsets the bounds of this AxisAlignedBB by the specified X, Y and Z.
expandedCopy()  : AxisAlignedBB
Returns an expanded clone of this AxisAlignedBB.
extend()  : $this
Extends the AABB in the given direction.
extendedCopy()  : AxisAlignedBB
Returns an extended clone of this bounding box.
getAverageEdgeLength()  : float
Returns the mean average of the AABB's X, Y and Z lengths.
getVolume()  : float
Returns the interior volume of the AABB.
getXLength()  : float
getYLength()  : float
getZLength()  : float
intersectsWith()  : bool
Returns whether any part of the specified AABB is inside (intersects with) this one.
isCube()  : bool
isVectorInside()  : bool
Returns whether the specified vector is within the bounds of this AABB on all axes.
isVectorInXY()  : bool
Returns whether the specified vector is within the X and Y bounds of this AABB.
isVectorInXZ()  : bool
Returns whether the specified vector is within the X and Z bounds of this AABB.
isVectorInYZ()  : bool
Returns whether the specified vector is within the Y and Z bounds of this AABB.
offset()  : $this
Shifts this AxisAlignedBB by the given X, Y and Z.
offsetCopy()  : AxisAlignedBB
Returns an offset clone of this AxisAlignedBB.
one()  : AxisAlignedBB
Returns a 1x1x1 bounding box starting at grid position 0,0,0.
squash()  : $this
Reduces the dimension of the AABB on the given axis. Inverse of stretch().
squashedCopy()  : AxisAlignedBB
Returns a squashed copy of this bounding box.
stretch()  : $this
Increases the dimension of the AABB along the given axis.
stretchedCopy()  : AxisAlignedBB
Returns a stretched copy of this bounding box.
trim()  : $this
Inverse of extend().
trimmedCopy()  : AxisAlignedBB
Returns a trimmed clone of this bounding box.

Properties

Methods

__construct()

public __construct(float $minX, float $minY, float $minZ, float $maxX, float $maxY, float $maxZ) : mixed
Parameters
$minX : float
$minY : float
$minZ : float
$maxX : float
$maxY : float
$maxZ : float
Return values
mixed

__toString()

public __toString() : mixed
Return values
mixed

addCoord()

Returns a new AxisAlignedBB extended by the specified X, Y and Z.

public addCoord(float $x, float $y, float $z) : AxisAlignedBB

If each of X, Y and Z are positive, the relevant max bound will be increased. If negative, the relevant min bound will be decreased.

Parameters
$x : float
$y : float
$z : float
Return values
AxisAlignedBB

calculateIntercept()

Performs a ray-trace and calculates the point on the AABB's edge nearest the start position that the ray-trace collided with. Returns a RayTraceResult with colliding vector closest to the start position.

public calculateIntercept(Vector3 $pos1, Vector3 $pos2) : RayTraceResult|null

Returns null if no colliding point was found.

Parameters
$pos1 : Vector3
$pos2 : Vector3
Return values
RayTraceResult|null

contract()

Insets the bounds of this AxisAlignedBB by the specified X, Y and Z.

public contract(float $x, float $y, float $z) : $this
Parameters
$x : float
$y : float
$z : float
Return values
$this

contractedCopy()

Returns a contracted clone of this AxisAlignedBB.

public contractedCopy(float $x, float $y, float $z) : AxisAlignedBB
Parameters
$x : float
$y : float
$z : float
Return values
AxisAlignedBB

expand()

Outsets the bounds of this AxisAlignedBB by the specified X, Y and Z.

public expand(float $x, float $y, float $z) : $this
Parameters
$x : float
$y : float
$z : float
Return values
$this

expandedCopy()

Returns an expanded clone of this AxisAlignedBB.

public expandedCopy(float $x, float $y, float $z) : AxisAlignedBB
Parameters
$x : float
$y : float
$z : float
Return values
AxisAlignedBB

extend()

Extends the AABB in the given direction.

public extend(int $face, float $distance) : $this
Parameters
$face : int
$distance : float

Negative values pull the face in, positive values push out.

Tags
throws
InvalidArgumentException
Return values
$this

getAverageEdgeLength()

Returns the mean average of the AABB's X, Y and Z lengths.

public getAverageEdgeLength() : float
Return values
float

getVolume()

Returns the interior volume of the AABB.

public getVolume() : float
Return values
float

getXLength()

public getXLength() : float
Return values
float

getYLength()

public getYLength() : float
Return values
float

getZLength()

public getZLength() : float
Return values
float

intersectsWith()

Returns whether any part of the specified AABB is inside (intersects with) this one.

public intersectsWith(AxisAlignedBB $bb[, float $epsilon = 1.0E-5 ]) : bool
Parameters
$bb : AxisAlignedBB
$epsilon : float = 1.0E-5
Return values
bool

isCube()

public isCube([float $epsilon = 1.0E-6 ]) : bool
Parameters
$epsilon : float = 1.0E-6
Return values
bool

isVectorInside()

Returns whether the specified vector is within the bounds of this AABB on all axes.

public isVectorInside(Vector3 $vector) : bool
Parameters
$vector : Vector3
Return values
bool

isVectorInXY()

Returns whether the specified vector is within the X and Y bounds of this AABB.

public isVectorInXY(Vector3 $vector) : bool
Parameters
$vector : Vector3
Return values
bool

isVectorInXZ()

Returns whether the specified vector is within the X and Z bounds of this AABB.

public isVectorInXZ(Vector3 $vector) : bool
Parameters
$vector : Vector3
Return values
bool

isVectorInYZ()

Returns whether the specified vector is within the Y and Z bounds of this AABB.

public isVectorInYZ(Vector3 $vector) : bool
Parameters
$vector : Vector3
Return values
bool

offset()

Shifts this AxisAlignedBB by the given X, Y and Z.

public offset(float $x, float $y, float $z) : $this
Parameters
$x : float
$y : float
$z : float
Return values
$this

offsetCopy()

Returns an offset clone of this AxisAlignedBB.

public offsetCopy(float $x, float $y, float $z) : AxisAlignedBB
Parameters
$x : float
$y : float
$z : float
Return values
AxisAlignedBB

squash()

Reduces the dimension of the AABB on the given axis. Inverse of stretch().

public squash(int $axis, float $distance) : $this
Parameters
$axis : int
$distance : float
Tags
see
AxisAlignedBB::stretch()
throws
InvalidArgumentException
Return values
$this

stretch()

Increases the dimension of the AABB along the given axis.

public stretch(int $axis, float $distance) : $this
Parameters
$axis : int

one of the Axis::* constants

$distance : float

Negative values reduce width, positive values increase width.

Tags
throws
InvalidArgumentException
Return values
$this

trim()

Inverse of extend().

public trim(int $face, float $distance) : $this
Parameters
$face : int
$distance : float

Positive values pull the face in, negative values push out.

Tags
see
AxisAlignedBB::extend()
throws
InvalidArgumentException
Return values
$this

Search results