IFClite TypeScript API
    Preparing search index...

    Class MathUtils

    Index
    • Cross product

      Parameters

      • a: Vec3
      • b: Vec3

      Returns Vec3

    • Dot product

      Parameters

      • a: Vec3
      • b: Vec3

      Returns number

    • Create identity matrix

      Returns Mat4

    • Invert a 4x4 matrix

      Parameters

      Returns Mat4 | null

    • Create look-at view matrix.

      Degenerate inputs are absorbed rather than propagated (#2441): a view direction parallel to up (a plan/soffit pose, a Y-dominant auto-fit, an externally authored BCF viewpoint) leaves cross(up, viewDir) at zero length, and normalizing that used to write NaN into all sixteen components — the viewport then drew nothing at all. The same held for a zero-length up, for eye === target, and for a non-finite coordinate in any of the three inputs. All of them now fall back to a stable basis, so this function always returns a finite matrix.

      The basis itself lives in viewBasis; see there for why it is shared rather than inlined.

      Parameters

      • eye: Vec3
      • target: Vec3
      • up: Vec3

      Returns Mat4

    • Normalize a vector, degrading to the zero vector. Total: the result is always finite, which the bare len < 1e-10 floor this used to carry was not (#2479). That floor is a magnitude test, so NaN divided instead of falling back, and an infinite component over an infinite length gave {NaN, 0, 0} — neither finite nor the zero vector a caller tests for. Reachable with nothing malformed anywhere: an inverse component past the Float32Array limit MathUtils.invert writes into saturates to Infinity, and unprojectToRay handed that back as a picking ray.

      Parameters

      • v: Vec3

      Returns Vec3

    • Create orthographic projection matrix (reverse-Z) Uses same reverse-Z convention as perspective for consistent depth buffer behavior. Depth range: near=1.0, far=0.0 (inverted)

      Parameters

      • left: number
      • right: number
      • bottom: number
      • top: number
      • near: number
      • far: number

      Returns Mat4

    • Create perspective projection matrix

      Parameters

      • fov: number
      • aspect: number
      • near: number
      • far: number

      Returns Mat4

    • Create reverse-Z perspective projection matrix Reverse-Z distributes depth precision more evenly, eliminating Z-fighting at far distances. Depth range: near=1.0, far=0.0 (inverted)

      Parameters

      • fov: number
      • aspect: number
      • near: number
      • far: number

      Returns Mat4

    • Subtract vectors

      Parameters

      • a: Vec3
      • b: Vec3

      Returns Vec3

    • Transform vec3 by matrix (as point, w=1)

      Parameters

      Returns Vec3