UNPKG

@mlightcad/geometry-engine

Version:

The geometry-engine package provides comprehensive geometric entities, mathematical operations, and transformations for 2D and 3D space. This package mimics AutoCAD ObjectARX's AcGe (Geometry) classes and provides the mathematical foundation for CAD opera

203 lines 8.08 kB
import { AcGeMatrix3d } from './AcGeMatrix3d'; import { AcGeVector2d } from './AcGeVector2d'; import { AcGeVector3d } from './AcGeVector3d'; /** * The class representing a 3x3 matrix. */ export declare class AcGeMatrix2d { /** * Identity matrix. */ static IDENTITY: Readonly<AcGeMatrix2d>; /** * A column-major list of matrix values. */ elements: number[]; /** * Create a 3x3 matrix with the given arguments in row-major order. If no arguments are provided, * the constructor initializes the Matrix3 to the 3x3 identity matrix. * @param n11 Input element in the first row and the first column * @param n12 Input element in the first row and the second column * @param n13 Input element in the first row and the third column * @param n21 Input element in the second row and the first column * @param n22 Input element in the second row and the second column * @param n23 Input element in the second row and the third column * @param n31 Input element in the third row and the first column * @param n32 Input element in the third row and the second column * @param n33 Input element in the third row and the third column */ constructor(n11?: number, n12?: number, n13?: number, n21?: number, n22?: number, n23?: number, n31?: number, n32?: number, n33?: number); /** * Set the 3x3 matrix values to the given row-major sequence of values. * * @param n11 Input element in the first row and the first column * @param n12 Input element in the first row and the second column * @param n13 Input element in the first row and the third column * @param n21 Input element in the second row and the first column * @param n22 Input element in the second row and the second column * @param n23 Input element in the second row and the third column * @param n31 Input element in the third row and the first column * @param n32 Input element in the third row and the second column * @param n33 Input element in the third row and the third column * @returns Return this matrix */ set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): this; /** * Reset this matrix to the 3x3 identity matrix: * @returns Return this matrix */ identity(): this; /** * Copy the elements of matrix m into this matrix. * @param m Input one matrix copied from * @returns Return this matrix */ copy(m: AcGeMatrix2d): this; /** * Extracts the basis of this matrix into the three axis vectors provided * @param xAxis Input X axis vector * @param yAxis Input Y axis vector * @param zAxis Input Z axis vector * @returns Return this matrix */ extractBasis(xAxis: AcGeVector3d, yAxis: AcGeVector3d, zAxis: AcGeVector3d): this; /** * Set this matrix to the upper 3x3 matrix of the Matrix4 m. * @param m Input one 4x4 matrix * @returns Return this matrix */ setFromMatrix4(m: AcGeMatrix3d): this; /** * Post-multiplies this matrix by m. * @param m Input one 3x3 matrix * @returns Return this matrix */ multiply(m: AcGeMatrix2d): this; /** * Pre-multiplies this matrix by m. * @param m Input one 3x3 matrix * @returns Return this matrix */ premultiply(m: AcGeMatrix2d): this; /** * Set this matrix to a x b. * @param a Input one 3x3 matrix * @param b Input one 3x3 matrix * @returns Return this matrix */ multiplyMatrices(a: AcGeMatrix2d, b: AcGeMatrix2d): this; /** * Multiply every component of the matrix by the scalar value s. * @param s Input one scalar value * @returns Return this matrix */ multiplyScalar(s: number): this; /** * Compute and return the determinant of this matrix. * @returns Return the determinant of this matrix */ determinant(): number; /** * Invert this matrix, using the analytic method. You can not invert with a determinant of zero. * If you attempt this, the method produces a zero matrix instead. * @returns Return this matrix */ invert(): this; /** * Transpose this matrix in place. * @returns Return this matrix */ transpose(): this; /** * Sets this matrix as the upper left 3x3 of the normal matrix of the passed matrix4. The normal * matrix is the inverse transpose of the matrix m. * @param matrix4 Input one 4x4 matrix * @returns Return this matrix */ getNormalMatrix(matrix4: AcGeMatrix3d): this; /** * Set this matrix as the upper left 3x3 of the normal matrix of the passed matrix4. The normal * matrix is the inverse transpose of the matrix m. * @param r Input one 4x4 matrix * @returns Return this matrix */ transposeIntoArray(r: AcGeMatrix3d): this; /** * Set the UV transform matrix from offset, repeat, rotation, and center. * @param tx Input offset x * @param ty Input offset y * @param sx Input repeat x * @param sy Input repeat y * @param rotation Input rotation, in radians. Positive values rotate counterclockwise * @param cx Input center x of rotation * @param cy Input center y of rotation * @returns Return this matrix */ setUvTransform(tx: number, ty: number, sx: number, sy: number, rotation: number, cx: number, cy: number): this; /** * Scale this matrix with the given scalar values. * @param sx Input one scalar value * @param sy Input one scalar value * @returns Return this matrix */ scale(sx: number, sy: number): this; /** * Rotate this matrix by the given angle (in radians). * @param theta Input one angle in radians * @returns Return this matrix */ rotate(theta: number): this; /** * Translate this matrix by the given scalar values. * @param tx Input one scalar value * @param ty Input one scalar value * @returns Return this matrix */ translate(tx: number, ty: number): this; /** * Set this matrix as a 2D translation transform: * @param x Input one 2d vector or one number * @param y Input one number * @returns Return this matrix */ makeTranslation(x: number | AcGeVector2d, y: number): this; /** * Set this matrix as a 2D rotational transformation by theta radians * @param theta Input rotation angle in radians. Positive values rotate counterclockwise. * @returns Return this matrix */ makeRotation(theta: number): this; /** * Set this matrix as a 2D scale transform * @param x Input the amount to scale in the X axis. * @param y Input the amount to scale in the Y axis. * @returns Return this matrix */ makeScale(x: number, y: number): this; /** * Return true if this matrix and m are equal. * @param matrix Input one matrix to compare * @returns Return true if this matrix and m are equal. */ equals(matrix: AcGeMatrix2d): boolean; /** * Set the elements of this matrix based on an array in column-major format. * @param array Input the array to read the elements from. * @param offset Input (optional) index of first element in the array. Default is 0. * @returns Return this matrix */ fromArray(array: number[], offset?: number): this; /** * Write the elements of this matrix to an array in column-major format. * @param array Input (optional) array to store the resulting vector in. If not given a new array will be created. * @param offset Input (optional) offset in the array at which to put the result. * @returns Return this matrix */ toArray(array?: number[], offset?: number): number[]; /** * Creates a new 3x3 matrix and with identical elements to this one. * @returns Return the cloned matrix */ clone(): AcGeMatrix2d; } //# sourceMappingURL=AcGeMatrix2d.d.ts.map