@thi.ng/matrices
Version:
Matrix & quaternion operations for 2D/3D geometry processing
41 lines • 1.61 kB
TypeScript
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
import type { ReadonlyMat } from "./api.js";
/**
* 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.
*
* @param out -
* @param mvp - 4x4 matrix
* @param view - 2x3 matrix
* @param p -
*/
export declare const project: (out: Vec | null, mvp: ReadonlyMat, view: ReadonlyMat, p: ReadonlyVec) => Vec<number>;
/**
* Same as {@link 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).
*
* @param out -
* @param mvp - 4x4 matrix
* @param view - 2x3 matrix
* @param p -
*/
export declare const project3: (out: Vec | null, mvp: ReadonlyMat, view: ReadonlyMat, p: ReadonlyVec) => Vec<number> | undefined;
/**
* Reverse operation of {@link 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.
*
* @param out -
* @param mvp - 4x4 matrix
* @param view - 2x3 matrix
* @param p -
* @param invert -
*/
export declare const unproject: (out: Vec, mvp: ReadonlyMat, view: ReadonlyMat, p: ReadonlyVec, doInvert?: boolean) => Vec<number> | undefined;
//# sourceMappingURL=project.d.ts.map