import { mat2d } from './mat2d'; import { mat4 } from './mat4'; import { quat } from './quat'; import { vec2 } from './vec2'; import { vec3 } from './vec3'; /** * Represents 2D affine transformation (translation, rotation, scaling, and skewing). * The format is column-major as in WebGL, so the matrix looks like this: * ```ts * [xx, xy, 0 * yx, yy, 0 * tx, ty, 1] * ``` * @category Types */ export type mat3 = readonly [ m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number ]; /** * Functions for {@link mat3}, 2D affine transformation. * @category Modules */ export declare namespace mat3 { /** * Mutable version of {@link mat3} * @category Types */ type Mutable = [ m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number ]; /** * Creates a new matrix from given elements * @category Generators */ function of(m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3; /** * Creates a mutable clone of given mat3 * @category Generators */ function clone(a: mat3): Mutable; /** * Copies the upper-left 3x3 values into the given mat3. * @category Generators */ function fromMat4(a: mat4): mat3; /** * The identity matrix of mat3 * ```ts * [1, 0, 0, * 0, 1, 0, * 0, 0, 1] * ``` * @category Constants * * @shorthands * - {@link id} * - {@link ident} */ const identity: mat3; /** * Alias for {@link identity} * @category Shorthands */ const I: mat3; /** * Alias for {@link identity} * @category Shorthands */ const id: mat3; /** * Alias for {@link identity} * @category Shorthands */ const ident: mat3; /** * @category Constants */ const zero: mat3; /** * Transpose the values of a mat3 */ function transpose(a: mat3): mat3; /** * Inverts a mat3 * * @shorthands * - {@link inv} */ function invert(a: mat3): mat3 | null; /** * Alias for {@link invert} * @category Shorthands */ const inv: typeof invert; /** * Calculates the adjugate of a mat3 */ function adjoint(a: mat3): mat3; /** * Calculates the determinant of a mat3 * * @shorthands * - {@link det} */ function determinant(a: mat3): number; /** * Alias for {@link determinant} * @category Shorthands */ const det: typeof determinant; /** * Multiplies given mat3's * * @shorthands * - {@link mul} */ function multiply(...ms: mat3[]): mat3; /** * Alias for {@link multiply} * @category Shorthands */ const mul: typeof multiply; /** * Translate a mat3 by the given vector */ function translate(a: mat3, v: vec3): mat3; /** * Rotates a mat3 by the given angle */ function rotate(a: mat3, deg: number): mat3; /** * Scales the mat3 by the dimensions in the given vec2 **/ function scale(a: mat3, v: vec2): mat3; /** * Creates a matrix from a vector translation * @category Generators * * @shorthands * - {@link translation} */ function fromTranslation(v: vec2): mat3; /** * Alias for {@link fromTranslation} * @category Shorthands */ const translation: typeof fromTranslation; /** * Creates a matrix from a given angle * @param deg The angle to rotate the matrix by, in degrees * @category Generators * * @shorthands * - {@link rotation} */ function fromRotation(deg: number): mat3; /** * Alias for {@link fromRotation} * @category Shorthands */ const rotation: typeof fromRotation; /** * Creates a matrix from a vector scaling * @category Generators * * @shorthands * - {@link scaling} */ function fromScaling(v: vec2): mat3; /** * Alias for {@link fromScaling} * @category Shorthands */ const scaling: typeof fromScaling; /** * Copies the values from a {@link mat2d} * @category Generators **/ function fromMat2d(a: mat2d): mat3; /** * Calculates a 3x3 matrix from the given quaternion * @category Generators * */ function fromQuat(q: quat): mat3; /** * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix * */ function normalFromMat4(a: mat4): mat3 | null; /** * Generates a 2D projection matrix with the given bounds * @category Generators */ function projection(width: number, height: number): mat3; /** * Returns Frobenius norm of a mat3 */ function frob(a: mat3): number; /** * Adds given mat3's */ function add(...ms: mat3[]): mat3; /** * Subtracts matrix b from matrix a * * @shorthands * - {@link sub} */ function subtract(...ms: mat3[]): mat3; /** * Alias for {@link subtract} * @category Shorthands */ const sub: typeof subtract; /** * Subtracts b from a */ function delta(a: mat3, b: mat3): mat3; /** * Multiply each element of the matrix by a scalar. */ function multiplyScalar(a: mat3, s: number): mat3; /** Adds given mat3's after multiplying each element of the second operand by a scalar value. */ function multiplyScalarAndAdd(a: mat3, b: mat3, scale: number): mat3; /** * Constrain each element to lie between min and max * @see https://thebookofshaders.com/glossary/?search=clamp */ function clamp(a: mat3, min: number, max: number): mat3; /** * Clamps each element to [0, 1] */ function clamp01(a: mat3): mat3; /** * Clamps each element to [-1, 1] */ function clamp11(a: mat3): mat3; /** * Returns whether or not the matrices have exactly the same elements in the same position (when compared with `===`) * * @shorthands * - {@link eq} */ function exactEquals(a: mat3, b: mat3): boolean; /** * Alias for {@link exactEquals} * @category Shorthands */ const eq: typeof exactEquals; /** * Returns whether or not the matrices have approximately the same elements in the same position. * * @shorthands * - {@link approx} * - {@link equals} */ function approxEquals(a: mat3, b: mat3): boolean; /** * Alias for {@link approxEquals} * @category Shorthands */ const approx: typeof approxEquals; /** * Alias for {@link approxEquals}. This is provided for compatibility with gl-matrix. * @category Shorthands * @deprecated Use {@link approxEquals} instead */ const equals: typeof approxEquals; /** * Returns a string representation of a mat3 * @param m matrix to represent as a string * @param fractionDigits number of digits to appear after the decimal point */ const toString: (m: mat3, fractionDigits?: number) => string; } //# sourceMappingURL=mat3.d.ts.map