import { mat2d } from './mat2d'; import { vec2 } from './vec2'; /** * Represents 2D transformation excluding translation. * The format is column-major as in WebGL, so the matrix looks like this: * ```ts * [xx, xy, * yx, yy] * ``` * @category Types */ export type mat2 = readonly [m00: number, m01: number, m10: number, m11: number]; /** * Functions for {@link mat2}, 2D transformation matrix excluding translation. * @category Modules */ export declare namespace mat2 { /** * Mutable version of {@link mat2} * @category Types */ type Mutable = [m00: number, m01: number, m10: number, m11: number]; /** * Creates a new matrix from given elements * @category Generators */ function of(m00: number, m01: number, m10: number, m11: number): mat2; /** * Creates a mutable clone of given mat2 * @category Generators */ function clone(a: mat2): Mutable; /** * The identity matrix of mat2. * ```ts * [1, 0, * 0, 1] * ``` * @category Constants * * @shorthands * - {@link id} * - {@link ident} */ const identity: mat2; /** * Alias for {@link identity} * @category Shorthands */ const I: mat2; /** * Alias for {@link identity} * @category Shorthands */ const id: mat2; /** * Alias for {@link identity} * @category Shorthands */ const ident: mat2; /** * The mat2 filled with zeros. * @category Constants */ const zero: mat2; /** * Transpose the values of a mat2 */ function transpose(a: mat2): mat2; /** * Inverts a mat2 * * @shorthands * - {@link inv} */ function invert(a: mat2): mat2 | null; /** * Alias for {@link invert} */ const inv: typeof invert; /** * Calculates the adjugate of a mat2 */ function adjoint(a: mat2): mat2; /** * Calculates the determinant of a mat2 * @returns determinant of a * * @shorthands * - {@link det} */ function determinant(a: mat2): number; /** * Alias for {@link determinant} * @category Shorthands */ const det: typeof determinant; /** * Multiplies given mat2's * * @shorthands * - {@link mul} */ function multiply(...ms: mat2[]): mat2; /** * Alias for {@link multiply} * @category Shorthands */ const mul: typeof multiply; /** * Rotates a mat2 by the given angle * * @param a the matrix to rotate * @param deg the angle to rotate the matrix by, in degrees */ function rotate(a: mat2, deg: number): mat2; /** * Scales the mat2 by the dimensions in the given vec2 **/ function scale(a: mat2, b: vec2 | number): mat2; /** * Apply skew to the mat2d by the given angles * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skew * @param m the matrix to skew * @param deg the angles to skew the matrix by, in degrees */ function skew(m: mat2, deg: vec2): mat2; /** * 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): mat2; /** * 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): mat2; /** * Alias for {@link fromScaling} * @category Shorthands */ const scaling: typeof fromScaling; /** * Creates a matrix from a vector skew * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skew * @category Generators * * @shorthands * - {@link skewing} */ function fromSkew(deg: vec2): mat2; /** * Alias for {@link fromSkew} * @category Shorthands */ const skewing: typeof fromSkew; /** * Creates a matrix from given rotation, and scaling. The order of the transformations is rotation, and scaling. * @param r Rotation angle in degrees * @param s Scaling vector * @returns The matrix that represents the transformation */ function fromRotScale(r?: number | null, s?: vec2 | null): number[]; /** * Alias for {@link fromRotScale} * @category Shorthands */ const rs: typeof fromRotScale; /** * Returns Frobenius norm of a mat2 */ function frob(a: mat2): number; /** * Adds given mat2's */ function add(...ms: mat2[]): mat2; /** * Subtracts matrix b from matrix a * * @shorthands * - {@link sub} */ function subtract(...ms: mat2[]): mat2; /** * Alias for {@link subtract} * @category Shorthands */ const sub: typeof subtract; /** * Subtracts b from a */ function delta(a: mat2, b: mat2): mat2; /** * Copies the values from a {@link mat2d}, omitting the translation components * @param m The matrix to copy from * @returns A newly created matrix * @category Generators */ function fromMat2d(m: mat2d): mat2; /** * Multiplies each element of a mat2 by a scalar */ function multiplyScalar(a: mat2, s: number): mat2; /** * Adds given mat2's after multiplying each element of the second operand by a scalar value. */ function multiplyScalarAndAdd(a: mat2, b: mat2, scale: number): mat2; /** * Constrain each element to lie between min and max * @see https://thebookofshaders.com/glossary/?search=clamp */ function clamp(a: mat2, min: number, max: number): mat2; /** * Clamps each element to [0, 1] */ function clamp01(a: mat2): mat2; /** * Clamps each element to [-1, 1] */ function clamp11(a: mat2): mat2; /** * Returns whether or not the matrices have exactly the same elements in the same position (when compared with `===`) * * @shorthands * - {@link eq} */ function exactEquals(a: mat2, b: mat2): 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: mat2, b: mat2): 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 mat2 * @param m matrix to represent as a string * @param fractionDigits number of digits to appear after the decimal point */ const toString: (m: mat2, fractionDigits?: number) => string; } //# sourceMappingURL=mat2.d.ts.map