@math.gl/core 3.6.3 → 4.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/dist/classes/base/math-array.d.ts +5 -4
  2. package/dist/classes/base/math-array.d.ts.map +1 -1
  3. package/dist/{esm/classes → classes}/base/math-array.js +8 -3
  4. package/dist/classes/base/math-array.js.map +1 -0
  5. package/dist/classes/base/matrix.d.ts +2 -2
  6. package/dist/classes/base/matrix.d.ts.map +1 -1
  7. package/dist/{esm/classes → classes}/base/matrix.js +4 -4
  8. package/dist/classes/base/matrix.js.map +1 -0
  9. package/dist/classes/base/vector.d.ts +2 -2
  10. package/dist/classes/base/vector.d.ts.map +1 -1
  11. package/dist/{esm/classes → classes}/base/vector.js +4 -4
  12. package/dist/classes/base/vector.js.map +1 -0
  13. package/dist/classes/euler.d.ts +4 -4
  14. package/dist/classes/euler.d.ts.map +1 -1
  15. package/dist/{esm/classes → classes}/euler.js +6 -6
  16. package/dist/classes/euler.js.map +1 -0
  17. package/dist/classes/matrix3.d.ts +5 -2
  18. package/dist/classes/matrix3.d.ts.map +1 -1
  19. package/dist/{esm/classes → classes}/matrix3.js +20 -20
  20. package/dist/classes/matrix3.js.map +1 -0
  21. package/dist/classes/matrix4.d.ts +2 -2
  22. package/dist/classes/matrix4.d.ts.map +1 -1
  23. package/dist/{esm/classes → classes}/matrix4.js +27 -27
  24. package/dist/classes/matrix4.js.map +1 -0
  25. package/dist/classes/pose.d.ts +4 -4
  26. package/dist/classes/pose.d.ts.map +1 -1
  27. package/dist/{esm/classes → classes}/pose.js +4 -4
  28. package/dist/classes/pose.js.map +1 -0
  29. package/dist/classes/quaternion.d.ts +2 -2
  30. package/dist/classes/quaternion.d.ts.map +1 -1
  31. package/dist/{esm/classes → classes}/quaternion.js +26 -26
  32. package/dist/classes/quaternion.js.map +1 -0
  33. package/dist/classes/spherical-coordinates.d.ts +2 -2
  34. package/dist/classes/spherical-coordinates.d.ts.map +1 -1
  35. package/dist/{esm/classes → classes}/spherical-coordinates.js +5 -5
  36. package/dist/classes/spherical-coordinates.js.map +1 -0
  37. package/dist/classes/vector2.d.ts +2 -2
  38. package/dist/classes/vector2.d.ts.map +1 -1
  39. package/dist/{esm/classes → classes}/vector2.js +10 -10
  40. package/dist/classes/vector2.js.map +1 -0
  41. package/dist/classes/vector3.d.ts +2 -2
  42. package/dist/classes/vector3.d.ts.map +1 -1
  43. package/dist/{esm/classes → classes}/vector3.js +14 -14
  44. package/dist/classes/vector3.js.map +1 -0
  45. package/dist/classes/vector4.d.ts +3 -3
  46. package/dist/classes/vector4.d.ts.map +1 -1
  47. package/dist/{esm/classes → classes}/vector4.js +8 -8
  48. package/dist/classes/vector4.js.map +1 -0
  49. package/dist/gl-matrix/common.d.ts +38 -0
  50. package/dist/gl-matrix/common.d.ts.map +1 -0
  51. package/dist/gl-matrix/common.js +19 -0
  52. package/dist/gl-matrix/common.js.map +1 -0
  53. package/dist/gl-matrix/mat3.d.ts +295 -0
  54. package/dist/gl-matrix/mat3.d.ts.map +1 -0
  55. package/dist/gl-matrix/mat3.js +489 -0
  56. package/dist/gl-matrix/mat3.js.map +1 -0
  57. package/dist/gl-matrix/mat4.d.ts +577 -0
  58. package/dist/gl-matrix/mat4.d.ts.map +1 -0
  59. package/dist/gl-matrix/mat4.js +1455 -0
  60. package/dist/gl-matrix/mat4.js.map +1 -0
  61. package/dist/gl-matrix/quat.d.ts +357 -0
  62. package/dist/gl-matrix/quat.d.ts.map +1 -0
  63. package/dist/gl-matrix/quat.js +315 -0
  64. package/dist/gl-matrix/quat.js.map +1 -0
  65. package/dist/gl-matrix/vec2.d.ts +373 -0
  66. package/dist/gl-matrix/vec2.d.ts.map +1 -0
  67. package/dist/gl-matrix/vec2.js +257 -0
  68. package/dist/gl-matrix/vec2.js.map +1 -0
  69. package/dist/gl-matrix/vec3.d.ts +416 -0
  70. package/dist/gl-matrix/vec3.d.ts.map +1 -0
  71. package/dist/gl-matrix/vec3.js +384 -0
  72. package/dist/gl-matrix/vec3.js.map +1 -0
  73. package/dist/gl-matrix/vec4.d.ts +340 -0
  74. package/dist/gl-matrix/vec4.d.ts.map +1 -0
  75. package/dist/gl-matrix/vec4.js +334 -0
  76. package/dist/gl-matrix/vec4.js.map +1 -0
  77. package/dist/gl-matrix/wip/index.d.ts +5 -0
  78. package/dist/gl-matrix/wip/index.d.ts.map +1 -0
  79. package/dist/gl-matrix/wip/index.js +12 -0
  80. package/dist/gl-matrix/wip/index.js.map +1 -0
  81. package/dist/gl-matrix/wip/mat2.d.ts +229 -0
  82. package/dist/gl-matrix/wip/mat2.d.ts.map +1 -0
  83. package/dist/gl-matrix/wip/mat2.js +208 -0
  84. package/dist/gl-matrix/wip/mat2.js.map +1 -0
  85. package/dist/gl-matrix/wip/mat2d.d.ts +244 -0
  86. package/dist/gl-matrix/wip/mat2d.d.ts.map +1 -0
  87. package/dist/gl-matrix/wip/mat2d.js +251 -0
  88. package/dist/gl-matrix/wip/mat2d.js.map +1 -0
  89. package/dist/gl-matrix/wip/quat2.d.ts +352 -0
  90. package/dist/gl-matrix/wip/quat2.d.ts.map +1 -0
  91. package/dist/gl-matrix/wip/quat2.js +482 -0
  92. package/dist/gl-matrix/wip/quat2.js.map +1 -0
  93. package/dist/gl-matrix/wip/types.d.js +2 -0
  94. package/dist/{esm/lib/gl-matrix.d.js.map → gl-matrix/wip/types.d.js.map} +1 -1
  95. package/dist/index.cjs +3788 -0
  96. package/dist/index.d.ts +15 -14
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +17 -0
  99. package/dist/index.js.map +1 -0
  100. package/dist/lib/assert.d.ts +1 -1
  101. package/dist/lib/assert.d.ts.map +1 -1
  102. package/dist/lib/assert.js +6 -0
  103. package/dist/lib/assert.js.map +1 -0
  104. package/dist/lib/common.d.ts +10 -5
  105. package/dist/lib/common.d.ts.map +1 -1
  106. package/dist/{esm/lib → lib}/common.js +11 -9
  107. package/dist/lib/common.js.map +1 -0
  108. package/dist/lib/gl-matrix-extras.js.map +1 -0
  109. package/dist/lib/math-utils.d.ts +24 -27
  110. package/dist/lib/math-utils.d.ts.map +1 -1
  111. package/dist/lib/math-utils.js +25 -0
  112. package/dist/lib/math-utils.js.map +1 -0
  113. package/dist/lib/validators.d.ts +1 -1
  114. package/dist/lib/validators.d.ts.map +1 -1
  115. package/dist/{esm/lib → lib}/validators.js +2 -2
  116. package/dist/lib/validators.js.map +1 -0
  117. package/package.json +6 -6
  118. package/src/classes/base/math-array.ts +16 -8
  119. package/src/classes/base/matrix.ts +7 -4
  120. package/src/classes/base/vector.ts +4 -4
  121. package/src/classes/euler.ts +9 -8
  122. package/src/classes/matrix3.ts +37 -24
  123. package/src/classes/matrix4.ts +48 -29
  124. package/src/classes/pose.ts +4 -4
  125. package/src/classes/quaternion.ts +54 -32
  126. package/src/classes/spherical-coordinates.ts +5 -4
  127. package/src/classes/vector2.ts +13 -9
  128. package/src/classes/vector3.ts +26 -12
  129. package/src/classes/vector4.ts +14 -10
  130. package/src/gl-matrix/common.js +58 -0
  131. package/src/gl-matrix/mat3.js +842 -0
  132. package/src/gl-matrix/mat4.js +2169 -0
  133. package/src/gl-matrix/quat.ts +789 -0
  134. package/src/gl-matrix/vec2.js +629 -0
  135. package/src/gl-matrix/vec3.js +827 -0
  136. package/src/gl-matrix/vec4.js +675 -0
  137. package/src/gl-matrix/wip/index.js +15 -0
  138. package/src/gl-matrix/wip/mat2.js +442 -0
  139. package/src/gl-matrix/wip/mat2d.js +505 -0
  140. package/src/gl-matrix/wip/quat2.ts +886 -0
  141. package/src/gl-matrix/wip/types.d.ts +93 -0
  142. package/src/index.ts +16 -14
  143. package/src/lib/assert.ts +1 -1
  144. package/src/lib/common.ts +31 -19
  145. package/src/lib/math-utils.ts +24 -26
  146. package/src/lib/validators.ts +3 -3
  147. package/dist/es5/classes/base/math-array.js +0 -348
  148. package/dist/es5/classes/base/math-array.js.map +0 -1
  149. package/dist/es5/classes/base/matrix.js +0 -108
  150. package/dist/es5/classes/base/matrix.js.map +0 -1
  151. package/dist/es5/classes/base/vector.js +0 -210
  152. package/dist/es5/classes/base/vector.js.map +0 -1
  153. package/dist/es5/classes/euler.js +0 -654
  154. package/dist/es5/classes/euler.js.map +0 -1
  155. package/dist/es5/classes/matrix3.js +0 -284
  156. package/dist/es5/classes/matrix3.js.map +0 -1
  157. package/dist/es5/classes/matrix4.js +0 -574
  158. package/dist/es5/classes/matrix4.js.map +0 -1
  159. package/dist/es5/classes/pose.js +0 -159
  160. package/dist/es5/classes/pose.js.map +0 -1
  161. package/dist/es5/classes/quaternion.js +0 -323
  162. package/dist/es5/classes/quaternion.js.map +0 -1
  163. package/dist/es5/classes/spherical-coordinates.js +0 -208
  164. package/dist/es5/classes/spherical-coordinates.js.map +0 -1
  165. package/dist/es5/classes/vector2.js +0 -156
  166. package/dist/es5/classes/vector2.js.map +0 -1
  167. package/dist/es5/classes/vector3.js +0 -213
  168. package/dist/es5/classes/vector3.js.map +0 -1
  169. package/dist/es5/classes/vector4.js +0 -185
  170. package/dist/es5/classes/vector4.js.map +0 -1
  171. package/dist/es5/docs/README.md +0 -0
  172. package/dist/es5/index.js +0 -236
  173. package/dist/es5/index.js.map +0 -1
  174. package/dist/es5/lib/assert.js +0 -13
  175. package/dist/es5/lib/assert.js.map +0 -1
  176. package/dist/es5/lib/common.js +0 -255
  177. package/dist/es5/lib/common.js.map +0 -1
  178. package/dist/es5/lib/gl-matrix-extras.js +0 -61
  179. package/dist/es5/lib/gl-matrix-extras.js.map +0 -1
  180. package/dist/es5/lib/gl-matrix.d.js +0 -2
  181. package/dist/es5/lib/math-utils.js +0 -34
  182. package/dist/es5/lib/math-utils.js.map +0 -1
  183. package/dist/es5/lib/validators.js +0 -53
  184. package/dist/es5/lib/validators.js.map +0 -1
  185. package/dist/esm/classes/base/math-array.js.map +0 -1
  186. package/dist/esm/classes/base/matrix.js.map +0 -1
  187. package/dist/esm/classes/base/vector.js.map +0 -1
  188. package/dist/esm/classes/euler.js.map +0 -1
  189. package/dist/esm/classes/matrix3.js.map +0 -1
  190. package/dist/esm/classes/matrix4.js.map +0 -1
  191. package/dist/esm/classes/pose.js.map +0 -1
  192. package/dist/esm/classes/quaternion.js.map +0 -1
  193. package/dist/esm/classes/spherical-coordinates.js.map +0 -1
  194. package/dist/esm/classes/vector2.js.map +0 -1
  195. package/dist/esm/classes/vector3.js.map +0 -1
  196. package/dist/esm/classes/vector4.js.map +0 -1
  197. package/dist/esm/docs/README.md +0 -0
  198. package/dist/esm/index.js +0 -16
  199. package/dist/esm/index.js.map +0 -1
  200. package/dist/esm/lib/assert.js +0 -6
  201. package/dist/esm/lib/assert.js.map +0 -1
  202. package/dist/esm/lib/common.js.map +0 -1
  203. package/dist/esm/lib/gl-matrix-extras.js.map +0 -1
  204. package/dist/esm/lib/math-utils.js +0 -27
  205. package/dist/esm/lib/math-utils.js.map +0 -1
  206. package/dist/esm/lib/validators.js.map +0 -1
  207. package/src/docs/README.md +0 -0
  208. /package/dist/{esm/lib → lib}/gl-matrix-extras.js +0 -0
  209. /package/dist/{esm/lib → lib}/gl-matrix.d.js +0 -0
  210. /package/dist/{es5/lib → lib}/gl-matrix.d.js.map +0 -0
