import * as vec4 from '../glmatrix/vec4'; import type Quaternion from './Quaternion'; import type Matrix4 from './Matrix4'; /** * @constructor * @alias clay.Vector4 * @param x * @param y * @param z * @param w */ declare class Vector4 { /** * Storage of Vector4, read and write of x, y, z, w will change the values in array * All methods also operate on the array instead of x, y, z, w components * @name array * @type {Float32Array} * @memberOf clay.Vector4# */ array: vec4.Vec4Array; constructor(x: number, y: number, z: number, w: number); get x(): number; set x(value: number); get y(): number; set y(value: number); get z(): number; set z(value: number); get w(): number; set w(value: number); /** * Add b to self * @param b */ add(b: Vector4): this; /** * Set x, y and z components * @param x * @param y * @param z * @param w */ set(x: number, y: number, z: number, w: number): this; /** * Set x, y, z and w components from array * @param from */ setArray(from: vec4.Vec4Array): this; /** * Clone a new Vector4 */ clone(): Vector4; /** * Copy from b * @param b */ copy(b: Vector4): this; /** * Alias for distance * @param b */ dist(b: Vector4): number; /** * Distance between self and b * @param b */ distance(b: Vector4): number; /** * Alias for divide * @param b */ div(b: Vector4): this; /** * Divide self by b * @param b */ divide(b: Vector4): this; /** * Dot product of self and b * @param b */ dot(b: Vector4): number; /** * Alias of length */ len(): number; /** * Calculate the length */ length(): number; /** * Linear interpolation between a and b * @param a * @param b * @param t */ lerp(a: Vector4, b: Vector4, t: number): this; /** * Minimum of self and b * @param b */ min(b: Vector4): this; /** * Maximum of self and b * @param b */ max(b: Vector4): this; /** * Alias for multiply * @param b */ mul(b: Vector4): this; /** * Mutiply self and b * @param b */ multiply(b: Vector4): this; /** * Negate self */ negate(): this; /** * Normalize self */ normalize(): this; /** * Generate random x, y, z, w components with a given scale * @param scale */ random(scale: number): this; /** * Scale self * @param scale */ scale(s: number): this; /** * Scale b and add to self * @param b * @param scale */ scaleAndAdd(b: Vector4, s: number): this; /** * Alias for squaredDistance * @param b */ sqrDist(b: Vector4): number; /** * Squared distance between self and b * @param b */ squaredDistance(b: Vector4): number; /** * Alias for squaredLength */ sqrLen(): number; /** * Squared length of self */ squaredLength(): number; /** * Alias for subtract * @param b */ sub(b: Vector4): this; /** * Subtract b from self * @param b */ subtract(b: Vector4): this; /** * Transform self with a Matrix4 m * @param {clay.Matrix4} m */ transformMat4(m: Matrix4): this; /** * Transform self with a Quaternion q * @param {clay.Quaternion} q */ transformQuat(q: Quaternion): this; toString(): string; toArray(): vec4.Vec4Array; /** * @param out * @param a * @param b */ static add(out: Vector4, a: Vector4, b: Vector4): Vector4; /** * @param out * @param x * @param y * @param z */ static set(out: Vector4, x: number, y: number, z: number, w: number): void; /** * @param out * @param b */ static copy(out: Vector4, b: Vector4): Vector4; /** * @param a * @param b */ static dist(a: Vector4, b: Vector4): number; /** * @function * @param a * @param b */ static distance: typeof Vector4.dist; /** * @param out * @param a * @param b */ static div(out: Vector4, a: Vector4, b: Vector4): Vector4; /** * @function * @param out * @param a * @param b */ static divide: typeof Vector4.div; /** * @param a * @param b */ static dot(a: Vector4, b: Vector4): number; /** * @param a */ static len(b: Vector4): number; /** * @param out * @param a * @param b * @param t */ static lerp(out: Vector4, a: Vector4, b: Vector4, t: number): Vector4; /** * @param out * @param a * @param b */ static min(out: Vector4, a: Vector4, b: Vector4): Vector4; /** * @param out * @param a * @param b */ static max(out: Vector4, a: Vector4, b: Vector4): Vector4; /** * @param out * @param a * @param b */ static mul(out: Vector4, a: Vector4, b: Vector4): Vector4; /** * @function * @param out * @param a * @param b */ static multiply: typeof Vector4.mul; /** * @param out * @param a */ static negate(out: Vector4, a: Vector4): Vector4; /** * @param out * @param a */ static normalize(out: Vector4, a: Vector4): Vector4; /** * @param out * @param scale */ static random(out: Vector4, scale: number): Vector4; /** * @param out * @param a * @param scale */ static scale(out: Vector4, a: Vector4, scale: number): Vector4; /** * @param out * @param a * @param b * @param scale */ static scaleAndAdd(out: Vector4, a: Vector4, b: Vector4, scale: number): Vector4; /** * @param a * @param b */ static sqrDist(a: Vector4, b: Vector4): number; /** * @function * @param a * @param b */ static squaredDistance: typeof Vector4.sqrDist; /** * @param a */ static sqrLen(a: Vector4): number; /** * @function * @param a */ static squaredLength: typeof Vector4.sqrLen; /** * @param out * @param a * @param b */ static sub(out: Vector4, a: Vector4, b: Vector4): Vector4; /** * @function * @param out * @param a * @param b */ static subtract: typeof Vector4.sub; /** * @param out * @param a * @param m */ static transformMat4(out: Vector4, a: Vector4, m: Matrix4): Vector4; /** * @param out * @param a * @param q */ static transformQuat(out: Vector4, a: Vector4, q: Quaternion): Vector4; } export default Vector4;