/** * @license * Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ import { Mat4Array, QuatArray, Vec3Array } from './common'; export type { Mat4Array }; /** * Creates a new identity mat4 * * @returns a new 4x4 matrix */ export declare function create(): Mat4Array; /** * Creates a new mat4 initialized with values from an existing matrix * * @param a matrix to clone * @returns a new 4x4 matrix */ export declare function clone(a: Mat4Array): Mat4Array; /** * Copy the values from one mat4 to another * * @param out the receiving matrix * @param a the source matrix * @returns out */ export declare function copy(out: Mat4Array, a: Mat4Array): Mat4Array; /** * Set a mat4 to the identity matrix * * @param out the receiving matrix * @returns out */ export declare function identity(out: Mat4Array): Mat4Array; /** * Transpose the values of a mat4 * * @param out the receiving matrix * @param a the source matrix * @returns out */ export declare function transpose(out: Mat4Array, a: Mat4Array): Mat4Array; /** * Inverts a mat4 * * @param out the receiving matrix * @param a the source matrix * @returns out */ export declare function invert(out: Mat4Array, a: Mat4Array): Mat4Array | null; /** * Calculates the adjugate of a mat4 * * @param out the receiving matrix * @param a the source matrix * @returns out */ export declare function adjoint(out: Mat4Array, a: Mat4Array): Mat4Array; /** * Calculates the determinant of a mat4 * * @param a the source matrix * @returns determinant of a */ export declare function determinant(a: Mat4Array): number; /** * Multiplies two mat4's * * @param out the receiving matrix * @param a the first operand * @param b the second operand * @returns out */ export declare function multiply(out: Mat4Array, a: Mat4Array, b: Mat4Array): Mat4Array; /** * Multiplies two affine mat4's * Add by https://github.com/pissang * @param out the receiving matrix * @param a the first operand * @param b the second operand * @returns out */ export declare function multiplyAffine(out: Mat4Array, a: Mat4Array, b: Mat4Array): Mat4Array; /** * Alias for {@link mat4.multiply} */ export declare const mul: typeof multiply; /** * Alias for {@link mat4.multiplyAffine} * @function */ export declare const mulAffine: typeof multiplyAffine; /** * Translate a mat4 by the given vector * * @param out the receiving matrix * @param a the matrix to translate * @param v vector to translate by * @returns out */ export declare function translate(out: Mat4Array, a: Mat4Array, v: Vec3Array): Mat4Array; /** * Scales the mat4 by the dimensions in the given vec3 * * @param out the receiving matrix * @param a the matrix to scale * @param v the vec3 to scale the matrix by * @returns out **/ export declare function scale(out: Mat4Array, a: Mat4Array, v: Vec3Array): Mat4Array; /** * Rotates a mat4 by the given angle * * @param out the receiving matrix * @param a the matrix to rotate * @param rad the angle to rotate the matrix by * @param axis the axis to rotate around * @returns out */ export declare function rotate(out: Mat4Array, a: Mat4Array, rad: number, axis: Vec3Array): Mat4Array | null; /** * Rotates a matrix by the given angle around the X axis * * @param out the receiving matrix * @param a the matrix to rotate * @param rad the angle to rotate the matrix by * @returns out */ export declare function rotateX(out: Mat4Array, a: Mat4Array, rad: number): Mat4Array; /** * Rotates a matrix by the given angle around the Y axis * * @param out the receiving matrix * @param a the matrix to rotate * @param rad the angle to rotate the matrix by * @returns out */ export declare function rotateY(out: Mat4Array, a: Mat4Array, rad: number): Mat4Array; /** * Rotates a matrix by the given angle around the Z axis * * @param out the receiving matrix * @param a the matrix to rotate * @param rad the angle to rotate the matrix by * @returns out */ export declare function rotateZ(out: Mat4Array, a: Mat4Array, rad: number): Mat4Array; /** * Creates a matrix from a quaternion rotation and vector translation * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.translate(dest, vec); * const quatMat = mat4.create(); * quat4.toMat4(quat, quatMat); * mat4.multiply(dest, quatMat); * * @param out mat4 receiving operation result * @param {quat4} q Rotation quaternion * @param v Translation vector * @returns out */ export declare function fromRotationTranslation(out: Mat4Array, q: QuatArray, v: Vec3Array): Mat4Array; export declare function fromQuat(out: Mat4Array, q: QuatArray): Mat4Array; /** * Generates a frustum matrix with the given bounds * * @param out mat4 frustum matrix will be written into * @param left Left bound of the frustum * @param right Right bound of the frustum * @param bottom Bottom bound of the frustum * @param top Top bound of the frustum * @param near Near bound of the frustum * @param far Far bound of the frustum * @returns out */ export declare function frustum(out: Mat4Array, left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4Array; /** * Generates a perspective projection matrix with the given bounds * * @param out mat4 frustum matrix will be written into * @param fovy Vertical field of view in radians * @param aspect Aspect ratio. typically viewport width/height * @param near Near bound of the frustum * @param far Far bound of the frustum * @returns out */ export declare function perspective(out: Mat4Array, fovy: number, aspect: number, near: number, far: number): Mat4Array; /** * Generates a orthogonal projection matrix with the given bounds * * @param out mat4 frustum matrix will be written into * @param left Left bound of the frustum * @param right Right bound of the frustum * @param bottom Bottom bound of the frustum * @param top Top bound of the frustum * @param near Near bound of the frustum * @param far Far bound of the frustum * @returns out */ export declare function ortho(out: Mat4Array, left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4Array; /** * Generates a look-at matrix with the given eye position, focal point, and up axis * * @param out mat4 frustum matrix will be written into * @param eye Position of the viewer * @param center Point the viewer is looking at * @param up vec3 pointing up * @returns out */ export declare function lookAt(out: Mat4Array, eye: Vec3Array, center: Vec3Array, up: Vec3Array): Mat4Array; /** * Returns Frobenius norm of a mat4 * * @param a the matrix to calculate Frobenius norm of * @returns Frobenius norm */ export declare function frob(a: Mat4Array): number;