import Matrix from './Matrix'; export default class Vector { /** Values of the vector */ private _values; constructor(values?: number[]); get rows(): number; get values(): number[]; /** * Set values into the vector. * If the parameters vector is to wide, the values are cropped to the current vector size. * It the parameters vector is to small, remaining cells will be filled with 0. * @param newValues Arrays of new values. */ set values(newValues: number[]); /** * Calculates the angle in radians between the vector and the receiver. * @param vector The operand vector * @return An angle, between 0 and +π inclusive. */ angle(vector: Vector): number; /** * Calculates the distance between the vector and the receiver. * Equivalent to |receiver - vector| * @param vector The operand vector * @return The distance (absolute value) between the two vectors */ distance(vector: Vector): number; /** * Get a matrix value, from its position * @param row Matrix line, from 0 to `rows` */ at(row: number): number; /** * Get the position, from its matrix value * @param value The value to search * @return The position of the value, or -1 if not found */ indexOf(value: number): number; /** * Sets all matrix values to 0 */ reset(): void; /** * Get a new vector with extra 0 values appended to it * @param count Number of values to add (default: 1) * @return A new, larger Vector */ addValues(count?: number): Vector; /** * Get a copy of this vector * @return A new vector with the same values */ copy(): Vector; /** * Check if two vectors are equals, value by value * @param vec The vector against to check equality * @param threshold The maximum allowed difference between two values to still be considered equal (default: 0, i.e. exact equality) */ equals(vec: Vector, threshold?: number): boolean; /** * Negate all values of the vector (get the opposite sign) * @return A new vector whose all values have the opposed sign */ negate(): Vector; /** Get the length of the vector */ length(): number; /** Get the squared length of the vector */ squaredLength(): number; /** * Add all vector values with the same position value of the operand vector * @param vector The operand vector * @throws Error if the two vectors don't have the same dimension * @return a new Vector with the result values */ add(vector: Vector): Vector; /** * subtract all vector values with the same position value of the operand vector * @param vector The operand vector * @throws Error if the two vectors don't have the same dimension * @return a new Vector with the result values */ subtract(vector: Vector): Vector; /** * Multiply all vector values with the same position value of the operand vector * @param vector The operand vector * @throws Error if the two vectors don't have the same dimension * @return a new Vector with the result values */ multiply(vector: Vector): Vector; /** * Divide all vector values with the same position value of the operand vector * Be aware of divisions by 0! * @param vector The operand vector * @throws Error if the two vectors don't have the same dimension * @return a new Vector with the result values */ divide(vector: Vector): Vector; /** * Computes the product of this vector with a matrix (vector * matrix) * The vector is treated as a row vector * @param matrix The matrix to multiply with * @throws Error if vector.rows != matrix.rows * @return A new Vector, result of the multiplication */ multiplyMatrix(matrix: Matrix): Vector; /** * Computes the maximum value of the vector * @return The maximum value * @throws Error if the vector is empty */ max(): number; /** * Computes the minimum value of the vector * @return The minimum value * @throws Error if the vector is empty */ min(): number; /** * Rounds all vector values to the nearest integer * @return A new vector with the rounded values * @throws Error if the vector is empty */ round(): Vector; /** * Multiply all vector values by the given number * @param scale The number to multiply with the values */ scale(scale: number): Vector; /** * Run a function on all vector values, as a map. * @param operation The mapping method * @return a new Vector with the operation done on all its values */ private operateOnAllValues; /** * Computes the normalized vector * @return The normalized vector, or a zero vector if this vector has a length of 0 */ normalize(): Vector; /** * Computes the dot product of vectors * @param vector The operand vector */ dot(vector: Vector): number; /** * Computes the cross product of vectors * @param vector The operand vector */ cross(vector: Vector): Vector; mix(vector: Vector, time: number): Vector; /** * Calculates the signed angle in radians between two 3D vectors. * @param Va First vector * @param Vb Second vector * @return A signed angle between -π and +π */ static signedAngle(Va: Vector, Vb: Vector): number; toString(): string; } //# sourceMappingURL=Vector.d.ts.map