UNPKG

arcade-physics

Version:
286 lines 9.43 kB
export default Vector4; /** * @classdesc * A representation of a vector in 4D space. * * A four-component vector. * * @class Vector4 * @memberof Phaser.Math * @constructor * @since 3.0.0 * * @param {number} [x] - The x component. * @param {number} [y] - The y component. * @param {number} [z] - The z component. * @param {number} [w] - The w component. */ declare class Vector4 { constructor(x: any, y: any, z: any, w: any); /** * The x component of this Vector. * * @name Phaser.Math.Vector4#x * @type {number} * @default 0 * @since 3.0.0 */ x: number; /** * The y component of this Vector. * * @name Phaser.Math.Vector4#y * @type {number} * @default 0 * @since 3.0.0 */ y: number; /** * The z component of this Vector. * * @name Phaser.Math.Vector4#z * @type {number} * @default 0 * @since 3.0.0 */ z: number; /** * The w component of this Vector. * * @name Phaser.Math.Vector4#w * @type {number} * @default 0 * @since 3.0.0 */ w: number; /** * Make a clone of this Vector4. * * @method Phaser.Math.Vector4#clone * @since 3.0.0 * * @return {Phaser.Math.Vector4} A clone of this Vector4. */ clone(): Phaser.Math.Vector4; /** * Copy the components of a given Vector into this Vector. * * @method Phaser.Math.Vector4#copy * @since 3.0.0 * * @param {Phaser.Math.Vector4} src - The Vector to copy the components from. * * @return {Phaser.Math.Vector4} This Vector4. */ copy(src: Phaser.Math.Vector4): Phaser.Math.Vector4; /** * Check whether this Vector is equal to a given Vector. * * Performs a strict quality check against each Vector's components. * * @method Phaser.Math.Vector4#equals * @since 3.0.0 * * @param {Phaser.Math.Vector4} v - The vector to check equality with. * * @return {boolean} A boolean indicating whether the two Vectors are equal or not. */ equals(v: Phaser.Math.Vector4): boolean; /** * Set the `x`, `y`, `z` and `w` components of the this Vector to the given `x`, `y`, `z` and `w` values. * * @method Phaser.Math.Vector4#set * @since 3.0.0 * * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y, z and w components. * @param {number} y - The y value to set for this Vector. * @param {number} z - The z value to set for this Vector. * @param {number} w - The z value to set for this Vector. * * @return {Phaser.Math.Vector4} This Vector4. */ set(x: (number | object), y: number, z: number, w: number): Phaser.Math.Vector4; /** * Add a given Vector to this Vector. Addition is component-wise. * * @method Phaser.Math.Vector4#add * @since 3.0.0 * * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to add to this Vector. * * @return {Phaser.Math.Vector4} This Vector4. */ add(v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)): Phaser.Math.Vector4; /** * Subtract the given Vector from this Vector. Subtraction is component-wise. * * @method Phaser.Math.Vector4#subtract * @since 3.0.0 * * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to subtract from this Vector. * * @return {Phaser.Math.Vector4} This Vector4. */ subtract(v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)): Phaser.Math.Vector4; /** * Scale this Vector by the given value. * * @method Phaser.Math.Vector4#scale * @since 3.0.0 * * @param {number} scale - The value to scale this Vector by. * * @return {Phaser.Math.Vector4} This Vector4. */ scale(scale: number): Phaser.Math.Vector4; /** * Calculate the length (or magnitude) of this Vector. * * @method Phaser.Math.Vector4#length * @since 3.0.0 * * @return {number} The length of this Vector. */ length(): number; /** * Calculate the length of this Vector squared. * * @method Phaser.Math.Vector4#lengthSq * @since 3.0.0 * * @return {number} The length of this Vector, squared. */ lengthSq(): number; /** * Normalize this Vector. * * Makes the vector a unit length vector (magnitude of 1) in the same direction. * * @method Phaser.Math.Vector4#normalize * @since 3.0.0 * * @return {Phaser.Math.Vector4} This Vector4. */ normalize(): Phaser.Math.Vector4; /** * Calculate the dot product of this Vector and the given Vector. * * @method Phaser.Math.Vector4#dot * @since 3.0.0 * * @param {Phaser.Math.Vector4} v - The Vector4 to dot product with this Vector4. * * @return {number} The dot product of this Vector and the given Vector. */ dot(v: Phaser.Math.Vector4): number; /** * Linearly interpolate between this Vector and the given Vector. * * Interpolates this Vector towards the given Vector. * * @method Phaser.Math.Vector4#lerp * @since 3.0.0 * * @param {Phaser.Math.Vector4} v - The Vector4 to interpolate towards. * @param {number} [t=0] - The interpolation percentage, between 0 and 1. * * @return {Phaser.Math.Vector4} This Vector4. */ lerp(v: Phaser.Math.Vector4, t?: number | undefined): Phaser.Math.Vector4; /** * Perform a component-wise multiplication between this Vector and the given Vector. * * Multiplies this Vector by the given Vector. * * @method Phaser.Math.Vector4#multiply * @since 3.0.0 * * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to multiply this Vector by. * * @return {Phaser.Math.Vector4} This Vector4. */ multiply(v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)): Phaser.Math.Vector4; /** * Perform a component-wise division between this Vector and the given Vector. * * Divides this Vector by the given Vector. * * @method Phaser.Math.Vector4#divide * @since 3.0.0 * * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to divide this Vector by. * * @return {Phaser.Math.Vector4} This Vector4. */ divide(v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)): Phaser.Math.Vector4; /** * Calculate the distance between this Vector and the given Vector. * * @method Phaser.Math.Vector4#distance * @since 3.0.0 * * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. * * @return {number} The distance from this Vector to the given Vector. */ distance(v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)): number; /** * Calculate the distance between this Vector and the given Vector, squared. * * @method Phaser.Math.Vector4#distanceSq * @since 3.0.0 * * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. * * @return {number} The distance from this Vector to the given Vector, squared. */ distanceSq(v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)): number; /** * Negate the `x`, `y`, `z` and `w` components of this Vector. * * @method Phaser.Math.Vector4#negate * @since 3.0.0 * * @return {Phaser.Math.Vector4} This Vector4. */ negate(): Phaser.Math.Vector4; /** * Transform this Vector with the given Matrix. * * @method Phaser.Math.Vector4#transformMat4 * @since 3.0.0 * * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector4 with. * * @return {Phaser.Math.Vector4} This Vector4. */ transformMat4(mat: Phaser.Math.Matrix4): Phaser.Math.Vector4; /** * Transform this Vector with the given Quaternion. * * @method Phaser.Math.Vector4#transformQuat * @since 3.0.0 * * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. * * @return {Phaser.Math.Vector4} This Vector4. */ transformQuat(q: Phaser.Math.Quaternion): Phaser.Math.Vector4; /** * Make this Vector the zero vector (0, 0, 0, 0). * * @method Phaser.Math.Vector4#reset * @since 3.0.0 * * @return {Phaser.Math.Vector4} This Vector4. */ reset(): Phaser.Math.Vector4; sub: (v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)) => Phaser.Math.Vector4; mul: (v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)) => Phaser.Math.Vector4; div: (v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)) => Phaser.Math.Vector4; dist: (v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)) => number; distSq: (v: (Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4)) => number; len: () => number; lenSq: () => number; } //# sourceMappingURL=Vector4.d.ts.map