PocketMine-MP 5.14.2 git-50e2c469a547a16a23b2dc691e70a51d34e29395
pocketmine\math\AxisAlignedBB Class Reference
+ Collaboration diagram for pocketmine\math\AxisAlignedBB:

Public Member Functions

 __construct (float $minX, float $minY, float $minZ, float $maxX, float $maxY, float $maxZ)
 
 __toString ()
 
 addCoord (float $x, float $y, float $z)
 
 calculateIntercept (Vector3 $pos1, Vector3 $pos2)
 
 calculateXOffset (AxisAlignedBB $bb, float $x)
 
 calculateYOffset (AxisAlignedBB $bb, float $y)
 
 calculateZOffset (AxisAlignedBB $bb, float $z)
 
 contract (float $x, float $y, float $z)
 
 contractedCopy (float $x, float $y, float $z)
 
 expand (float $x, float $y, float $z)
 
 expandedCopy (float $x, float $y, float $z)
 
 extend (int $face, float $distance)
 
 extendedCopy (int $face, float $distance)
 
 getAverageEdgeLength ()
 
 getVolume ()
 
 getXLength ()
 
 getYLength ()
 
 getZLength ()
 
 intersectsWith (AxisAlignedBB $bb, float $epsilon=0.00001)
 
 isCube (float $epsilon=0.000001)
 
 isVectorInside (Vector3 $vector)
 
 isVectorInXY (Vector3 $vector)
 
 isVectorInXZ (Vector3 $vector)
 
 isVectorInYZ (Vector3 $vector)
 
 offset (float $x, float $y, float $z)
 
 offsetCopy (float $x, float $y, float $z)
 
 offsetTowards (int $face, float $distance)
 
 offsetTowardsCopy (int $face, float $distance)
 
 squash (int $axis, float $distance)
 
 squashedCopy (int $axis, float $distance)
 
 stretch (int $axis, float $distance)
 
 stretchedCopy (int $axis, float $distance)
 
 trim (int $face, float $distance)
 
 trimmedCopy (int $face, float $distance)
 

Static Public Member Functions

static one ()
 

Public Attributes

float $maxX
 
float $maxY
 
float $maxZ
 
float $minX
 
float $minY
 
float $minZ
 

Detailed Description

Definition at line 29 of file AxisAlignedBB.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\math\AxisAlignedBB::__construct ( float  $minX,
float  $minY,
float  $minZ,
float  $maxX,
float  $maxY,
float  $maxZ 
)

Definition at line 38 of file AxisAlignedBB.php.

Member Function Documentation

◆ __toString()

pocketmine\math\AxisAlignedBB::__toString ( )

Definition at line 492 of file AxisAlignedBB.php.

◆ addCoord()

pocketmine\math\AxisAlignedBB::addCoord ( float  $x,
float  $y,
float  $z 
)

Returns a new AxisAlignedBB extended by the specified X, Y and Z. 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.

Definition at line 61 of file AxisAlignedBB.php.

◆ calculateIntercept()

pocketmine\math\AxisAlignedBB::calculateIntercept ( Vector3  $pos1,
Vector3  $pos2 
)

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. Returns null if no colliding point was found.

Definition at line 434 of file AxisAlignedBB.php.

◆ calculateXOffset()

pocketmine\math\AxisAlignedBB::calculateXOffset ( AxisAlignedBB  $bb,
float  $x 
)

Definition at line 290 of file AxisAlignedBB.php.

◆ calculateYOffset()

pocketmine\math\AxisAlignedBB::calculateYOffset ( AxisAlignedBB  $bb,
float  $y 
)

Definition at line 312 of file AxisAlignedBB.php.

◆ calculateZOffset()

pocketmine\math\AxisAlignedBB::calculateZOffset ( AxisAlignedBB  $bb,
float  $z 
)

Definition at line 334 of file AxisAlignedBB.php.

◆ contract()

pocketmine\math\AxisAlignedBB::contract ( float  $x,
float  $y,
float  $z 
)

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

Returns
$this

Definition at line 161 of file AxisAlignedBB.php.

◆ contractedCopy()

