arcade-physics
Version:
Use Arcade Physics without Phaser.
384 lines • 12 kB
TypeScript
export default Quaternion;
/**
* @classdesc
* A quaternion.
*
* @class Quaternion
* @memberof Phaser.Math
* @constructor
* @since 3.0.0
*
* @param {number} [x=0] - The x component.
* @param {number} [y=0] - The y component.
* @param {number} [z=0] - The z component.
* @param {number} [w=1] - The w component.
*/
declare class Quaternion {
constructor(x: any, y: any, z: any, w: any);
/**
* The x component of this Quaternion.
*
* @name Phaser.Math.Quaternion#_x
* @type {number}
* @default 0
* @private
* @since 3.50.0
*/
/**
* The y component of this Quaternion.
*
* @name Phaser.Math.Quaternion#_y
* @type {number}
* @default 0
* @private
* @since 3.50.0
*/
/**
* The z component of this Quaternion.
*
* @name Phaser.Math.Quaternion#_z
* @type {number}
* @default 0
* @private
* @since 3.50.0
*/
/**
* The w component of this Quaternion.
*
* @name Phaser.Math.Quaternion#_w
* @type {number}
* @default 0
* @private
* @since 3.50.0
*/
/**
* This callback is invoked, if set, each time a value in this quaternion is changed.
* The callback is passed one argument, a reference to this quaternion.
*
* @name Phaser.Math.Quaternion#onChangeCallback
* @type {function}
* @since 3.50.0
*/
onChangeCallback: Function;
set x(arg: number);
/**
* The x component of this Quaternion.
*
* @name Phaser.Math.Quaternion#x
* @type {number}
* @default 0
* @since 3.0.0
*/
get x(): number;
_x: any;
set y(arg: number);
/**
* The y component of this Quaternion.
*
* @name Phaser.Math.Quaternion#y
* @type {number}
* @default 0
* @since 3.0.0
*/
get y(): number;
_y: any;
set z(arg: number);
/**
* The z component of this Quaternion.
*
* @name Phaser.Math.Quaternion#z
* @type {number}
* @default 0
* @since 3.0.0
*/
get z(): number;
_z: any;
set w(arg: number);
/**
* The w component of this Quaternion.
*
* @name Phaser.Math.Quaternion#w
* @type {number}
* @default 0
* @since 3.0.0
*/
get w(): number;
_w: any;
/**
* Copy the components of a given Quaternion or Vector into this Quaternion.
*
* @method Phaser.Math.Quaternion#copy
* @since 3.0.0
*
* @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} src - The Quaternion or Vector to copy the components from.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
copy(src: (Phaser.Math.Quaternion | Phaser.Math.Vector4)): Phaser.Math.Quaternion;
/**
* Set the components of this Quaternion and optionally call the `onChangeCallback`.
*
* @method Phaser.Math.Quaternion#set
* @since 3.0.0
*
* @param {(number|object)} [x=0] - The x component, or an object containing x, y, z, and w components.
* @param {number} [y=0] - The y component.
* @param {number} [z=0] - The z component.
* @param {number} [w=0] - The w component.
* @param {boolean} [update=true] - Call the `onChangeCallback`?
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
set(x?: (number | object), y?: number | undefined, z?: number | undefined, w?: number | undefined, update?: boolean | undefined): Phaser.Math.Quaternion;
/**
* Add a given Quaternion or Vector to this Quaternion. Addition is component-wise.
*
* @method Phaser.Math.Quaternion#add
* @since 3.0.0
*
* @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to add to this Quaternion.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
add(v: (Phaser.Math.Quaternion | Phaser.Math.Vector4)): Phaser.Math.Quaternion;
/**
* Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise.
*
* @method Phaser.Math.Quaternion#subtract
* @since 3.0.0
*
* @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to subtract from this Quaternion.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
subtract(v: (Phaser.Math.Quaternion | Phaser.Math.Vector4)): Phaser.Math.Quaternion;
/**
* Scale this Quaternion by the given value.
*
* @method Phaser.Math.Quaternion#scale
* @since 3.0.0
*
* @param {number} scale - The value to scale this Quaternion by.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
scale(scale: number): Phaser.Math.Quaternion;
/**
* Calculate the length of this Quaternion.
*
* @method Phaser.Math.Quaternion#length
* @since 3.0.0
*
* @return {number} The length of this Quaternion.
*/
length(): number;
/**
* Calculate the length of this Quaternion squared.
*
* @method Phaser.Math.Quaternion#lengthSq
* @since 3.0.0
*
* @return {number} The length of this Quaternion, squared.
*/
lengthSq(): number;
/**
* Normalize this Quaternion.
*
* @method Phaser.Math.Quaternion#normalize
* @since 3.0.0
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
normalize(): Phaser.Math.Quaternion;
/**
* Calculate the dot product of this Quaternion and the given Quaternion or Vector.
*
* @method Phaser.Math.Quaternion#dot
* @since 3.0.0
*
* @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to dot product with this Quaternion.
*
* @return {number} The dot product of this Quaternion and the given Quaternion or Vector.
*/
dot(v: (Phaser.Math.Quaternion | Phaser.Math.Vector4)): number;
/**
* Linearly interpolate this Quaternion towards the given Quaternion or Vector.
*
* @method Phaser.Math.Quaternion#lerp
* @since 3.0.0
*
* @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to interpolate towards.
* @param {number} [t=0] - The percentage of interpolation.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
lerp(v: (Phaser.Math.Quaternion | Phaser.Math.Vector4), t?: number | undefined): Phaser.Math.Quaternion;
/**
* Rotates this Quaternion based on the two given vectors.
*
* @method Phaser.Math.Quaternion#rotationTo
* @since 3.0.0
*
* @param {Phaser.Math.Vector3} a - The transform rotation vector.
* @param {Phaser.Math.Vector3} b - The target rotation vector.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
rotationTo(a: Phaser.Math.Vector3, b: Phaser.Math.Vector3): Phaser.Math.Quaternion;
/**
* Set the axes of this Quaternion.
*
* @method Phaser.Math.Quaternion#setAxes
* @since 3.0.0
*
* @param {Phaser.Math.Vector3} view - The view axis.
* @param {Phaser.Math.Vector3} right - The right axis.
* @param {Phaser.Math.Vector3} up - The upwards axis.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
setAxes(view: Phaser.Math.Vector3, right: Phaser.Math.Vector3, up: Phaser.Math.Vector3): Phaser.Math.Quaternion;
/**
* Reset this Matrix to an identity (default) Quaternion.
*
* @method Phaser.Math.Quaternion#identity
* @since 3.0.0
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
identity(): Phaser.Math.Quaternion;
/**
* Set the axis angle of this Quaternion.
*
* @method Phaser.Math.Quaternion#setAxisAngle
* @since 3.0.0
*
* @param {Phaser.Math.Vector3} axis - The axis.
* @param {number} rad - The angle in radians.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
setAxisAngle(axis: Phaser.Math.Vector3, rad: number): Phaser.Math.Quaternion;
/**
* Multiply this Quaternion by the given Quaternion or Vector.
*
* @method Phaser.Math.Quaternion#multiply
* @since 3.0.0
*
* @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to multiply this Quaternion by.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
multiply(b: (Phaser.Math.Quaternion | Phaser.Math.Vector4)): Phaser.Math.Quaternion;
/**
* Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector.
*
* @method Phaser.Math.Quaternion#slerp
* @since 3.0.0
*
* @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to interpolate towards.
* @param {number} t - The percentage of interpolation.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
slerp(b: (Phaser.Math.Quaternion | Phaser.Math.Vector4), t: number): Phaser.Math.Quaternion;
/**
* Invert this Quaternion.
*
* @method Phaser.Math.Quaternion#invert
* @since 3.0.0
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
invert(): Phaser.Math.Quaternion;
/**
* Convert this Quaternion into its conjugate.
*
* Sets the x, y and z components.
*
* @method Phaser.Math.Quaternion#conjugate
* @since 3.0.0
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
conjugate(): Phaser.Math.Quaternion;
/**
* Rotate this Quaternion on the X axis.
*
* @method Phaser.Math.Quaternion#rotateX
* @since 3.0.0
*
* @param {number} rad - The rotation angle in radians.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
rotateX(rad: number): Phaser.Math.Quaternion;
/**
* Rotate this Quaternion on the Y axis.
*
* @method Phaser.Math.Quaternion#rotateY
* @since 3.0.0
*
* @param {number} rad - The rotation angle in radians.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
rotateY(rad: number): Phaser.Math.Quaternion;
/**
* Rotate this Quaternion on the Z axis.
*
* @method Phaser.Math.Quaternion#rotateZ
* @since 3.0.0
*
* @param {number} rad - The rotation angle in radians.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
rotateZ(rad: number): Phaser.Math.Quaternion;
/**
* Create a unit (or rotation) Quaternion from its x, y, and z components.
*
* Sets the w component.
*
* @method Phaser.Math.Quaternion#calculateW
* @since 3.0.0
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
calculateW(): Phaser.Math.Quaternion;
/**
* Set this Quaternion from the given Euler, based on Euler order.
*
* @method Phaser.Math.Quaternion#setFromEuler
* @since 3.50.0
*
* @param {Phaser.Math.Euler} euler - The Euler to convert from.
* @param {boolean} [update=true] - Run the `onChangeCallback`?
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
setFromEuler(euler: Phaser.Math.Euler, update?: boolean | undefined): Phaser.Math.Quaternion;
/**
* Sets the rotation of this Quaternion from the given Matrix4.
*
* @method Phaser.Math.Quaternion#setFromRotationMatrix
* @since 3.50.0
*
* @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to set the rotation from.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
setFromRotationMatrix(mat4: Phaser.Math.Matrix4): Phaser.Math.Quaternion;
/**
* Convert the given Matrix into this Quaternion.
*
* @method Phaser.Math.Quaternion#fromMat3
* @since 3.0.0
*
* @param {Phaser.Math.Matrix3} mat - The Matrix to convert from.
*
* @return {Phaser.Math.Quaternion} This Quaternion.
*/
fromMat3(mat: Phaser.Math.Matrix3): Phaser.Math.Quaternion;
}
//# sourceMappingURL=Quaternion.d.ts.map