import type { Matrix3 } from "./matrix3.js"; import type { Transformation } from "./transformation.js"; /** * A vector with 3 components, labeled: `X`, `Y`, `Z`. */ export declare class Vector3 { /** * The X component of the vector. */ x: number; /** * The Y component of the vector. */ y: number; /** * The Z component of the vector. */ z: number; /** * Constructs a new {@linkcode Vector3}. * @param x - The X component. * @param y - The Y component. * @param z - The Z component. */ constructor(x?: number, y?: number, z?: number); /** * Creates a copy of another {@linkcode Vector3}. * @param vector - The vector to copy. * @returns A new vector. */ static fromVector3(vector: Readonly): Vector3; /** * Sets the vector to new coordinates. * @param vector - The coordinates to set the vector to. * @returns This instance. */ set(vector: Readonly): this; /** * Sets the vector to new coordinates. * @param x - The new X component for the vector. * @param y - The new Y component for the vector. * @param z - The new Z component for the vector. * @returns This instance. */ setXYZ(x: number, y: number, z: number): this; /** * Adds another vector to this vector. * @param vector - The vector to add to this vector. * @returns This instance. */ add(vector: Readonly): this; /** * Adds another vector to this vector. * @param x - The value to add to the X component. * @param y - The value to add to the Y component. * @param z - The value to add to the Z component. * @returns This instance. */ addXYZ(x: number, y: number, z: number): this; /** * Scales another vector and adds it to this vector. * @param vector - The vector to add to this vector. * @param scale - The scaling to apply to the input vector. * @returns This instance. */ addMultiply(vector: Readonly, scale: number): this; /** * Scales another vector and adds it to this vector. * @param x - The value to add to the X component. * @param y - The value to add to the Y component. * @param z - The value to add to the Z component. * @param scale - The scaling to apply to the input vector. * @returns This instance. */ addMultiplyXYZ(x: number, y: number, z: number, scale: number): this; /** * Subtracts another vector from this vector. * @param vector - The vector to subtract from this vector. * @returns This instance. */ subtract(vector: Vector3): this; /** * Subtracts another vector from this vector. * @param x - The value to subtract from the X component. * @param y - The value to subtract from the Y component. * @param z - The value to subtract from the Z component. * @returns This instance. */ subtractXYZ(x: number, y: number, z: number): this; /** * Multiplies this vector by another vector. * @param vector - The vector to multiply with this vector. * @returns This instance. */ multiply(vector: Readonly): this; /** * Multiplies this vector by another vector. * @param x - The value to multiply with the X component. * @param y - The value to multiply with the Y component. * @param z - The value to multiply with the Z component. * @returns This instance. */ multiplyXYZ(x: number, y: number, z: number): this; /** * Multiplies the vector by the given scale. * @param scale - The scaling to apply to the vector. * @returns This instance. */ multiplyScale(scale: number): this; /** * Divides this vector by another vector. * @param vector - The vector to divide this vector with. * @returns This instance. */ divide(vector: Readonly): this; /** * Divides this vector by another vector. * @param x - The value to divide the X component with. * @param y - The value to divide the Y component with. * @param z - The value to divide the Z component with. * @returns This instance. */ divideXYZ(x: number, y: number, z: number): this; /** * Divides the vector by the given scale. * @param scale - The scaling to apply to the vector. * @returns This instance. */ divideScale(scale: number): this; /** * Inverts the direction of the vector. * @returns This instance. */ invertAdd(): this; /** * Inverts the vectors scale. * @returns This instance. */ invertMultiply(): this; /** * Clamps the components of the vector at the given boundary. * @param floor - The lowest value to allow. * @param ceil - The largest value to allow. * @returns This instance. */ clamp(floor: number, ceil: number): this; /** * Calculates the length of the vector. * @returns The length of the vector. */ length(): number; /** * Normalizes the vector. * @returns This instance. */ normalize(): this; /** * Compares two vectors. * @param vector - The vector to compare this vector to. * @returns `true` if the vectors are idently, `false` otherwise. */ compare(vector: Readonly): boolean; /** * Linearly moves this vector towards a target vector. * @param vector - The target vector. * @param t - The location on the scale, from `0` to `1`. * @returns This instance. */ lerp(vector: Readonly, t: number): this; /** * Rotates the vector by the given rotation matrix. * @param matrix - The rotation matrix to apply to the vector. * @returns This instance. */ rotate(matrix: Readonly): this; /** * Inversely rotates the vector by the given rotation matrix. * @param matrix - The rotation matrix to apply to the vector. * @returns This instance. */ rotateInverse(matrix: Readonly): this; /** * Rotates the vector by the given rotation matrix around the given center. * @param center - The center around which to rotate the vector. * @param matrix - The rotation matrix to apply to the vector. * @returns This instance. */ rotateAround(center: Readonly, matrix: Readonly): this; /** * Inversely rotates the vector by the given rotation matrix around the given center. * @param center - The center around which to rotate the vector. * @param matrix - The rotation matrix to apply to the vector. * @returns This instance. */ rotateAroundInverse(center: Readonly, matrix: Readonly): this; /** * Transform the vector with a {@linkcode Transformation}. * @param transformation - The transformation to apply. * @returns This instance. */ transform(transformation: Readonly): this; /** * Inversely transform the vector with a {@linkcode Transformation}. * @param transformation - The transformation to apply. * @returns This instance. */ transformInverse(transformation: Readonly): this; /** * Returns the dot product between two vectors. * @param vector - The other vector. * @returns The dot product between the two vectors. */ dot(vector: Readonly): number; /** * Returns the dot product between two vectors. * @param x - The X component of the other vector. * @param y - The Y component of the other vector. * @param z - The Z component of the other vector. * @returns The dot product between the two vectors. */ dotXYZ(x: number, y: number, z: number): number; /** * Calculates the dot product of this vector and another vector, and then * sets this vector to the result. * @param vector - The other vector. * @returns This instance. */ cross(vector: Readonly): this; /** * Makes this vector perpendicular to the other 3 vectors. * @param vector0 - The first vector. * @param vector1 - The second vector. * @param vector2 - The third vector. * @returns This instance. */ perpendicular(vector0: Readonly, vector1: Readonly, vector2: Readonly): this; /** * Reflects this vector against the given normal and sets this vector to * the result. * @param normal - The normal against which to reflect. * @returns This instance. */ reflect(normal: Readonly): this; /** * Calculates the reflection of this vector, based on the angle of incident * into a material with the given refractive index, according to Snell's law. * This vector is then set to the result. * @param normal - The normal against which to reflect. * @param index - The refractive index of the material. * @returns This instance. */ fraction(normal: Readonly, index: number): this; /** * Return the components of this vector as an array. * @returns The components of this vector as an array. */ asArray(): [number, number, number]; } /** * Adds two vectors and returns a new vector with the result. * @param a - The first input vector. * @param b - The second input vector. * @returns A new {@linkcode Vector3}. */ export declare const addVector3: (a: Readonly, b: Readonly) => Vector3; /** * Multiplies two vectors and returns a new vector with the result. * @param a - The first input vector. * @param b - The second input vector. * @returns A new {@linkcode Vector3}. */ export declare const multiplyVector3: (a: Readonly, b: Readonly) => Vector3; /** * Subtracts two vectors and returns a new vector with the result. * @param a - The first input vector. * @param b - The second input vector. * @returns A new {@linkcode Vector3}. */ export declare const subtractVector3: (a: Readonly, b: Readonly) => Vector3; /** * Calculates the cross product between two vectors and returns a new vector with the result. * @param a - The first input vector. * @param b - The second input vector. * @returns A new vector, which is the cross product of the two input vectors. */ export declare const crossVector3: (a: Readonly, b: Readonly) => Vector3; /** * Calculates the dot product between two vectors. * @param a - The first input vector. * @param b - The second input vector. * @returns The dot product between the two vectors. */ export declare const dotVector3: (a: Readonly, b: Readonly) => number;