@@ -0,0 +1,357 @@
1
+ import * as vec4 from './vec4.js';
2
+ /**
3
+ * Quaternion in the format XYZW
4
+ * @module quat
5
+ */
6
+ /**
7
+ * Creates a new identity quat
8
+ *
9
+ * @returns {quat} a new quaternion
10
+ */
11
+ export declare function create(): any[] | Float32Array;
12
+ /**
13
+ * Set a quat to the identity quaternion
14
+ *
15
+ * @param {quat} out the receiving quaternion
16
+ * @returns {quat} out
17
+ */
18
+ export declare function identity(out: any): any;
19
+ /**
20
+ * Sets a quat from the given angle and rotation axis,
21
+ * then returns it.
22
+ *
23
+ * @param {quat} out the receiving quaternion
24
+ * @param {ReadonlyVec3} axis the axis around which to rotate
25
+ * @param {Number} rad the angle in radians
26
+ * @returns {quat} out
27
+ **/
28
+ export declare function setAxisAngle(out: any, axis: any, rad: any): any;
29
+ /**
30
+ * Gets the rotation axis and angle for a given
31
+ * quaternion. If a quaternion is created with
32
+ * setAxisAngle, this method will return the same
33
+ * values as providied in the original parameter list
34
+ * OR functionally equivalent values.
35
+ * Example: The quaternion formed by axis [0, 0, 1] and
36
+ * angle -90 is the same as the quaternion formed by
37
+ * [0, 0, 1] and 270. This method favors the latter.
38
+ * @param {vec3} out_axis Vector receiving the axis of rotation
39
+ * @param {ReadonlyQuat} q Quaternion to be decomposed
40
+ * @return {Number} Angle, in radians, of the rotation
41
+ */
42
+ export declare function getAxisAngle(out_axis: any, q: any): number;
43
+ /**
44
+ * Gets the angular distance between two unit quaternions
45
+ *
46
+ * @param {ReadonlyQuat} a Origin unit quaternion
47
+ * @param {ReadonlyQuat} b Destination unit quaternion
48
+ * @return {Number} Angle, in radians, between the two quaternions
49
+ */
50
+ export declare function getAngle(a: any, b: any): number;
51
+ /**
52
+ * Multiplies two quat's
53
+ *
54
+ * @param {quat} out the receiving quaternion
55
+ * @param {ReadonlyQuat} a the first operand
56
+ * @param {ReadonlyQuat} b the second operand
57
+ * @returns {quat} out
58
+ */
59
+ export declare function multiply(out: any, a: any, b: any): any;
60
+ /**
61
+ * Rotates a quaternion by the given angle about the X axis
62
+ *
63
+ * @param {quat} out quat receiving operation result
64
+ * @param {ReadonlyQuat} a quat to rotate
65
+ * @param {number} rad angle (in radians) to rotate
66
+ * @returns {quat} out
67
+ */
68
+ export declare function rotateX(out: any, a: any, rad: any): any;
69
+ /**
70
+ * Rotates a quaternion by the given angle about the Y axis
71
+ *
72
+ * @param {quat} out quat receiving operation result
73
+ * @param {ReadonlyQuat} a quat to rotate
74
+ * @param {number} rad angle (in radians) to rotate
75
+ * @returns {quat} out
76
+ */
77
+ export declare function rotateY(out: any, a: any, rad: any): any;
78
+ /**
79
+ * Rotates a quaternion by the given angle about the Z axis
80
+ *
81
+ * @param {quat} out quat receiving operation result
82
+ * @param {ReadonlyQuat} a quat to rotate
83
+ * @param {number} rad angle (in radians) to rotate
84
+ * @returns {quat} out
85
+ */
86
+ export declare function rotateZ(out: any, a: any, rad: any): any;
87
+ /**
88
+ * Calculates the W component of a quat from the X, Y, and Z components.
89
+ * Assumes that quaternion is 1 unit in length.
90
+ * Any existing W component will be ignored.
91
+ *
92
+ * @param {quat} out the receiving quaternion
93
+ * @param {ReadonlyQuat} a quat to calculate W component of
94
+ * @returns {quat} out
95
+ */
96
+ export declare function calculateW(out: any, a: any): any;
97
+ /**
98
+ * Calculate the exponential of a unit quaternion.
99
+ *
100
+ * @param {quat} out the receiving quaternion
101
+ * @param {ReadonlyQuat} a quat to calculate the exponential of
102
+ * @returns {quat} out
103
+ */
104
+ export declare function exp(out: any, a: any): any;
105
+ /**
106
+ * Calculate the natural logarithm of a unit quaternion.
107
+ *
108
+ * @param {quat} out the receiving quaternion
109
+ * @param {ReadonlyQuat} a quat to calculate the exponential of
110
+ * @returns {quat} out
111
+ */
112
+ export declare function ln(out: any, a: any): any;
113
+ /**
114
+ * Calculate the scalar power of a unit quaternion.
115
+ *
116
+ * @param {quat} out the receiving quaternion
117
+ * @param {ReadonlyQuat} a quat to calculate the exponential of
118
+ * @param {Number} b amount to scale the quaternion by
119
+ * @returns {quat} out
120
+ */
121
+ export declare function pow(out: any, a: any, b: any): any;
122
+ /**
123
+ * Performs a spherical linear interpolation between two quat
124
+ *
125
+ * @param {quat} out the receiving quaternion
126
+ * @param {ReadonlyQuat} a the first operand
127
+ * @param {ReadonlyQuat} b the second operand
128
+ * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
129
+ * @returns {quat} out
130
+ */
131
+ export declare function slerp(out: any, a: any, b: any, t: any): any;
132
+ /**
133
+ * Generates a random unit quaternion
134
+ *
135
+ * @param {quat} out the receiving quaternion
136
+ * @returns {quat} out
137
+ */
138
+ /**
139
+ * Calculates the inverse of a quat
140
+ *
141
+ * @param {quat} out the receiving quaternion
142
+ * @param {ReadonlyQuat} a quat to calculate inverse of
143
+ * @returns {quat} out
144
+ */
145
+ export declare function invert(out: any, a: any): any;
146
+ /**
147
+ * Calculates the conjugate of a quat
148
+ * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
149
+ *
150
+ * @param {quat} out the receiving quaternion
151
+ * @param {ReadonlyQuat} a quat to calculate conjugate of
152
+ * @returns {quat} out
153
+ */
154
+ export declare function conjugate(out: any, a: any): any;
155
+ /**
156
+ * Creates a quaternion from the given 3x3 rotation matrix.
157
+ *
158
+ * NOTE: The resultant quaternion is not normalized, so you should be sure
159
+ * to renormalize the quaternion yourself where necessary.
160
+ *
161
+ * @param {quat} out the receiving quaternion
162
+ * @param {ReadonlyMat3} m rotation matrix
163
+ * @returns {quat} out
164
+ * @function
165
+ */
166
+ export declare function fromMat3(out: any, m: any): any;
167
+ /**
168
+ * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.
169
+ *
170
+ * @param {quat} out the receiving quaternion
171
+ * @param {Number} x Angle to rotate around X axis in degrees.
172
+ * @param {Number} y Angle to rotate around Y axis in degrees.
173
+ * @param {Number} z Angle to rotate around Z axis in degrees.
174
+ * @param {'zyx'|'xyz'|'yxz'|'yzx'|'zxy'|'zyx'} order Intrinsic order for conversion, default is zyx.
175
+ * @returns {quat} out
176
+ * @function
177
+ */
178
+ /**
179
+ * Returns a string representation of a quaternion
180
+ *
181
+ * @param {ReadonlyQuat} a vector to represent as a string
182
+ * @returns {String} string representation of the vector
183
+ */
184
+ export declare function str(a: any): string;
185
+ /**
186
+ * Creates a new quat initialized with values from an existing quaternion
187
+ *
188
+ * @param {ReadonlyQuat} a quaternion to clone
189
+ * @returns {quat} a new quaternion
190
+ * @function
191
+ */
192
+ export declare const clone: typeof vec4.clone;
193
+ /**
194
+ * Creates a new quat initialized with the given values
195
+ *
196
+ * @param {Number} x X component
197
+ * @param {Number} y Y component
198
+ * @param {Number} z Z component
199
+ * @param {Number} w W component
200
+ * @returns {quat} a new quaternion
201
+ * @function
202
+ */
203
+ export declare const fromValues: typeof vec4.fromValues;
204
+ /**
205
+ * Copy the values from one quat to another
206
+ *
207
+ * @param {quat} out the receiving quaternion
208
+ * @param {ReadonlyQuat} a the source quaternion
209
+ * @returns {quat} out
210
+ * @function
211
+ */
212
+ export declare const copy: typeof vec4.copy;
213
+ /**
214
+ * Set the components of a quat to the given values
215
+ *
216
+ * @param {quat} out the receiving quaternion
217
+ * @param {Number} x X component
218
+ * @param {Number} y Y component
219
+ * @param {Number} z Z component
220
+ * @param {Number} w W component
221
+ * @returns {quat} out
222
+ * @function
223
+ */
224
+ export declare const set: typeof vec4.set;
225
+ /**
226
+ * Adds two quat's
227
+ *
228
+ * @param {quat} out the receiving quaternion
229
+ * @param {ReadonlyQuat} a the first operand
230
+ * @param {ReadonlyQuat} b the second operand
231
+ * @returns {quat} out
232
+ * @function
233
+ */
234
+ export declare const add: typeof vec4.add;
235
+ /**
236
+ * Alias for {@link quat.multiply}
237
+ * @function
238
+ */
239
+ export declare const mul: typeof multiply;
240
+ /**
241
+ * Scales a quat by a scalar number
242
+ *
243
+ * @param {quat} out the receiving vector
244
+ * @param {ReadonlyQuat} a the vector to scale
245
+ * @param {Number} b amount to scale the vector by
246
+ * @returns {quat} out
247
+ * @function
248
+ */
249
+ export declare const scale: typeof vec4.scale;
250
+ /**
251
+ * Calculates the dot product of two quat's
252
+ *
253
+ * @param {ReadonlyQuat} a the first operand
254
+ * @param {ReadonlyQuat} b the second operand
255
+ * @returns {Number} dot product of a and b
256
+ * @function
257
+ */
258
+ export declare const dot: typeof vec4.dot;
259
+ /**
260
+ * Performs a linear interpolation between two quat's
261
+ *
262
+ * @param {quat} out the receiving quaternion
263
+ * @param {ReadonlyQuat} a the first operand
264
+ * @param {ReadonlyQuat} b the second operand
265
+ * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
266
+ * @returns {quat} out
267
+ * @function
268
+ */
269
+ export declare const lerp: typeof vec4.lerp;
270
+ /**
271
+ * Calculates the length of a quat
272
+ *
273
+ * @param {ReadonlyQuat} a vector to calculate length of
274
+ * @returns {Number} length of a
275
+ */
276
+ export declare const length: typeof vec4.length;
277
+ /**
278
+ * Alias for {@link quat.length}
279
+ * @function
280
+ */
281
+ export declare const len: typeof vec4.length;
282
+ /**
283
+ * Calculates the squared length of a quat
284
+ *
285
+ * @param {ReadonlyQuat} a vector to calculate squared length of
286
+ * @returns {Number} squared length of a
287
+ * @function
288
+ */
289
+ export declare const squaredLength: typeof vec4.squaredLength;
290
+ /**
291
+ * Alias for {@link quat.squaredLength}
292
+ * @function
293
+ */
294
+ export declare const sqrLen: typeof vec4.squaredLength;
295
+ /**
296
+ * Normalize a quat
297
+ *
298
+ * @param {quat} out the receiving quaternion
299
+ * @param {ReadonlyQuat} a quaternion to normalize
300
+ * @returns {quat} out
301
+ * @function
302
+ */
303
+ export declare const normalize: typeof vec4.normalize;
304
+ /**
305
+ * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)
306
+ *
307
+ * @param {ReadonlyQuat} a The first quaternion.
308
+ * @param {ReadonlyQuat} b The second quaternion.
309
+ * @returns {Boolean} True if the vectors are equal, false otherwise.
310
+ */
311
+ export declare const exactEquals: typeof vec4.exactEquals;
312
+ /**
313
+ * Returns whether or not the quaternions point approximately to the same direction.
314
+ *
315
+ * Both quaternions are assumed to be unit length.
316
+ *
317
+ * @param {ReadonlyQuat} a The first unit quaternion.
318
+ * @param {ReadonlyQuat} b The second unit quaternion.
319
+ * @returns {Boolean} True if the quaternions are equal, false otherwise.
320
+ */
321
+ export declare function equals(a: any, b: any): boolean;
322
+ /**
323
+ * Sets a quaternion to represent the shortest rotation from one
324
+ * vector to another.
325
+ *
326
+ * Both vectors are assumed to be unit length.
327
+ *
328
+ * @param {quat} out the receiving quaternion.
329
+ * @param {ReadonlyVec3} a the initial vector
330
+ * @param {ReadonlyVec3} b the destination vector
331
+ * @returns {quat} out
332
+ */
333
+ export declare const rotationTo: (out: any, a: any, b: any) => any;
334
+ /**
335
+ * Performs a spherical linear interpolation with two control points
336
+ *
337
+ * @param {quat} out the receiving quaternion
338
+ * @param {ReadonlyQuat} a the first operand
339
+ * @param {ReadonlyQuat} b the second operand
340
+ * @param {ReadonlyQuat} c the third operand
341
+ * @param {ReadonlyQuat} d the fourth operand
342
+ * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
343
+ * @returns {quat} out
344
+ */
345
+ export declare const sqlerp: (out: any, a: any, b: any, c: any, d: any, t: any) => any;
346
+ /**
347
+ * Sets the specified quaternion with values corresponding to the given
348
+ * axes. Each axis is a vec3 and is expected to be unit length and
349
+ * perpendicular to all other specified axes.
350
+ *
351
+ * @param {ReadonlyVec3} view the vector representing the viewing direction
352
+ * @param {ReadonlyVec3} right the vector representing the local "right" direction
353
+ * @param {ReadonlyVec3} up the vector representing the local "up" direction
354
+ * @returns {quat} out
355
+ */
356
+ export declare const setAxes: (out: any, view: any, right: any, up: any) => vec4;
357
+ //# sourceMappingURL=quat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quat.d.ts","sourceRoot":"","sources":["../../src/gl-matrix/quat.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,315 @@
1
+ import * as glMatrix from './common.js';
2
+ import * as mat3 from './mat3.js';
3
+ import * as vec3 from './vec3.js';
4
+ import * as vec4 from './vec4.js';
5
+ export function create() {
6
+ const out = new glMatrix.ARRAY_TYPE(4);
7
+
8
+ if (glMatrix.ARRAY_TYPE != Float32Array) {
9
+ out[0] = 0;
10
+ out[1] = 0;
11
+ out[2] = 0;
12
+ }
13
+
14
+ out[3] = 1;
15
+ return out;
16
+ }
17
+ export function identity(out) {
18
+ out[0] = 0;
19
+ out[1] = 0;
20
+ out[2] = 0;
21
+ out[3] = 1;
22
+ return out;
23
+ }
24
+ export function setAxisAngle(out, axis, rad) {
25
+ rad = rad * 0.5;
26
+ const s = Math.sin(rad);
27
+ out[0] = s * axis[0];
28
+ out[1] = s * axis[1];
29
+ out[2] = s * axis[2];
30
+ out[3] = Math.cos(rad);
31
+ return out;
32
+ }
33
+ export function getAxisAngle(out_axis, q) {
34
+ const rad = Math.acos(q[3]) * 2.0;
35
+ const s = Math.sin(rad / 2.0);
36
+
37
+ if (s > glMatrix.EPSILON) {
38
+ out_axis[0] = q[0] / s;
39
+ out_axis[1] = q[1] / s;
40
+ out_axis[2] = q[2] / s;
41
+ } else {
42
+ out_axis[0] = 1;
43
+ out_axis[1] = 0;
44
+ out_axis[2] = 0;
45
+ }
46
+
47
+ return rad;
48
+ }
49
+ export function getAngle(a, b) {
50
+ const dotproduct = dot(a, b);
51
+ return Math.acos(2 * dotproduct * dotproduct - 1);
52
+ }
53
+ export function multiply(out, a, b) {
54
+ const ax = a[0];
55
+ const ay = a[1];
56
+ const az = a[2];
57
+ const aw = a[3];
58
+ const bx = b[0];
59
+ const by = b[1];
60
+ const bz = b[2];
61
+ const bw = b[3];
62
+ out[0] = ax * bw + aw * bx + ay * bz - az * by;
63
+ out[1] = ay * bw + aw * by + az * bx - ax * bz;
64
+ out[2] = az * bw + aw * bz + ax * by - ay * bx;
65
+ out[3] = aw * bw - ax * bx - ay * by - az * bz;
66
+ return out;
67
+ }
68
+ export function rotateX(out, a, rad) {
69
+ rad *= 0.5;
70
+ const ax = a[0];
71
+ const ay = a[1];
72
+ const az = a[2];
73
+ const aw = a[3];
74
+ const bx = Math.sin(rad);
75
+ const bw = Math.cos(rad);
76
+ out[0] = ax * bw + aw * bx;
77
+ out[1] = ay * bw + az * bx;
78
+ out[2] = az * bw - ay * bx;
79
+ out[3] = aw * bw - ax * bx;
80
+ return out;
81
+ }
82
+ export function rotateY(out, a, rad) {
83
+ rad *= 0.5;
84
+ const ax = a[0];
85
+ const ay = a[1];
86
+ const az = a[2];
87
+ const aw = a[3];
88
+ const by = Math.sin(rad);
89
+ const bw = Math.cos(rad);
90
+ out[0] = ax * bw - az * by;
91
+ out[1] = ay * bw + aw * by;
92
+ out[2] = az * bw + ax * by;
93
+ out[3] = aw * bw - ay * by;
94
+ return out;
95
+ }
96
+ export function rotateZ(out, a, rad) {
97
+ rad *= 0.5;
98
+ const ax = a[0];
99
+ const ay = a[1];
100
+ const az = a[2];
101
+ const aw = a[3];
102
+ const bz = Math.sin(rad);
103
+ const bw = Math.cos(rad);
104
+ out[0] = ax * bw + ay * bz;
105
+ out[1] = ay * bw - ax * bz;
106
+ out[2] = az * bw + aw * bz;
107
+ out[3] = aw * bw - az * bz;
108
+ return out;
109
+ }
110
+ export function calculateW(out, a) {
111
+ const x = a[0];
112
+ const y = a[1];
113
+ const z = a[2];
114
+ out[0] = x;
115
+ out[1] = y;
116
+ out[2] = z;
117
+ out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));
118
+ return out;
119
+ }
120
+ export function exp(out, a) {
121
+ const x = a[0];
122
+ const y = a[1];
123
+ const z = a[2];
124
+ const w = a[3];
125
+ const r = Math.sqrt(x * x + y * y + z * z);
126
+ const et = Math.exp(w);
127
+ const s = r > 0 ? et * Math.sin(r) / r : 0;
128
+ out[0] = x * s;
129
+ out[1] = y * s;
130
+ out[2] = z * s;
131
+ out[3] = et * Math.cos(r);
132
+ return out;
133
+ }
134
+ export function ln(out, a) {
135
+ const x = a[0];
136
+ const y = a[1];
137
+ const z = a[2];
138
+ const w = a[3];
139
+ const r = Math.sqrt(x * x + y * y + z * z);
140
+ const t = r > 0 ? Math.atan2(r, w) / r : 0;
141
+ out[0] = x * t;
142
+ out[1] = y * t;
143
+ out[2] = z * t;
144
+ out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);
145
+ return out;
146
+ }
147
+ export function pow(out, a, b) {
148
+ ln(out, a);
149
+ scale(out, out, b);
150
+ exp(out, out);
151
+ return out;
152
+ }
153
+ export function slerp(out, a, b, t) {
154
+ const ax = a[0];
155
+ const ay = a[1];
156
+ const az = a[2];
157
+ const aw = a[3];
158
+ let bx = b[0];
159
+ let by = b[1];
160
+ let bz = b[2];
161
+ let bw = b[3];
162
+ let cosom;
163
+ let omega;
164
+ let scale0;
165
+ let scale1;
166
+ let sinom;
167
+ cosom = ax * bx + ay * by + az * bz + aw * bw;
168
+
169
+ if (cosom < 0.0) {
170
+ cosom = -cosom;
171
+ bx = -bx;
172
+ by = -by;
173
+ bz = -bz;
174
+ bw = -bw;
175
+ }
176
+
177
+ if (1.0 - cosom > glMatrix.EPSILON) {
178
+ omega = Math.acos(cosom);
179
+ sinom = Math.sin(omega);
180
+ scale0 = Math.sin((1.0 - t) * omega) / sinom;
181
+ scale1 = Math.sin(t * omega) / sinom;
182
+ } else {
183
+ scale0 = 1.0 - t;
184
+ scale1 = t;
185
+ }
186
+
187
+ out[0] = scale0 * ax + scale1 * bx;
188
+ out[1] = scale0 * ay + scale1 * by;
189
+ out[2] = scale0 * az + scale1 * bz;
190
+ out[3] = scale0 * aw + scale1 * bw;
191
+ return out;
192
+ }
193
+ export function invert(out, a) {
194
+ const a0 = a[0];
195
+ const a1 = a[1];
196
+ const a2 = a[2];
197
+ const a3 = a[3];
198
+ const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;
199
+ const invDot = dot ? 1.0 / dot : 0;
200
+ out[0] = -a0 * invDot;
201
+ out[1] = -a1 * invDot;
202
+ out[2] = -a2 * invDot;
203
+ out[3] = a3 * invDot;
204
+ return out;
205
+ }
206
+ export function conjugate(out, a) {
207
+ out[0] = -a[0];
208
+ out[1] = -a[1];
209
+ out[2] = -a[2];
210
+ out[3] = a[3];
211
+ return out;
212
+ }
213
+ export function fromMat3(out, m) {
214
+ const fTrace = m[0] + m[4] + m[8];
215
+ let fRoot;
216
+
217
+ if (fTrace > 0.0) {
218
+ fRoot = Math.sqrt(fTrace + 1.0);
219
+ out[3] = 0.5 * fRoot;
220
+ fRoot = 0.5 / fRoot;
221
+ out[0] = (m[5] - m[7]) * fRoot;
222
+ out[1] = (m[6] - m[2]) * fRoot;
223
+ out[2] = (m[1] - m[3]) * fRoot;
224
+ } else {
225
+ let i = 0;
226
+ if (m[4] > m[0]) i = 1;
227
+ if (m[8] > m[i * 3 + i]) i = 2;
228
+ const j = (i + 1) % 3;
229
+ const k = (i + 2) % 3;
230
+ fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);
231
+ out[i] = 0.5 * fRoot;
232
+ fRoot = 0.5 / fRoot;
233
+ out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;
234
+ out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;
235
+ out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;
236
+ }
237
+
238
+ return out;
239
+ }
240
+ export function str(a) {
241
+ return "quat(".concat(a[0], ", ").concat(a[1], ", ").concat(a[2], ", ").concat(a[3], ")");
242
+ }
243
+ export const clone = vec4.clone;
244
+ export const fromValues = vec4.fromValues;
245
+ export const copy = vec4.copy;
246
+ export const set = vec4.set;
247
+ export const add = vec4.add;
248
+ export const mul = multiply;
249
+ export const scale = vec4.scale;
250
+ export const dot = vec4.dot;
251
+ export const lerp = vec4.lerp;
252
+ export const length = vec4.length;
253
+ export const len = length;
254
+ export const squaredLength = vec4.squaredLength;
255
+ export const sqrLen = squaredLength;
256
+ export const normalize = vec4.normalize;
257
+ export const exactEquals = vec4.exactEquals;
258
+ export function equals(a, b) {
259
+ return Math.abs(vec4.dot(a, b)) >= 1 - glMatrix.EPSILON;
260
+ }
261
+ export const rotationTo = function () {
262
+ const tmpvec3 = vec3.create();
263
+ const xUnitVec3 = vec3.fromValues(1, 0, 0);
264
+ const yUnitVec3 = vec3.fromValues(0, 1, 0);
265
+ return function (out, a, b) {
266
+ const dot = vec3.dot(a, b);
267
+
268
+ if (dot < -0.999999) {
269
+ vec3.cross(tmpvec3, xUnitVec3, a);
270
+ if (vec3.len(tmpvec3) < 0.000001) vec3.cross(tmpvec3, yUnitVec3, a);
271
+ vec3.normalize(tmpvec3, tmpvec3);
272
+ setAxisAngle(out, tmpvec3, Math.PI);
273
+ return out;
274
+ } else if (dot > 0.999999) {
275
+ out[0] = 0;
276
+ out[1] = 0;
277
+ out[2] = 0;
278
+ out[3] = 1;
279
+ return out;
280
+ }
281
+
282
+ vec3.cross(tmpvec3, a, b);
283
+ out[0] = tmpvec3[0];
284
+ out[1] = tmpvec3[1];
285
+ out[2] = tmpvec3[2];
286
+ out[3] = 1 + dot;
287
+ return normalize(out, out);
288
+ };
289
+ }();
290
+ export const sqlerp = function () {
291
+ const temp1 = create();
292
+ const temp2 = create();
293
+ return function (out, a, b, c, d, t) {
294
+ slerp(temp1, a, d, t);
295
+ slerp(temp2, b, c, t);
296
+ slerp(out, temp1, temp2, 2 * t * (1 - t));
297
+ return out;
298
+ };
299
+ }();
300
+ export const setAxes = function () {
301
+ const matr = mat3.create();
302
+ return function (out, view, right, up) {
303
+ matr[0] = right[0];
304
+ matr[3] = right[1];
305
+ matr[6] = right[2];
306
+ matr[1] = up[0];
307
+ matr[4] = up[1];
308
+ matr[7] = up[2];
309
+ matr[2] = -view[0];
310
+ matr[5] = -view[1];
311
+ matr[8] = -view[2];
312
+ return normalize(out, fromMat3(out, matr));
313
+ };
314
+ }();
315
+ //# sourceMappingURL=quat.js.map