Function frustum

  • Computes a 4-by-4 perspective transformation matrix given the left, right, top, bottom, near and far clipping planes. The arguments define a frustum extending in the negative z direction. The arguments near and far are the distances to the near and far clipping planes. Note that near and far are not z coordinates, but rather they are distances along the negative z-axis. The matrix generated sends the viewing frustum to the unit box. We assume a unit box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z dimension.

    Type Parameters

    Parameters

    • left: number

      The x coordinate of the left plane of the box.

    • right: number

      The x coordinate of the right plane of the box.

    • bottom: number

      The y coordinate of the bottom plane of the box.

    • top: number

      The y coordinate of the right plane of the box.

    • near: number

      The negative z coordinate of the near plane of the box.

    • far: number

      The negative z coordinate of the far plane of the box.

    • Optional dst: T

      Output matrix. If not passed a new one is created.

    Returns T

    The perspective projection matrix.