-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
/
Copy pathQuaternion.d.ts
157 lines (132 loc) · 4.21 KB
/
Quaternion.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import { Euler } from './Euler';
import { Vector3 } from './Vector3';
import { Matrix4 } from './Matrix4';
/**
* Implementation of a quaternion. This is used for rotating things without incurring in the dreaded gimbal lock issue, amongst other advantages.
*
* @example
* var quaternion = new THREE.Quaternion();
* quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 );
* var vector = new THREE.Vector3( 1, 0, 0 );
* vector.applyQuaternion( quaternion );
*/
export class Quaternion {
/**
* @param x x coordinate
* @param y y coordinate
* @param z z coordinate
* @param w w coordinate
*/
constructor( x?: number, y?: number, z?: number, w?: number );
x: number;
y: number;
z: number;
w: number;
readonly isQuaternion: true;
/**
* Sets values of this quaternion.
*/
set( x: number, y: number, z: number, w: number ): Quaternion;
/**
* Clones this quaternion.
*/
clone(): this;
/**
* Copies values of q to this quaternion.
*/
copy( q: Quaternion ): this;
/**
* Sets this quaternion from rotation specified by Euler angles.
*/
setFromEuler( euler: Euler ): Quaternion;
/**
* Sets this quaternion from rotation specified by axis and angle.
* Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm.
* Axis have to be normalized, angle is in radians.
*/
setFromAxisAngle( axis: Vector3, angle: number ): Quaternion;
/**
* Sets this quaternion from rotation component of m. Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm.
*/
setFromRotationMatrix( m: Matrix4 ): Quaternion;
setFromUnitVectors( vFrom: Vector3, vTo: Vector3 ): Quaternion;
angleTo( q: Quaternion ): number;
rotateTowards( q: Quaternion, step: number ): Quaternion;
/**
* Inverts this quaternion.
*/
inverse(): Quaternion;
conjugate(): Quaternion;
dot( v: Quaternion ): number;
lengthSq(): number;
/**
* Computes length of this quaternion.
*/
length(): number;
/**
* Normalizes this quaternion.
*/
normalize(): Quaternion;
/**
* Multiplies this quaternion by b.
*/
multiply( q: Quaternion ): Quaternion;
premultiply( q: Quaternion ): Quaternion;
/**
* Sets this quaternion to a x b
* Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm.
*/
multiplyQuaternions( a: Quaternion, b: Quaternion ): Quaternion;
slerp( qb: Quaternion, t: number ): Quaternion;
equals( v: Quaternion ): boolean;
/**
* Sets this quaternion's x, y, z and w value from the provided array.
* @param array the source array.
* @param offset (optional) offset into the array. Default is 0.
*/
fromArray( array: number[], offset?: number ): this;
/**
* Sets this quaternion's x, y, z and w value from the provided array-like.
* @param array the source array-like.
* @param offset (optional) offset into the array-like. Default is 0.
*/
fromArray( array: ArrayLike<number>, offset?: number ): this;
/**
* Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.
* @param array (optional) array to store the quaternion to. If this is not provided, a new array will be created.
* @param offset (optional) optional offset into the array.
* @return The created or provided array.
*/
toArray( array?: number[], offset?: number ): number[];
/**
* Copies x, y, z and w into the provided array-like.
* @param array array-like to store the quaternion to.
* @param offset (optional) optional offset into the array.
* @return The provided array-like.
*/
toArray( array: ArrayLike<number>, offset?: number ): ArrayLike<number>;
_onChange( callback: Function ): Quaternion;
_onChangeCallback: Function;
/**
* Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/.
*/
static slerp(
qa: Quaternion,
qb: Quaternion,
qm: Quaternion,
t: number
): Quaternion;
static slerpFlat(
dst: number[],
dstOffset: number,
src0: number[],
srcOffset: number,
src1: number[],
stcOffset1: number,
t: number
): Quaternion;
/**
* @deprecated Use {@link Vector#applyQuaternion vector.applyQuaternion( quaternion )} instead.
*/
multiplyVector3( v: any ): any;
}