import { mat4 } from "./mat4"; import { mat3 } from "./mat3"; import { quat } from "./quat"; /** * @class 3 Dimensional Vector * @name vec3 */ export declare class vec3 { /** * Creates a new, empty vec3 * * @returns {vec3} a new 3D vector */ static create(): Float32Array; /** * Creates a new vec3 initialized with values from an existing vector * * @param {vec3} a vector to clone * @returns {vec3} a new 3D vector */ static clone(a: any): Float32Array; /** * Creates a new vec3 initialized with the given values * * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @returns {vec3} a new 3D vector */ static fromValues(x: any, y: any, z: any): Float32Array; /** * Copy the values from one vec3 to another * * @param {vec3} out the receiving vector * @param {vec3} a the source vector * @returns {vec3} out */ static copy(out: any, a: any): Float32Array; /** * Set the components of a vec3 to the given values * * @param {vec3} out the receiving vector * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @returns {vec3} out */ static set(out: any, x: any, y: any, z: any): Float32Array; /** * Adds two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ static add(out: any, a: any, b: any): Float32Array; /** * Subtracts vector b from vector a * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ static subtract(out: any, a: any, b: any): Float32Array; /** * Alias for {@link public static subtract} * @function */ static sub: typeof vec3.subtract; /** * Multiplies two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ static multiply(out: any, a: any, b: any): Float32Array; /** * Alias for {@link public static multiply} * @function */ static mul: typeof vec3.multiply; /** * Divides two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ static divide(out: any, a: any, b: any): Float32Array; /** * Alias for {@link public static divide} * @function */ static div: typeof vec3.divide; /** * Math.ceil the components of a vec3 * * @param {vec3} out the receiving vector * @param {vec3} a vector to ceil * @returns {vec3} out */ static ceil(out: any, a: any): Float32Array; /** * Math.floor the components of a vec3 * * @param {vec3} out the receiving vector * @param {vec3} a vector to floor * @returns {vec3} out */ static floor(out: any, a: any): Float32Array; /** * Returns the minimum of two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ static min(out: any, a: any, b: any): Float32Array; /** * Returns the maximum of two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ static max(out: any, a: any, b: any): Float32Array; /** * Math.round the components of a vec3 * * @param {vec3} out the receiving vector * @param {vec3} a vector to round * @returns {vec3} out */ static round(out: Float32Array, a: Float32Array): Float32Array; /** * Scales a vec3 by a scalar number * * @param {vec3} out the receiving vector * @param {vec3} a the vector to scale * @param {Number} b amount to scale the vector by * @returns {vec3} out */ static scale(out: Float32Array, a: Float32Array, b: number): Float32Array; /** * Adds two vec3's after scaling the second operand by a scalar value * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @param {Number} scale the amount to scale b by before adding * @returns {vec3} out */ static scaleAndAdd(out: Float32Array, a: Float32Array, b: Float32Array, scale: number): Float32Array; /** * Calculates the euclidian distance between two vec3's * * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {Number} distance between a and b */ static distance(a: Float32Array, b: Float32Array): number; /** * Alias for {@link public static distance} * @function */ static dist: typeof vec3.distance; /** * Calculates the squared euclidian distance between two vec3's * * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {Number} squared distance between a and b */ static squaredDistance(a: Float32Array, b: Float32Array): number; /** * Alias for {@link public static squaredDistance} * @function */ static sqrDist: typeof vec3.squaredDistance; /** * Calculates the length of a vec3 * * @param {vec3} a vector to calculate length of * @returns {Number} length of a */ static vectorLength(a: Float32Array | number[]): number; /** * Alias for {@link public static length} * @function */ static len: typeof vec3.vectorLength; /** * Calculates the squared length of a vec3 * * @param {vec3} a vector to calculate squared length of * @returns {Number} squared length of a */ static squaredLength(a: Float32Array): number; /** * Alias for {@link public static squaredLength} * @function */ static sqrLen: typeof vec3.squaredLength; /** * Negates the components of a vec3 * * @param {vec3} out the receiving vector * @param {vec3} a vector to negate * @returns {vec3} out */ static negate(out: Float32Array, a: Float32Array): Float32Array; /** * Returns the inverse of the components of a vec3 * * @param {vec3} out the receiving vector * @param {vec3} a vector to invert * @returns {vec3} out */ static inverse(out: Float32Array, a: Float32Array): Float32Array; /** * Normalize a vec3 * * @param {vec3} out the receiving vector * @param {vec3} a vector to normalize * @returns {vec3} out */ static normalize(out: Float32Array, a: Float32Array | number[]): Float32Array; /** * Calculates the dot product of two vec3's * * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {Number} dot product of a and b */ static dot(a: Float32Array, b: Float32Array): number; /** * Computes the cross product of two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ static cross(out: Float32Array, a: Float32Array, b: Float32Array): Float32Array; /** * Performs a linear interpolation between two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @param {Number} t interpolation amount between the two inputs * @returns {vec3} out */ static lerp(out: Float32Array, a: Float32Array, b: Float32Array, t: number): Float32Array; /** * Performs a hermite interpolation with two control points * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @param {vec3} c the third operand * @param {vec3} d the fourth operand * @param {Number} t interpolation amount between the two inputs * @returns {vec3} out */ static hermite(out: Float32Array, a: Float32Array, b: Float32Array, c: Float32Array, d: Float32Array, t: number): Float32Array; /** * Performs a bezier interpolation with two control points * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @param {vec3} c the third operand * @param {vec3} d the fourth operand * @param {Number} t interpolation amount between the two inputs * @returns {vec3} out */ static bezier(out: Float32Array, a: Float32Array, b: Float32Array, c: Float32Array, d: Float32Array, t: number): Float32Array; /** * Generates a random vector with the given scale * * @param {vec3} out the receiving vector * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned * @returns {vec3} out */ static random(out: Float32Array, scale: number): Float32Array; /** * Transforms the vec3 with a mat4. * 4th vector component is implicitly '1' * * @param {vec3} out the receiving vector * @param {vec3} a the vector to transform * @param {mat4} m matrix to transform with * @returns {vec3} out */ static transformMat4(out: Float32Array, a: Float32Array | number[], m: mat4): Float32Array; /** * Transforms the vec3 with a mat3. * * @param {vec3} out the receiving vector * @param {vec3} a the vector to transform * @param {mat3} m the 3x3 matrix to transform with * @returns {vec3} out */ static transformMat3(out: Float32Array, a: Float32Array | number[], m: mat3): Float32Array; /** * Transforms the vec3 with a quat * * @param {vec3} out the receiving vector * @param {vec3} a the vector to transform * @param {quat} q quaternion to transform with * @returns {vec3} out */ static transformQuat(out: Float32Array, a: Float32Array, q: quat): Float32Array; /** * Rotate a 3D vector around the x-axis * @param {vec3} out The receiving vec3 * @param {vec3} a The vec3 point to rotate * @param {vec3} b The origin of the rotation * @param {Number} c The angle of rotation * @returns {vec3} out */ static rotateX(out: Float32Array, a: Float32Array, b: Float32Array, c: number): Float32Array; /** * Rotate a 3D vector around the y-axis * @param {vec3} out The receiving vec3 * @param {vec3} a The vec3 point to rotate * @param {vec3} b The origin of the rotation * @param {Number} c The angle of rotation * @returns {vec3} out */ static rotateY(out: Float32Array, a: Float32Array, b: Float32Array, c: number): Float32Array; /** * Rotate a 3D vector around the z-axis * @param {vec3} out The receiving vec3 * @param {vec3} a The vec3 point to rotate * @param {vec3} b The origin of the rotation * @param {Number} c The angle of rotation * @returns {vec3} out */ static rotateZ(out: Float32Array, a: Float32Array, b: Float32Array, c: number): Float32Array; /** * Perform some operation over an array of vec3s. * * @param {Array} a the array of vectors to iterate over * @param {Number} stride Number of elements between the start of each public static If 0 assumes tightly packed * @param {Number} offset Number of elements to skip at the beginning of the array * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array * @param {Function} fn Function to call for each vector in the array * @param {Object} [arg] additional argument to pass to fn * @returns {Array} a * @function */ static forEach: (a: any, stride: any, offset: any, count: any, fn: any, arg: any) => any; /** * Get the angle between two 3D vectors * @param {vec3} a The first operand * @param {vec3} b The second operand * @returns {Number} The angle in radians */ static angle(a: Float32Array, b: Float32Array): number; /** * Returns a string representation of a vector * * @param {vec3} a vector to represent as a string * @returns {String} string representation of the vector */ static str(a: Float32Array): string; /** * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) * * @param {vec3} a The first vector. * @param {vec3} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ static exactEquals(a: Float32Array, b: Float32Array): boolean; /** * Returns whether or not the vectors have approximately the same elements in the same position. * * @param {vec3} a The first vector. * @param {vec3} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ static equals(a: Float32Array, b: Float32Array): boolean; }