pocketmine\math\AxisAlignedBB::contractedCopy ( float  $x,
float  $y,
float  $z 
)

Returns a contracted clone of this AxisAlignedBB.

Definition at line 175 of file AxisAlignedBB.php.

◆ expand()

pocketmine\math\AxisAlignedBB::expand ( float  $x,
float  $y,
float  $z 
)

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

Returns
$this

Definition at line 95 of file AxisAlignedBB.php.

◆ expandedCopy()

pocketmine\math\AxisAlignedBB::expandedCopy ( float  $x,
float  $y,
float  $z 
)

Returns an expanded clone of this AxisAlignedBB.

Definition at line 109 of file AxisAlignedBB.php.

Referenced by pocketmine\world\World\getCollisionBoxes().

+ Here is the caller graph for this function:

◆ extend()

pocketmine\math\AxisAlignedBB::extend ( int  $face,
float  $distance 
)

Extends the AABB in the given direction.

Parameters
float$distanceNegative values pull the face in, positive values push out.
Returns
$this
Exceptions

InvalidArgumentException

Definition at line 187 of file AxisAlignedBB.php.

◆ extendedCopy()

pocketmine\math\AxisAlignedBB::extendedCopy ( int  $face,
float  $distance 
)

Returns an extended clone of this bounding box.

See also
AxisAlignedBB::extend()
Exceptions

InvalidArgumentException

Definition at line 207 of file AxisAlignedBB.php.

◆ getAverageEdgeLength()

pocketmine\math\AxisAlignedBB::getAverageEdgeLength ( )

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

Definition at line 386 of file AxisAlignedBB.php.

◆ getVolume()

pocketmine\math\AxisAlignedBB::getVolume ( )

Returns the interior volume of the AABB.

Definition at line 404 of file AxisAlignedBB.php.

◆ getXLength()

pocketmine\math\AxisAlignedBB::getXLength ( )

Definition at line 390 of file AxisAlignedBB.php.

◆ getYLength()

pocketmine\math\AxisAlignedBB::getYLength ( )

Definition at line 392 of file AxisAlignedBB.php.

◆ getZLength()

pocketmine\math\AxisAlignedBB::getZLength ( )

Definition at line 394 of file AxisAlignedBB.php.

◆ intersectsWith()

pocketmine\math\AxisAlignedBB::intersectsWith ( AxisAlignedBB  $bb,
float  $epsilon = 0.00001 
)

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

Definition at line 359 of file AxisAlignedBB.php.

Referenced by pocketmine\block\Block\collidesWithBB().

+ Here is the caller graph for this function:

◆ isCube()

pocketmine\math\AxisAlignedBB::isCube ( float  $epsilon = 0.000001)

Definition at line 396 of file AxisAlignedBB.php.

◆ isVectorInside()

pocketmine\math\AxisAlignedBB::isVectorInside ( Vector3  $vector)

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

Definition at line 372 of file AxisAlignedBB.php.

◆ isVectorInXY()

pocketmine\math\AxisAlignedBB::isVectorInXY ( Vector3  $vector)

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

Definition at line 425 of file AxisAlignedBB.php.

◆ isVectorInXZ()

pocketmine\math\AxisAlignedBB::isVectorInXZ ( Vector3  $vector)

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

Definition at line 418 of file AxisAlignedBB.php.

◆ isVectorInYZ()

pocketmine\math\AxisAlignedBB::isVectorInYZ ( Vector3  $vector)

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

Definition at line 411 of file AxisAlignedBB.php.

◆ offset()

pocketmine\math\AxisAlignedBB::offset ( float  $x,
float  $y,
float  $z 
)

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

Returns
$this

Definition at line 118 of file AxisAlignedBB.php.

◆ offsetCopy()

pocketmine\math\AxisAlignedBB::offsetCopy ( float  $x,
float  $y,
float  $z 
)

Returns an offset clone of this AxisAlignedBB.

Definition at line 132 of file AxisAlignedBB.php.

◆ offsetTowards()

pocketmine\math\AxisAlignedBB::offsetTowards ( int  $face,
float  $distance 
)

Offsets this AxisAlignedBB in the given direction by the specified distance.

