Class: BoundingBox

pc.BoundingBox

Axis-Aligned Bounding Box.

Constructor

new BoundingBox(centeropt, halfExtentsopt)

Create a new axis-aligned bounding box.
Parameters:
Name Type Attributes Description
center pc.Vec3 <optional>
Center of box. The constructor takes a reference of this parameter.
halfExtents pc.Vec3 <optional>
Half the distance across the box in each axis. The constructor takes a reference of this parameter.
Source:

Methods

add(other)

Combines two bounding boxes into one, enclosing both.
Parameters:
Name Type Description
other pc.BoundingBox Bounding box to add.
Source:

containsPoint(point) → {Boolean}

Test if a point is inside a AABB.
Parameters:
Name Type Description
point pc.Vec3 Point to test.
Source:
Returns:
true if the point is inside the AABB and false otherwise.
Type
Boolean

getMax() → {pc.Vec3}

Return the maximum corner of the AABB.
Source:
Returns:
maximum corner.
Type
pc.Vec3

getMin() → {pc.Vec3}

Return the minimum corner of the AABB.
Source:
Returns:
minimum corner.
Type
pc.Vec3

intersects(other) → {Boolean}

Test whether two axis-aligned bounding boxes intersect.
Parameters:
Name Type Description
other pc.BoundingBox Bounding box to test against.
Source:
Returns:
True if there is an intersection.
Type
Boolean

intersectsBoundingSphere(sphere) → {Boolean}

Test if a Bounding Sphere is overlapping, enveloping, or inside this AABB.
Parameters:
Name Type Description
sphere pc.BoundingSphere Bounding Sphere to test.
Source:
Returns:
true if the Bounding Sphere is overlapping, enveloping, or inside the AABB and false otherwise.
Type
Boolean

intersectsRay(ray, pointopt) → {Boolean}

Test if a ray intersects with the AABB.
Parameters:
Name Type Attributes Description
ray pc.Ray Ray to test against (direction must be normalized).
point pc.Vec3 <optional>
If there is an intersection, the intersection point will be copied into here.
Source:
Returns:
True if there is an intersection.
Type
Boolean

setFromTransformedAabb(aabb, m)

Set an AABB to enclose the specified AABB if it were to be transformed by the specified 4x4 matrix.
Parameters:
Name Type Description
aabb pc.BoundingBox Box to transform and enclose
m pc.Mat4 Transformation matrix to apply to source AABB.
Source: