import * as vec3 from '../glmatrix/vec3'; import type Matrix3 from './Matrix3'; import type Matrix4 from './Matrix4'; import type Quaternion from './Quaternion'; export type RotateOrder = 'XYZ' | 'YXZ' | 'ZXY' | 'ZYX' | 'YZX' | 'XZY'; /** * @constructor * @alias clay.Vector3 * @param {number} x * @param {number} y * @param {number} z */ declare class Vector3 { /** * Storage of Vector3, read and write of x, y, z will change the values in array * All methods also operate on the array instead of x, y, z components */ array: vec3.Vec3Array; constructor(x?: number, y?: number, z?: number); get x(): number; set x(value: number); get y(): number; set y(value: number); get z(): number; set z(value: number); /** * Add b to self * @param {clay.Vector3} b * @return {clay.Vector3} */ add(b: Vector3): this; /** * Set x, y and z components * @param {number} x * @param {number} y * @param {number} z * @return {clay.Vector3} */ set(x: number, y: number, z: number): this; /** * Set x, y and z components from array * @param {Float32Array|number[]} arr * @return {clay.Vector3} */ setArray(arr: number[]): this; /** * Clone a new Vector3 * @return {clay.Vector3} */ clone(): Vector3; /** * Copy from b * @param {clay.Vector3} b * @return {clay.Vector3} */ copy(b: Vector3): this; /** * Cross product of self and b, written to a Vector3 out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ cross(a: Vector3, b: Vector3): this; /** * Alias for distance * @param {clay.Vector3} b * @return {number} */ dist(b: Vector3): number; /** * Distance between self and b * @param {clay.Vector3} b * @return {number} */ distance(b: Vector3): number; /** * Alias for divide * @param {clay.Vector3} b * @return {clay.Vector3} */ div(b: Vector3): this; /** * Divide self by b * @param {clay.Vector3} b * @return {clay.Vector3} */ divide(b: Vector3): this; /** * Dot product of self and b * @param {clay.Vector3} b * @return {number} */ dot(b: Vector3): number; /** * Alias of length * @return {number} */ len(): number; /** * Calculate the length * @return {number} */ length(): number; /** * Linear interpolation between a and b * @param {clay.Vector3} a * @param {clay.Vector3} b * @param {number} t * @return {clay.Vector3} */ lerp(a: Vector3, b: Vector3, t: number): this; /** * Minimum of self and b * @param {clay.Vector3} b * @return {clay.Vector3} */ min(b: Vector3): this; /** * Maximum of self and b * @param {clay.Vector3} b * @return {clay.Vector3} */ max(b: Vector3): this; /** * Alias for multiply * @param {clay.Vector3} b * @return {clay.Vector3} */ mul(b: Vector3): this; /** * Mutiply self and b * @param {clay.Vector3} b * @return {clay.Vector3} */ multiply(b: Vector3): this; /** * Negate self * @return {clay.Vector3} */ negate(): this; /** * Normalize self * @return {clay.Vector3} */ normalize(): this; /** * Generate random x, y, z components with a given scale * @param {number} scale * @return {clay.Vector3} */ random(scale: number): this; /** * Scale self * @param {number} scale * @return {clay.Vector3} */ scale(s: number): this; /** * Scale b and add to self * @param {clay.Vector3} b * @param {number} scale * @return {clay.Vector3} */ scaleAndAdd(b: Vector3, s: number): this; /** * Alias for squaredDistance * @param {clay.Vector3} b * @return {number} */ sqrDist(b: Vector3): number; /** * Squared distance between self and b * @param {clay.Vector3} b * @return {number} */ squaredDistance(b: Vector3): number; /** * Alias for squaredLength * @return {number} */ sqrLen(): number; /** * Squared length of self * @return {number} */ squaredLength(): number; /** * Alias for subtract * @param {clay.Vector3} b * @return {clay.Vector3} */ sub(b: Vector3): this; /** * Subtract b from self * @param {clay.Vector3} b * @return {clay.Vector3} */ subtract(b: Vector3): this; /** * Transform self with a Matrix3 m * @param {clay.Matrix3} m * @return {clay.Vector3} */ transformMat3(m: Matrix3): this; /** * Transform self with a Matrix4 m * @param {clay.Matrix4} m * @return {clay.Vector3} */ transformMat4(m: Matrix4): this; /** * Transform self with a Quaternion q * @param {clay.Quaternion} q * @return {clay.Vector3} */ transformQuat(q: Quaternion): this; /** * Trasnform self into projection space with m * @param {clay.Matrix4} m * @return {clay.Vector3} */ applyProjection(m: Matrix4): this; eulerFromQuat(q: Quaternion, order: RotateOrder): Vector3; eulerFromMat3(m: Matrix3, order: RotateOrder): Vector3; toString(): string; toArray(): vec3.Vec3Array; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ static add(out: Vector3, a: Vector3, b: Vector3): Vector3; /** * @param {clay.Vector3} out * @param {number} x * @param {number} y * @param {number} z * @return {clay.Vector3} */ static set(out: Vector3, x: number, y: number, z: number): void; /** * @param {clay.Vector3} out * @param {clay.Vector3} b * @return {clay.Vector3} */ static copy(out: Vector3, b: Vector3): Vector3; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ static cross(out: Vector3, a: Vector3, b: Vector3): Vector3; /** * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {number} */ static dist(a: Vector3, b: Vector3): number; /** * @function * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {number} */ static distance: typeof Vector3.dist; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ static div(out: Vector3, a: Vector3, b: Vector3): Vector3; /** * @function * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ static divide: typeof Vector3.div; /** * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {number} */ static dot(a: Vector3, b: Vector3): number; /** * @param {clay.Vector3} a * @return {number} */ static len(b: Vector3): number; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @param {number} t * @return {clay.Vector3} */ static lerp(out: Vector3, a: Vector3, b: Vector3, t: number): Vector3; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ static min(out: Vector3, a: Vector3, b: Vector3): Vector3; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ static max(out: Vector3, a: Vector3, b: Vector3): Vector3; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ static mul(out: Vector3, a: Vector3, b: Vector3): Vector3; /** * @function * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ static multiply: typeof Vector3.mul; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @return {clay.Vector3} */ static negate(out: Vector3, a: Vector3): Vector3; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @return {clay.Vector3} */ static normalize(out: Vector3, a: Vector3): Vector3; /** * @param {clay.Vector3} out * @param {number} scale * @return {clay.Vector3} */ static random(out: Vector3, scale: number): Vector3; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {number} scale * @return {clay.Vector3} */ static scale(out: Vector3, a: Vector3, scale: number): Vector3; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @param {number} scale * @return {clay.Vector3} */ static scaleAndAdd(out: Vector3, a: Vector3, b: Vector3, scale: number): Vector3; /** * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {number} */ static sqrDist(a: Vector3, b: Vector3): number; /** * @function * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {number} */ static squaredDistance: typeof Vector3.sqrDist; /** * @param {clay.Vector3} a * @return {number} */ static sqrLen(a: Vector3): number; /** * @function * @param {clay.Vector3} a * @return {number} */ static squaredLength: typeof Vector3.sqrLen; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ static sub(out: Vector3, a: Vector3, b: Vector3): Vector3; /** * @function * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Vector3} b * @return {clay.Vector3} */ static subtract: typeof Vector3.sub; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {Matrix3} m * @return {clay.Vector3} */ static transformMat3(out: Vector3, a: Vector3, m: Matrix3): Vector3; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Matrix4} m * @return {clay.Vector3} */ static transformMat4(out: Vector3, a: Vector3, m: Matrix4): Vector3; /** * @param {clay.Vector3} out * @param {clay.Vector3} a * @param {clay.Quaternion} q * @return {clay.Vector3} */ static transformQuat(out: Vector3, a: Vector3, q: Quaternion): Vector3; /** * Convert quaternion to euler angle * Quaternion must be normalized * From three.js */ static eulerFromQuat(out: Vector3, q: Quaternion, order: RotateOrder): Vector3; /** * Convert rotation matrix to euler angle * from three.js */ static eulerFromMat3(out: Vector3, m: Matrix3, order: RotateOrder): Vector3; /** * @type {clay.Vector3} * @readOnly * @memberOf clay.Vector3 */ static get POSITIVE_X(): Vector3; /** * @type {clay.Vector3} * @readOnly * @memberOf clay.Vector3 */ static get NEGATIVE_X(): Vector3; /** * @type {clay.Vector3} * @readOnly * @memberOf clay.Vector3 */ static get POSITIVE_Y(): Vector3; /** * @type {clay.Vector3} * @readOnly * @memberOf clay.Vector3 */ static get NEGATIVE_Y(): Vector3; /** * @type {clay.Vector3} * @readOnly * @memberOf clay.Vector3 */ static get POSITIVE_Z(): Vector3; /** * @type {clay.Vector3} * @readOnly */ static get NEGATIVE_Z(): Vector3; /** * @type {clay.Vector3} * @readOnly * @memberOf clay.Vector3 */ static get UP(): Vector3; /** * @type {clay.Vector3} * @readOnly * @memberOf clay.Vector3 */ static get ZERO(): Vector3; } export default Vector3;