Parameters
int$faceone of the Facing::* constants
Returns
$this

Definition at line 143 of file AxisAlignedBB.php.

Referenced by pocketmine\block\MobHead\recalculateCollisionBoxes().

+ Here is the caller graph for this function:

◆ offsetTowardsCopy()

pocketmine\math\AxisAlignedBB::offsetTowardsCopy ( int  $face,
float  $distance 
)

Returns an offset clone of this AxisAlignedBB.

Definition at line 152 of file AxisAlignedBB.php.

◆ one()

static pocketmine\math\AxisAlignedBB::one ( )
static

Returns a 1x1x1 bounding box starting at grid position 0,0,0.

Definition at line 499 of file AxisAlignedBB.php.

Referenced by pocketmine\block\Bell\recalculateCollisionBoxes(), pocketmine\block\Cauldron\recalculateCollisionBoxes(), and pocketmine\block\Thin\recalculateCollisionBoxes().

+ Here is the caller graph for this function:

◆ squash()

pocketmine\math\AxisAlignedBB::squash ( int  $axis,
float  $distance 
)

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

See also
AxisAlignedBB::stretch()
Returns
$this
Exceptions

InvalidArgumentException

Definition at line 276 of file AxisAlignedBB.php.

Referenced by pocketmine\block\Chain\recalculateCollisionBoxes().

+ Here is the caller graph for this function:

◆ squashedCopy()

pocketmine\math\AxisAlignedBB::squashedCopy ( int  $axis,
float  $distance 
)

Returns a squashed copy of this bounding box.

See also
AxisAlignedBB::squash()
Exceptions

InvalidArgumentException

Definition at line 286 of file AxisAlignedBB.php.

◆ stretch()

pocketmine\math\AxisAlignedBB::stretch ( int  $axis,
float  $distance 
)

Increases the dimension of the AABB along the given axis.

Parameters
int$axisone of the Axis::* constants
float$distanceNegative values reduce width, positive values increase width.
Returns
$this
Exceptions

InvalidArgumentException

Definition at line 243 of file AxisAlignedBB.php.

◆ stretchedCopy()

pocketmine\math\AxisAlignedBB::stretchedCopy ( int  $axis,
float  $distance 
)

Returns a stretched copy of this bounding box.

See also
AxisAlignedBB::stretch()
Exceptions

InvalidArgumentException

Definition at line 265 of file AxisAlignedBB.php.

◆ trim()

pocketmine\math\AxisAlignedBB::trim ( int  $face,
float  $distance 
)

Inverse of extend().

See also
AxisAlignedBB::extend()
Parameters
float$distancePositive values pull the face in, negative values push out.
Returns
$this
Exceptions

InvalidArgumentException

Definition at line 220 of file AxisAlignedBB.php.

Referenced by pocketmine\block\ChorusPlant\recalculateCollisionBoxes().

+ Here is the caller graph for this function:

◆ trimmedCopy()

pocketmine\math\AxisAlignedBB::trimmedCopy ( int  $face,
float  $distance 
)

Returns a trimmed clone of this bounding box.

See also
AxisAlignedBB::trim()
Exceptions

InvalidArgumentException

Definition at line 230 of file AxisAlignedBB.php.

Member Data Documentation

◆ $maxX

float pocketmine\math\AxisAlignedBB::$maxX

Definition at line 34 of file AxisAlignedBB.php.

◆ $maxY

float pocketmine\math\AxisAlignedBB::$maxY

Definition at line 35 of file AxisAlignedBB.php.

◆ $maxZ

float pocketmine\math\AxisAlignedBB::$maxZ

Definition at line 36 of file AxisAlignedBB.php.

◆ $minX

float pocketmine\math\AxisAlignedBB::$minX

Definition at line 31 of file AxisAlignedBB.php.

◆ $minY

float pocketmine\math\AxisAlignedBB::$minY

Definition at line 32 of file AxisAlignedBB.php.

◆ $minZ

float pocketmine\math\AxisAlignedBB::$minZ

Definition at line 33 of file AxisAlignedBB.php.


The documentation for this class was generated from the following file: