AABB
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructs an axis aligned bounding box
- contains() : bool
- Returns true if the given point is inside the current AABB
- copy() : AABB
- Returns a copy of the current AABB
- depth() : float
- Returns the depth of the AABB
- extend() : void
- Extends the current AABB to include the given AABB
- getCenter() : Vec3
- Returns the center of the AABB
- getCorners() : array<string|int, Vec3>
- Returns an array of 8 Vec3 representing the corners of the AABB
- getTranslationToAvoidIntersection() : Vec3
- Returns a Vec3 representing a translation that could be applied to the current AABB to make it not intersect with the given AABB
- height() : float
- Returns the height of the AABB
- intersectRay() : Vec3|null
- Returns the intersection point of the current AABB and the given Ray
- intersectRayDistance() : float|null
- Retuns the intersection distance of this AABB and Ray
- intersects() : bool
- Returns true if the given AABB intersects with the current AABB
- width() : float
- Returns the width of the AABB
Properties
$max
public
Vec3
$max
$min
public
Vec3
$min
Methods
__construct()
Constructs an axis aligned bounding box
public
__construct(Vec3 $min, Vec3 $max) : mixed
Parameters
- $min : Vec3
- $max : Vec3
contains()
Returns true if the given point is inside the current AABB
public
contains(Vec3 $point) : bool
Parameters
- $point : Vec3
Return values
boolcopy()
Returns a copy of the current AABB
public
copy() : AABB
Return values
AABBdepth()
Returns the depth of the AABB
public
depth() : float
Return values
floatextend()
Extends the current AABB to include the given AABB
public
extend(AABB $aabb) : void
Parameters
- $aabb : AABB
getCenter()
Returns the center of the AABB
public
getCenter() : Vec3
Return values
Vec3getCorners()
Returns an array of 8 Vec3 representing the corners of the AABB
public
getCorners() : array<string|int, Vec3>
Return values
array<string|int, Vec3>getTranslationToAvoidIntersection()
Returns a Vec3 representing a translation that could be applied to the current AABB to make it not intersect with the given AABB
public
getTranslationToAvoidIntersection(AABB $aabb) : Vec3
Parameters
- $aabb : AABB
Return values
Vec3height()
Returns the height of the AABB
public
height() : float
Return values
floatintersectRay()
Returns the intersection point of the current AABB and the given Ray
public
intersectRay(Ray $ray) : Vec3|null
Parameters
- $ray : Ray
Return values
Vec3|nullintersectRayDistance()
Retuns the intersection distance of this AABB and Ray
public
intersectRayDistance(Ray $ray) : float|null
Parameters
- $ray : Ray
Return values
float|nullintersects()
Returns true if the given AABB intersects with the current AABB
public
intersects(AABB $aabb) : bool
Parameters
- $aabb : AABB
Return values
boolwidth()
Returns the width of the AABB
public
width() : float