ts-scikit
Version:
A scientific toolkit written in Typescript
92 lines (91 loc) • 2.62 kB
TypeScript
import { Tuple3 } from './tuple3';
/**
* A vector with 3 components: x, y, and z.
*/
export declare class Vector3 extends Tuple3 {
/**
* Constructs a new vector with three components.
* @param x the x-component.
* @param y the y-component.
* @param z the z-component.
*/
constructor(x: number, y: number, z: 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(): Vector3;
/**
* 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(): Vector3;
/**
* 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: Vector3): Vector3;
/**
* 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: Vector3): this;
/**
* Returns the vector difference u - v for this vector u.
* @param v the other vector.
* @returns the vector difference u - v.
*/
minus(v: Vector3): Vector3;
/**
* Subtracts a vector v from this vector u.
* @param v the other vector.
* @returns a reference to this vector, after subtracting vector v.
*/
minusEquals(v: Vector3): this;
/**
* Returns the scaled vector s * u for this vector u.
* @param s the scale factor.
* @returns the scaled vector.
*/
times(s: number): Vector3;
/**
* Scales this vector.
* @param s the scale factor.
* @returns a reference to this vector, after scaling.
*/
timesEquals(s: number): this;
/**
* Computes the dot product of this vector and the specified vector v.
* @param v the vector v.
* @returns the dot product.
*/
dot(v: Vector3): number;
/**
* Computes the cross product of this vector and the speficied vector v.
* @param v the vector v.
* @returns the cross product.
*/
cross(v: Vector3): Vector3;
}