/** * Structure for a vector in 3D space. */ export declare class Vec3 { readonly x: number; readonly y: number; readonly z: number; /** * The magnitude/length of the vector */ readonly r: number; /** * The angle of the vector in radians, measured from the x-axis */ readonly theta: number; /** * The angle of the vector in radians, measured from the xy-plane */ readonly phi: number; /** * Create a vector from cartesian coordinates * @param x The cartesian x-coordinate * @param y The cartesian y-coordinate * @param z The cartesian z-coordinate */ constructor(x: number, y: number, z?: number); /** * Create a vector from polar coordinates * @param r The magnitude/length of the vector * @param theta The angle of the vector in radians, measured from the x-axis * @param phi The angle of the vector in radians, measured from the xy-plane * @returns A vector created from polar coordinates */ static fromPolar(r: number, theta: number, phi?: number): Vec3; /** * Determine if two vectors are equal (or approximately equal) * @param other Arbitrary vector * @param tolerance Optional absolute tolerance * @returns `true` if v1 = v2 */ equals(other: Vec3, tolerance?: number): boolean; /** * Get a unit vector in this direction * @returns v1 (with length 1) */ unit(): Vec3; /** * Scale this vector by a numeric factor * @param factor Scaling factor * @returns A scaled vector */ scaleBy(factor: number): Vec3; /** * Add this vector and another vector * @param other Arbitrary vector * @returns v1 + v2 */ plus(other: Vec3): Vec3; /** * Subtract another vector from this vector * @param other Arbitrary vector * @returns v1 - v2 */ minus(other: Vec3): Vec3; /** * Compute the dot product between this vector and another vector * @param other Arbitrary vector * @returns v1 . v2 */ dot(other: Vec3): number; /** * Compute the cross product between this vector and another vector * @param other Arbitrary vector * @returns v1 x v2 */ cross(other: Vec3): Vec3; /** * Project this vector onto another vector * @param other Arbitrary vector * @returns proj_v2(v1) */ projectOnto(other: Vec3): Vec3; }