Function orthoMat4c

  • Returns a 4x4 orthographic projection matrix based on the given left, right, bottom, top, near, and far planes.

    This function creates an orthographic projection matrix, which maps 3D coordinates into a 2D plane while maintaining the relative sizes of objects, unlike a perspective projection. It's commonly used for 2D rendering or for parallel projections.

    Parameters

    • left: number

      The left boundary of the viewing volume.

    • right: number

      The right boundary of the viewing volume.

    • bottom: number

      The bottom boundary of the viewing volume.

    • top: number

      The top boundary of the viewing volume.

    • near: number

      The distance to the near clipping plane.

    • far: number

      The distance to the far clipping plane.

    • Optionaldest: FloatArrayParam

      An optional destination matrix to store the result. If not provided, a new matrix is created.

    Returns FloatArrayParam

    The resulting 4x4 orthographic projection matrix. If dest is provided, it will be modified; otherwise, a new matrix is returned.

    const matrix = orthoMat4c(-1, 1, -1, 1, 0.1, 100);
    console.log(matrix);