Nano WebGPU API - v0.11.0
    Preparing search index...

    Class AABB

    Axis-Aligned Bounding Box used for broad-phase collision detection. This is a pure math struct with no dependencies on the GPU or scene graph.

    Index

    Constructors

    Methods

    • Checks if a point is inside this AABB.

      Parameters

      Returns boolean

    • Expands this AABB to include the given point (in-place).

      Parameters

      Returns this

    • Checks if this AABB overlaps with another AABB. Uses the standard Axis-Aligned Bounding Box intersection algorithm.

      Parameters

      Returns boolean

    • Returns an AABB transformed into world-space by a Mat4. Uses the "8-corner transform" technique — correct for any affine transform.

      Parameters

      • matrix: Mat4

        The transformation matrix.

      • Optionalout: AABB

        Optional pre-allocated AABB to store the result, avoiding Garbage Collection allocations.

      Returns AABB

    • Creates an AABB from a center point and a half-extents size.

      Parameters

      • center: Vec3

        The center of the box

      • halfExtents: Vec3

        The half-size on each axis

      Returns AABB

    • Computes an AABB from a raw interleaved vertex buffer. Stride must be at least 3 (x, y, z) for positions at the beginning of each vertex.

      Parameters

      • vertices: Float32Array<ArrayBufferLike> | number[]

        Flat array of vertex data (position first)

      • stride: number = 8

        Number of floats per vertex (e.g. 8 for pos+norm+uv)

      Returns AABB

    Properties

    max: Vec3

    Maximum corner of the box (right, top, front)

    min: Vec3

    Minimum corner of the box (left, bottom, back)