ts-scikit
Version:
A scientific toolkit written in Typescript
105 lines (104 loc) • 3.04 kB
TypeScript
import { Tuple4 } from './tuple4';
/**
* A vector with 4 components: x, y, and z.
*/
export declare class Vector4 extends Tuple4 {
/**
* Constructs a new vector with three components.
* @param x the x-component.
* @param y the y-component.
* @param z the z-component.
* @param w the w-component.
*/
constructor(x: number, y: number, z: number, w: number);
/**
* The length of this vector.
* @returns the length of this vector.
*/
get length(): number;
/**
* The length of this vector, squared.
* @returns the length of this vector, squared.
*/
get lengthSquared(): number;
/**
* Computes the negation -u of this vector u.
* @returns the negation.
*/
negate(): Vector4;
/**
* Sets this vector to its negation.
* @returns a reference to this vector.
*/
negateEquals(): this;
/**
* Computes the unit vector with the same direction as this vector.
* @returns the unit vector.
*/
normalize(): Vector4;
/**
* Sets this vector to its unit vector.
* @returns a reference to this vector.
*/
normalizeEquals(): this;
/**
* Returns the vector sum u + v for this vector u
* @param v the other vector.
* @returns the vector sum u + v.
*/
plus(v: Vector4): Vector4;
/**
* Adds a vector v to this vector u.
* @param v the other vector.
* @returns a reference to this vector, after adding vector v.
*/
plusEquals(v: Vector4): this;
/**
* Returns the vector difference u - v for this vector u.
* @param v the other vector.
* @returns the vector difference u - v.
*/
minus(v: Vector4): Vector4;
minusEquals(v: Vector4): this;
/**
* Returns the scaled vector s * u for this vector u.
* @param s the scale factor.
* @returns the scaled vector.
*/
times(s: number): Vector4;
/**
* Scales this vector.
* @param s the scale factor.
* @returns a reference to this vector, after scaling.
*/
timesEquals(s: number): this;
/**
* Gets the angle between this and the provided vector.
* @param v the vector.
* @returns the angle (in radians) between the two vectors.
*/
angle(v: Vector4): number;
/**
* Computes the dot product of this vector and the specified vector v.
* @param v the vector v.
* @returns the dot product.
*/
dot(v: Vector4): number;
/**
* Returns the absolute of this vector.
* @returns the absolute of this vector.
*/
abs(): Vector4;
/**
* Computes the squared distance between this and a specified vector.
* @param v the vector.
* @returns the distance between the vectors, squared.
*/
distanceSquared(v: Vector4): number;
/**
* Computes the distance between this and a specified vector.
* @param v the vector.
* @returns the distance between the vectors.
*/
distance(v: Vector4): number;
}