/*****************************************************************************************************************/ /*****************************************************************************************************************/ import type { CartesianCoordinate, Matrix3 } from './common'; /*****************************************************************************************************************/ /** * * Interpolates points between a start and end coordinate with a given precision. * * @param {number[]} start - The starting coordinate [x, y]. * @param {number[]} end - The ending coordinate [x, y]. * @param {number} precision - The precision of the interpolation. * @returns {number[][]} - The interpolated coordinates. * */ export declare function interpolate(start: number[], end: number[], precision: number): number[][]; /*****************************************************************************************************************/ /** * * Interpolates points between a start and end coordinate with a given precision on the geodesic. * * @param {number[]} start - The starting coordinate [x, y]. * @param {number[]} end - The ending coordinate [x, y]. * @param {number} precision - The precision of the interpolation. * @returns {number[][]} - The interpolated coordinates. * */ export declare function interpolateGeodesic(start: number[], end: number[], precision: number): number[][]; /*****************************************************************************************************************/ /** * * Interpolates a rank 2D array of coordinates with a given precision. * * @param {number[][]} coordinates - The array of coordinates to interpolate. * @param {number} precision - The precision of the interpolation. Defaults to 1. * @returns {number[][]} - The interpolated coordinates. * */ export declare function interpolateRank2DArray(coordinates: number[][], precision?: number): number[][]; /*****************************************************************************************************************/ /** * * Interpolates a rank 2D array of coordinates with a given precision on the geodesic. * * @param {number[][]} coordinates - The array of coordinates to interpolate. * @param {number} precision - The precision of the interpolation. Defaults to 1. * @returns {number[][]} - The interpolated coordinates. * */ export declare function interpolateRank2DGeodesicCoordinateArray(coordinates: number[][], precision?: number): number[][]; /*****************************************************************************************************************/ /** * * getRotationMatrix() * * Resolves the elementary rotation matrix about the x, y or z axis by a given angle (in degrees), * e.g., R1, R2 or R3 respectively, as is defined by the iauRx, iauRy and iauRz routines of the IAU * SOFA library. * * N.B. The rotation is passive, e.g., it rotates the reference frame and not the vector, such that * a positive angle rotates the frame anticlockwise as seen from the positive axis looking towards * the origin, and so a vector that is fixed in space appears to rotate clockwise within it: * * R1(φ) = [[1, 0, 0], [0, cos φ, sin φ], [0, −sin φ, cos φ]] * R2(θ) = [[cos θ, 0, −sin θ], [0, 1, 0], [sin θ, 0, cos θ]] * R3(ψ) = [[cos ψ, sin ψ, 0], [−sin ψ, cos ψ, 0], [0, 0, 1]] * * @param axis - The axis of the rotation, e.g., "x", "y" or "z". * @param angle - The angle of the rotation (in degrees). * @returns The 3×3 rotation matrix, in row-major order. * */ export declare function getRotationMatrix(axis: 'x' | 'y' | 'z', angle: number): Matrix3; /*****************************************************************************************************************/ /** * * getMatrixProduct() * * Resolves the product a · b of two 3×3 matrices, such that each element of the product is the dot * product of the i-th row of a and the j-th column of b. * * N.B. The order of the product matters, e.g., applying the product to a vector v applies b first, * and then a, such that (a · b) v = a (b v), and so a rotation by b followed by a rotation by a is * the product a · b, and not b · a. * * @param a - The left-hand 3×3 matrix, e.g., the matrix that is applied second. * @param b - The right-hand 3×3 matrix, e.g., the matrix that is applied first. * @returns The 3×3 matrix product a · b, in row-major order. * */ export declare function getMatrixProduct(a: Matrix3, b: Matrix3): Matrix3; /*****************************************************************************************************************/ /** * * getRotatedCartesianCoordinate() * * Resolves the product of a 3×3 matrix and a column vector, e.g., the matrix applied to the * vector, such that each component of the result is the dot product of a row of the matrix and * the vector. * * N.B. The inverse of a rotation matrix is its transpose, e.g., R⁻¹ = Rᵀ, and so a rotation is * undone by applying the transpose of the matrix to the rotated vector, where the transpose of an * elementary rotation is the rotation by the negated angle, e.g., R3(ψ)ᵀ = R3(−ψ). * * @param matrix - The 3×3 matrix to apply, e.g., a rotation matrix, in row-major order. * @param vector - The cartesian coordinate to apply the matrix to, e.g., { x, y, z }. * @returns The cartesian coordinate of the matrix applied to the vector, e.g., { x, y, z }. * */ export declare function getRotatedCartesianCoordinate(matrix: Matrix3, vector: Required): Required; /*****************************************************************************************************************/ /** * * doDotProduct() * * Resolves the dot product a · b of two cartesian vectors, e.g., the sum of the products of their * corresponding components, such that a · b = |a| |b| cos θ, where θ is the angle between them. * * N.B. The dot product of two unit vectors is the cosine of the angle between them, e.g., as for the * directions of two targets on the celestial sphere, and so it is positive for an acute angle, zero * for a right angle, e.g., for two orthogonal vectors, and negative for an obtuse angle. * * @param a - The first cartesian vector, e.g., { x, y, z }. * @param b - The second cartesian vector, e.g., { x, y, z }. * @returns The dot product a · b of the two vectors. * */ export declare function doDotProduct(a: Required, b: Required): number; /*****************************************************************************************************************/ /** * * doCrossProduct() * * Resolves the cross product a × b of two cartesian vectors, e.g., the vector orthogonal to both of * them, in the direction given by the right-hand rule, such that x × y = z, y × z = x and z × x = y, * with a length of |a| |b| sin θ, where θ is the angle between them. * * N.B. The cross product is anticommutative, e.g., a × b = −(b × a), and so the order of the two * vectors matters, and it is the zero vector for two parallel vectors, e.g., for a vector with itself. * * N.B. The cross product of two directions on the celestial sphere is the pole of the great circle * through them, e.g., the north celestial pole for two directions on the celestial equator, as is * taken in order of increasing right ascension. * * @param a - The first cartesian vector, e.g., { x, y, z }. * @param b - The second cartesian vector, e.g., { x, y, z }. * @returns The cross product a × b of the two vectors, e.g., { x, y, z }. * */ export declare function doCrossProduct(a: Required, b: Required): Required; /*****************************************************************************************************************/ /** * * doVectorSum() * * Resolves the sum a + b of two cartesian vectors, e.g., the vector taken component by component, * such that (a + b) = (a.x + b.x, a.y + b.y, a.z + b.z), as is the diagonal of the parallelogram * spanned by the two vectors. * * N.B. The sum is commutative, e.g., a + b = b + a, and associative, e.g., (a + b) + c = * a + (b + c), and the zero vector is its identity, e.g., a + 0 = a. * * N.B. The sum of two unit vectors bisects the angle between them, with a length of 2 cos(θ / 2), * where θ is the angle between them, e.g., it is the zero vector for two antipodal directions. * * @param a - The first cartesian vector, e.g., { x, y, z }. * @param b - The second cartesian vector, e.g., { x, y, z }. * @returns The sum a + b of the two vectors, e.g., { x, y, z }. * */ export declare function doVectorSum(a: Required, b: Required): Required; /*****************************************************************************************************************/ /** * * doVectorDifference() * * Resolves the difference a − b of two cartesian vectors, e.g., the vector taken component by * component, such that (a − b) = (a.x − b.x, a.y − b.y, a.z − b.z), as is the vector from the tip * of b to the tip of a. * * N.B. The difference is anticommutative, e.g., a − b = −(b − a), and is not associative, e.g., * (a − b) − c ≠ a − (b − c), and it undoes the sum, e.g., (a + b) − b = a. * * N.B. The difference of two unit vectors is the chord between them, with a length of * 2 sin(θ / 2), where θ is the angle between them, e.g., it is the zero vector for two coincident * directions. * * @param a - The first cartesian vector, e.g., { x, y, z }. * @param b - The second cartesian vector, e.g., { x, y, z }. * @returns The difference a − b of the two vectors, e.g., { x, y, z }. * */ export declare function doVectorDifference(a: Required, b: Required): Required; /*****************************************************************************************************************/ /** * * doScale() * * Resolves the scalar multiple k a of a cartesian vector, e.g., the vector taken component by * component, such that k a = (k a.x, k a.y, k a.z), as is the vector along the same line with its * length scaled by |k|. * * N.B. The scalar multiple keeps the direction of the vector for a positive scalar, and reverses * it for a negative scalar, e.g., (−1) a = −a, and is the zero vector for a scalar of zero. * * N.B. The scalar multiple distributes over the sum of two vectors, e.g., k (a + b) = k a + k b, * and over the sum of two scalars, e.g., (k + m) a = k a + m a. * * @param a - The cartesian vector, e.g., { x, y, z }. * @param k - The scalar to multiply the vector by. * @returns The scalar multiple k a of the vector, e.g., { x, y, z }. * */ export declare function doScale(a: Required, k: number): Required; /*****************************************************************************************************************/ /** * * doNormalize() * * Resolves the unit vector a / |a| of a cartesian vector, e.g., the vector along the same direction * with a length of one, such that a / |a| = (a.x / |a|, a.y / |a|, a.z / |a|). * * N.B. The length is taken as the hypotenuse of the three components, and so neither overflows * nor underflows for a vector of extreme length, e.g., of 1e200 or 1e-200. * * N.B. The zero vector has no direction, and so its unit vector is not a number, e.g., as the * spherical coordinate of convertCartesianToEquatorial() is for it. * * @param a - The cartesian vector, e.g., { x, y, z }. * @returns The unit vector a / |a| of the vector, e.g., { x, y, z }. * */ export declare function doNormalize(a: Required): Required; /*****************************************************************************************************************/ /** * * doTranspose() * * Resolves the transpose Mᵀ of a 3×3 matrix, e.g., the matrix reflected about its leading diagonal, * such that the element of the i-th row and the j-th column of the transpose is the element of the * j-th row and the i-th column of the matrix, e.g., Mᵀ[i][j] = M[j][i]. * * N.B. The transpose of a rotation matrix is its inverse, e.g., R⁻¹ = Rᵀ, and so the transpose of * the matrix that rotates one reference frame into another rotates the second back into the first, * where the transpose of an elementary rotation is the rotation by the negated angle, e.g., as * R3(ψ)ᵀ = R3(−ψ). * * N.B. The transpose reverses the order of a product, e.g., (a · b)ᵀ = bᵀ · aᵀ. * * @param m - The 3×3 matrix to transpose, in row-major order. * @returns The 3×3 transpose of the matrix, in row-major order. * */ export declare function doTranspose(m: Matrix3): Matrix3; /*****************************************************************************************************************/ /** * * doDeterminant() * * Resolves the determinant det(M) of a 3×3 matrix, by the cofactor expansion along its first row, * e.g., the signed volume of the parallelepiped spanned by its rows, such that it is the scalar * triple product of its rows, e.g., det [a; b; c] = a · (b × c). * * N.B. The determinant of a rotation matrix is +1, e.g., for a proper rotation between two right- * handed reference frames, whereas it is −1 for a reflection, e.g., for the flip of a single axis * between a right-handed and a left-handed frame, and it is 0 for a singular matrix, which has no * inverse. * * N.B. The determinant is multiplicative, e.g., det(a · b) = det(a) det(b), and it is unchanged by * the transpose, e.g., det(Mᵀ) = det(M). * * @param m - The 3×3 matrix, in row-major order. * @returns The determinant of the matrix. * */ export declare function doDeterminant(m: Matrix3): number; /*****************************************************************************************************************/ /** * * IDENTITY_MATRIX * * The 3×3 identity matrix I, e.g., ones along the leading diagonal and zeros elsewhere, such that * I · M = M · I = M for any 3×3 matrix M, and I v = v for any vector v, e.g., the transformation * between a reference frame and itself, or the rotation of 0° about any axis. * * N.B. The matrix, and each of its rows, is frozen, e.g., as it is shared by every caller, and so an * attempt to mutate it at runtime throws a TypeError, rather than corrupting it for every other. * */ export declare const IDENTITY_MATRIX: Matrix3; /*****************************************************************************************************************/