Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "project"

Index

Functions

Const project

  • Transforms given point p (4D, homogeneous coordinates) with 4x4 matrix mvp, applies perspective divide and then transforms XY components with 2x3 matrix view matrix. Returns 3D vector. The result Z component can be used for depth sorting.

    Parameters

    Returns Vec

Const project3

  • Same as project, but slightly faster and more convenient for the most common use case of projecting a 3D input point (assumes w=1 for its homogeneous coordinate, i.e. [x,y,z,1]). Returns undefined if the computed perspective divisor is zero (and would cause in NaN results).

    Parameters

    Returns undefined | Vec

Const unproject

  • Reverse operation of project3. If invert is true (default: false), both mvp and view matrices will be inverted first (non-destructively), else they're both assumed to be inverted already.

    Parameters

    • out: Vec

      -

    • mvp: ReadonlyMat

      4x4 matrix

    • view: ReadonlyMat

      2x3 matrix

    • p: ReadonlyVec

      -

    • Default value doInvert: boolean = false

    Returns undefined | Vec

Generated using TypeDoc