math 0.0.3 → 0.1.0

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 (203) hide show
  1. package/API.md +1605 -0
  2. package/LICENSE +21 -0
  3. package/README.md +197 -0
  4. package/dist/color/color.js +136 -0
  5. package/dist/color/color.js.map +1 -0
  6. package/dist/color/colorspace.js +43 -0
  7. package/dist/color/colorspace.js.map +1 -0
  8. package/dist/color/hsl.js +123 -0
  9. package/dist/color/hsl.js.map +1 -0
  10. package/dist/color/index.js +7 -0
  11. package/dist/color/index.js.map +1 -0
  12. package/dist/color/parse.js +276 -0
  13. package/dist/color/parse.js.map +1 -0
  14. package/dist/core/angle.js +43 -0
  15. package/dist/core/angle.js.map +1 -0
  16. package/dist/core/euler.js +212 -0
  17. package/dist/core/euler.js.map +1 -0
  18. package/dist/core/mat2.js +385 -0
  19. package/dist/core/mat2.js.map +1 -0
  20. package/dist/core/mat2d.js +422 -0
  21. package/dist/core/mat2d.js.map +1 -0
  22. package/dist/core/mat3.js +749 -0
  23. package/dist/core/mat3.js.map +1 -0
  24. package/dist/core/mat4.js +2197 -0
  25. package/dist/core/mat4.js.map +1 -0
  26. package/dist/core/polar.js +200 -0
  27. package/dist/core/polar.js.map +1 -0
  28. package/dist/core/quat.js +730 -0
  29. package/dist/core/quat.js.map +1 -0
  30. package/dist/core/quat2.js +883 -0
  31. package/dist/core/quat2.js.map +1 -0
  32. package/dist/core/scalar.js +112 -0
  33. package/dist/core/scalar.js.map +1 -0
  34. package/dist/core/spherical.js +248 -0
  35. package/dist/core/spherical.js.map +1 -0
  36. package/dist/core/vec2.js +597 -0
  37. package/dist/core/vec2.js.map +1 -0
  38. package/dist/core/vec3.js +916 -0
  39. package/dist/core/vec3.js.map +1 -0
  40. package/dist/core/vec4.js +573 -0
  41. package/dist/core/vec4.js.map +1 -0
  42. package/dist/geometry/circumcircle.js +39 -0
  43. package/dist/geometry/circumcircle.js.map +1 -0
  44. package/dist/geometry/index.js +6 -0
  45. package/dist/geometry/index.js.map +1 -0
  46. package/dist/geometry/polygon2-decompose.js +411 -0
  47. package/dist/geometry/polygon2-decompose.js.map +1 -0
  48. package/dist/geometry/polygon2-triangulate.js +222 -0
  49. package/dist/geometry/polygon2-triangulate.js.map +1 -0
  50. package/dist/geometry/quickhull2.js +123 -0
  51. package/dist/geometry/quickhull2.js.map +1 -0
  52. package/dist/geometry/quickhull3.js +605 -0
  53. package/dist/geometry/quickhull3.js.map +1 -0
  54. package/dist/ik/fabrik2.js +675 -0
  55. package/dist/ik/fabrik2.js.map +1 -0
  56. package/dist/ik/fabrik3.js +912 -0
  57. package/dist/ik/fabrik3.js.map +1 -0
  58. package/dist/ik/index.js +5 -0
  59. package/dist/ik/index.js.map +1 -0
  60. package/dist/index.js +27 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/noise/fractal.js +185 -0
  63. package/dist/noise/fractal.js.map +1 -0
  64. package/dist/noise/index.js +16 -0
  65. package/dist/noise/index.js.map +1 -0
  66. package/dist/noise/perlin2d.js +50 -0
  67. package/dist/noise/perlin2d.js.map +1 -0
  68. package/dist/noise/perlin3d.js +72 -0
  69. package/dist/noise/perlin3d.js.map +1 -0
  70. package/dist/noise/permutation.js +120 -0
  71. package/dist/noise/permutation.js.map +1 -0
  72. package/dist/noise/simplex2d.js +84 -0
  73. package/dist/noise/simplex2d.js.map +1 -0
  74. package/dist/noise/simplex3d.js +147 -0
  75. package/dist/noise/simplex3d.js.map +1 -0
  76. package/dist/noise/simplex4d.js +149 -0
  77. package/dist/noise/simplex4d.js.map +1 -0
  78. package/dist/noise/worley2d.js +50 -0
  79. package/dist/noise/worley2d.js.map +1 -0
  80. package/dist/noise/worley3d.js +61 -0
  81. package/dist/noise/worley3d.js.map +1 -0
  82. package/dist/random/index.js +9 -0
  83. package/dist/random/index.js.map +1 -0
  84. package/dist/random/isaac32.js +164 -0
  85. package/dist/random/isaac32.js.map +1 -0
  86. package/dist/random/isaac64.js +215 -0
  87. package/dist/random/isaac64.js.map +1 -0
  88. package/dist/random/mulberry32.js +48 -0
  89. package/dist/random/mulberry32.js.map +1 -0
  90. package/dist/random/random.js +120 -0
  91. package/dist/random/random.js.map +1 -0
  92. package/dist/shapes/box2.js +300 -0
  93. package/dist/shapes/box2.js.map +1 -0
  94. package/dist/shapes/box3.js +550 -0
  95. package/dist/shapes/box3.js.map +1 -0
  96. package/dist/shapes/circle.js +6 -0
  97. package/dist/shapes/circle.js.map +1 -0
  98. package/dist/shapes/frustum.js +662 -0
  99. package/dist/shapes/frustum.js.map +1 -0
  100. package/dist/shapes/index.js +25 -0
  101. package/dist/shapes/index.js.map +1 -0
  102. package/dist/shapes/obb3.js +557 -0
  103. package/dist/shapes/obb3.js.map +1 -0
  104. package/dist/shapes/plane3.js +267 -0
  105. package/dist/shapes/plane3.js.map +1 -0
  106. package/dist/shapes/polygon2.js +451 -0
  107. package/dist/shapes/polygon2.js.map +1 -0
  108. package/dist/shapes/raycast3.js +164 -0
  109. package/dist/shapes/raycast3.js.map +1 -0
  110. package/dist/shapes/segment2.js +82 -0
  111. package/dist/shapes/segment2.js.map +1 -0
  112. package/dist/shapes/sphere.js +23 -0
  113. package/dist/shapes/sphere.js.map +1 -0
  114. package/dist/shapes/triangle2.js +79 -0
  115. package/dist/shapes/triangle2.js.map +1 -0
  116. package/dist/shapes/triangle3.js +60 -0
  117. package/dist/shapes/triangle3.js.map +1 -0
  118. package/dist/src/color/color.d.ts +50 -0
  119. package/dist/src/color/colorspace.d.ts +15 -0
  120. package/dist/src/color/hsl.d.ts +28 -0
  121. package/dist/src/color/index.d.ts +5 -0
  122. package/dist/src/color/parse.d.ts +15 -0
  123. package/dist/src/core/angle.d.ts +29 -0
  124. package/dist/src/core/arrays.d.ts +4 -0
  125. package/dist/src/core/euler.d.ts +78 -0
  126. package/dist/src/core/index.d.ts +27 -0
  127. package/dist/src/core/mat2.d.ts +217 -0
  128. package/dist/src/core/mat2d.d.ts +218 -0
  129. package/dist/src/core/mat3.d.ts +295 -0
  130. package/dist/src/core/mat4.d.ts +667 -0
  131. package/dist/src/core/polar.d.ts +151 -0
  132. package/dist/src/core/quat.d.ts +370 -0
  133. package/dist/src/core/quat2.d.ts +344 -0
  134. package/dist/src/core/scalar.d.ts +75 -0
  135. package/dist/src/core/spherical.d.ts +165 -0
  136. package/dist/src/core/vec2.d.ts +403 -0
  137. package/dist/src/core/vec3.d.ts +493 -0
  138. package/dist/src/core/vec4.d.ts +336 -0
  139. package/dist/src/geometry/circumcircle.d.ts +9 -0
  140. package/dist/src/geometry/index.d.ts +5 -0
  141. package/dist/src/geometry/polygon2-decompose.d.ts +25 -0
  142. package/dist/src/geometry/polygon2-triangulate.d.ts +15 -0
  143. package/dist/src/geometry/quickhull2.d.ts +10 -0
  144. package/dist/src/geometry/quickhull3.d.ts +27 -0
  145. package/dist/src/ik/fabrik2.d.ts +314 -0
  146. package/dist/src/ik/fabrik3.d.ts +371 -0
  147. package/dist/src/ik/index.d.ts +2 -0
  148. package/dist/src/index.d.ts +1 -0
  149. package/dist/src/noise/fractal.d.ts +95 -0
  150. package/dist/src/noise/index.d.ts +9 -0
  151. package/dist/src/noise/perlin2d.d.ts +19 -0
  152. package/dist/src/noise/perlin3d.d.ts +20 -0
  153. package/dist/src/noise/permutation.d.ts +22 -0
  154. package/dist/src/noise/simplex2d.d.ts +19 -0
  155. package/dist/src/noise/simplex3d.d.ts +20 -0
  156. package/dist/src/noise/simplex4d.d.ts +24 -0
  157. package/dist/src/noise/worley2d.d.ts +22 -0
  158. package/dist/src/noise/worley3d.d.ts +23 -0
  159. package/dist/src/random/index.d.ts +8 -0
  160. package/dist/src/random/isaac32.d.ts +62 -0
  161. package/dist/src/random/isaac64.d.ts +75 -0
  162. package/dist/src/random/mulberry32.d.ts +43 -0
  163. package/dist/src/random/random.d.ts +67 -0
  164. package/dist/src/shapes/box2.d.ts +174 -0
  165. package/dist/src/shapes/box3.d.ts +213 -0
  166. package/dist/src/shapes/circle.d.ts +7 -0
  167. package/dist/src/shapes/frustum.d.ts +147 -0
  168. package/dist/src/shapes/index.d.ts +20 -0
  169. package/dist/src/shapes/obb3.d.ts +105 -0
  170. package/dist/src/shapes/plane3.d.ts +130 -0
  171. package/dist/src/shapes/polygon2.d.ts +155 -0
  172. package/dist/src/shapes/raycast3.d.ts +42 -0
  173. package/dist/src/shapes/segment2.d.ts +34 -0
  174. package/dist/src/shapes/sphere.d.ts +19 -0
  175. package/dist/src/shapes/triangle2.d.ts +53 -0
  176. package/dist/src/shapes/triangle3.d.ts +29 -0
  177. package/dist/src/time/easing.d.ts +21 -0
  178. package/dist/src/time/index.d.ts +6 -0
  179. package/dist/src/time/spring-core.d.ts +15 -0
  180. package/dist/src/time/spring.d.ts +36 -0
  181. package/dist/src/time/spring2.d.ts +11 -0
  182. package/dist/src/time/spring3.d.ts +11 -0
  183. package/dist/src/time/spring4.d.ts +11 -0
  184. package/dist/time/easing.js +24 -0
  185. package/dist/time/easing.js.map +1 -0
  186. package/dist/time/index.js +11 -0
  187. package/dist/time/index.js.map +1 -0
  188. package/dist/time/spring-core.js +48 -0
  189. package/dist/time/spring-core.js.map +1 -0
  190. package/dist/time/spring.js +62 -0
  191. package/dist/time/spring.js.map +1 -0
  192. package/dist/time/spring2.js +31 -0
  193. package/dist/time/spring2.js.map +1 -0
  194. package/dist/time/spring3.js +32 -0
  195. package/dist/time/spring3.js.map +1 -0
  196. package/dist/time/spring4.js +32 -0
  197. package/dist/time/spring4.js.map +1 -0
  198. package/package.json +90 -16
  199. package/skills/math/SKILL.md +140 -0
  200. package/AUTHORS +0 -1
  201. package/Cakefile +0 -28
  202. package/math.coffee +0 -112
  203. package/math.js +0 -141
@@ -0,0 +1,151 @@
1
+ import type { Vec2 } from './vec2.js';
2
+ /**
3
+ * A point in polar coordinates [r, theta]
4
+ * r - radial distance from the origin (>= 0)
5
+ * theta - angle from the +X axis, counter-clockwise (radians, range (-pi, pi])
6
+ *
7
+ * This is the standard 2D convention: Vec2 is (x, y) and theta = atan2(y, x).
8
+ * It is deliberately NOT the ground-plane slice of [[spherical]] (which is
9
+ * Y-up, with an XZ ground plane and azimuth measured from +Z); for that
10
+ * horizontal projection use spherical.fromVec2 / spherical.toVec2 instead.
11
+ */
12
+ export type Polar = [r: number, theta: number];
13
+ /**
14
+ * Creates a new polar coordinate at r=1, theta=0
15
+ *
16
+ * @returns a new Polar
17
+ */
18
+ export declare function create(): Polar;
19
+ /**
20
+ * Creates a new Polar initialized with the given values
21
+ *
22
+ * @param r radial distance
23
+ * @param theta angle from +X, counter-clockwise (radians)
24
+ * @returns a new Polar
25
+ */
26
+ export declare function fromValues(r: number, theta: number): Polar;
27
+ /**
28
+ * Creates a new Polar initialized with values from an existing one
29
+ *
30
+ * @param a the source Polar
31
+ * @returns a new Polar
32
+ */
33
+ export declare function clone(a: Polar): Polar;
34
+ /**
35
+ * Copies values from one Polar to another
36
+ *
37
+ * @param out the receiving Polar
38
+ * @param a the source Polar
39
+ * @returns out
40
+ */
41
+ export declare function copy(out: Polar, a: Polar): Polar;
42
+ /**
43
+ * Sets the components of a Polar
44
+ *
45
+ * @param out the receiving Polar
46
+ * @param r radial distance
47
+ * @param theta angle from +X, counter-clockwise (radians)
48
+ * @returns out
49
+ */
50
+ export declare function set(out: Polar, r: number, theta: number): Polar;
51
+ /**
52
+ * Sets r=1, preserving the angle. No-op on the angle if r is already zero.
53
+ *
54
+ * @param out the receiving Polar
55
+ * @param a the source Polar
56
+ * @returns out
57
+ */
58
+ export declare function normalize(out: Polar, a: Polar): Polar;
59
+ /**
60
+ * Scales the radial distance r by a scalar
61
+ *
62
+ * @param out the receiving Polar
63
+ * @param a the source Polar
64
+ * @param s scalar to multiply r by
65
+ * @returns out
66
+ */
67
+ export declare function scale(out: Polar, a: Polar, s: number): Polar;
68
+ /**
69
+ * Rotates a Polar by an angle (in radians), wrapping theta into (-pi, pi].
70
+ *
71
+ * @param out the receiving Polar
72
+ * @param a the source Polar
73
+ * @param rad the angle to add to theta
74
+ * @returns out
75
+ */
76
+ export declare function rotate(out: Polar, a: Polar, rad: number): Polar;
77
+ /**
78
+ * Linearly interpolates between two Polar coordinates, taking the shortest
79
+ * angular path for theta.
80
+ *
81
+ * @param out the receiving Polar
82
+ * @param a the first operand
83
+ * @param b the second operand
84
+ * @param t interpolation factor in [0, 1]
85
+ * @returns out
86
+ */
87
+ export declare function lerp(out: Polar, a: Polar, b: Polar, t: number): Polar;
88
+ /**
89
+ * Sets a Polar from Cartesian Vec2 coordinates:
90
+ * r = sqrt(x^2 + y^2)
91
+ * theta = atan2(y, x)
92
+ *
93
+ * @param out the receiving Polar
94
+ * @param v the source Vec2
95
+ * @returns out
96
+ */
97
+ export declare function setFromVec2(out: Polar, v: Vec2): Polar;
98
+ /** @alias setFromVec2 */
99
+ export declare const fromVec2: typeof setFromVec2;
100
+ /**
101
+ * Converts polar coordinates to a Cartesian Vec2:
102
+ * x = r * cos(theta)
103
+ * y = r * sin(theta)
104
+ *
105
+ * @param out the receiving Vec2
106
+ * @param a the source Polar
107
+ * @returns out
108
+ */
109
+ export declare function toVec2(out: Vec2, a: Polar): Vec2;
110
+ /**
111
+ * Returns the smallest angle (in radians) between two polar directions,
112
+ * ignoring r. Range [0, pi].
113
+ *
114
+ * @param a the first Polar
115
+ * @param b the second Polar
116
+ * @returns angle in radians in [0, pi]
117
+ */
118
+ export declare function angleTo(a: Polar, b: Polar): number;
119
+ /**
120
+ * Returns the straight-line (chord) distance between two polar coordinates,
121
+ * via the law of cosines.
122
+ *
123
+ * @param a the first Polar
124
+ * @param b the second Polar
125
+ * @returns the Euclidean distance between the two points
126
+ */
127
+ export declare function distance(a: Polar, b: Polar): number;
128
+ /**
129
+ * Returns true if two Polar coordinates are approximately equal,
130
+ * within an absolute/relative tolerance of EPSILON.
131
+ *
132
+ * @param a the first Polar
133
+ * @param b the second Polar
134
+ * @returns true if approximately equal
135
+ */
136
+ export declare function equals(a: Polar, b: Polar): boolean;
137
+ /**
138
+ * Returns true if two Polar coordinates are exactly equal (===).
139
+ *
140
+ * @param a the first Polar
141
+ * @param b the second Polar
142
+ * @returns true if exactly equal
143
+ */
144
+ export declare function exactEquals(a: Polar, b: Polar): boolean;
145
+ /**
146
+ * Returns a string representation of a Polar
147
+ *
148
+ * @param a the source Polar
149
+ * @returns string representation
150
+ */
151
+ export declare function str(a: Polar): string;
@@ -0,0 +1,370 @@
1
+ import type { MutableArrayLike } from './arrays.js';
2
+ import type { Euler, EulerOrder } from './euler.js';
3
+ import type { Mat3 } from './mat3.js';
4
+ import type { Mat4 } from './mat4.js';
5
+ import type { Vec3 } from './vec3.js';
6
+ import * as vec4 from './vec4.js';
7
+ /** A quaternion that represents rotation */
8
+ export type Quat = [x: number, y: number, z: number, w: number];
9
+ /**
10
+ * Creates a new identity quat
11
+ *
12
+ * @returns a new quaternion
13
+ */
14
+ export declare function create(): Quat;
15
+ /**
16
+ * Sets the components of a quat from a buffer
17
+ * @param out the receiving quaternion
18
+ * @param buffer the source buffer
19
+ * @param startIndex the starting index in the buffer
20
+ * @returns out
21
+ */
22
+ export declare function fromBuffer(out: Quat, buffer: ArrayLike<number>, startIndex: number): Quat;
23
+ /**
24
+ * Writes the components of a quat to a buffer
25
+ * @param outBuffer The output buffer
26
+ * @param q The source quaternion
27
+ * @param startIndex The starting index in the buffer
28
+ * @returns The output buffer
29
+ */
30
+ export declare function toBuffer(outBuffer: MutableArrayLike<number>, q: Quat, startIndex: number): MutableArrayLike<number>;
31
+ /**
32
+ * Set a quat to the identity quaternion
33
+ *
34
+ * @param out the receiving quaternion
35
+ * @returns out
36
+ */
37
+ export declare function identity(out: Quat): Quat;
38
+ /**
39
+ * Sets a quat from the given angle and rotation axis,
40
+ * then returns it.
41
+ *
42
+ * @param out the receiving quaternion
43
+ * @param axis the axis around which to rotate
44
+ * @param rad the angle in radians
45
+ * @returns out
46
+ **/
47
+ export declare function setAxisAngle(out: Quat, axis: Vec3, rad: number): Quat;
48
+ /**
49
+ * Gets the rotation axis and angle for a given
50
+ * quaternion. If a quaternion is created with
51
+ * setAxisAngle, this method will return the same
52
+ * values as providied in the original parameter list
53
+ * OR functionally equivalent values.
54
+ * Example: The quaternion formed by axis [0, 0, 1] and
55
+ * angle -90 is the same as the quaternion formed by
56
+ * [0, 0, 1] and 270. This method favors the latter.
57
+ * @param out_axis Vector receiving the axis of rotation
58
+ * @param q Quaternion to be decomposed
59
+ * @return Angle, in radians, of the rotation
60
+ */
61
+ export declare function getAxisAngle(out_axis: Vec3, q: Quat): number;
62
+ /**
63
+ * Gets the angular distance between two unit quaternions
64
+ *
65
+ * @param a Origin unit quaternion
66
+ * @param b Destination unit quaternion
67
+ * @return Angle, in radians, between the two quaternions
68
+ */
69
+ export declare function getAngle(a: Quat, b: Quat): number;
70
+ /**
71
+ * Multiplies two quat's
72
+ *
73
+ * @param out the receiving quaternion
74
+ * @param a the first operand
75
+ * @param b the second operand
76
+ * @returns out
77
+ */
78
+ export declare function multiply(out: Quat, a: Quat, b: Quat): Quat;
79
+ /**
80
+ * Rotates a quaternion by the given angle about the X axis
81
+ *
82
+ * @param out quat receiving operation result
83
+ * @param a quat to rotate
84
+ * @param rad angle (in radians) to rotate
85
+ * @returns out
86
+ */
87
+ export declare function rotateX(out: Quat, a: Quat, rad: number): Quat;
88
+ /**
89
+ * Rotates a quaternion by the given angle about the Y axis
90
+ *
91
+ * @param out quat receiving operation result
92
+ * @param a quat to rotate
93
+ * @param rad angle (in radians) to rotate
94
+ * @returns out
95
+ */
96
+ export declare function rotateY(out: Quat, a: Quat, rad: number): Quat;
97
+ /**
98
+ * Rotates a quaternion by the given angle about the Z axis
99
+ *
100
+ * @param out quat receiving operation result
101
+ * @param a quat to rotate
102
+ * @param rad angle (in radians) to rotate
103
+ * @returns out
104
+ */
105
+ export declare function rotateZ(out: Quat, a: Quat, rad: number): Quat;
106
+ /**
107
+ * Calculates the W component of a quat from the X, Y, and Z components.
108
+ * Assumes that quaternion is 1 unit in length.
109
+ * Any existing W component will be ignored.
110
+ *
111
+ * @param out the receiving quaternion
112
+ * @param a quat to calculate W component of
113
+ * @returns out
114
+ */
115
+ export declare function calculateW(out: Quat, a: Quat): Quat;
116
+ /**
117
+ * Calculate the exponential of a unit quaternion.
118
+ *
119
+ * @param out the receiving quaternion
120
+ * @param a quat to calculate the exponential of
121
+ * @returns out
122
+ */
123
+ export declare function exp(out: Quat, a: Quat): Quat;
124
+ /**
125
+ * Calculate the natural logarithm of a unit quaternion.
126
+ *
127
+ * @param out the receiving quaternion
128
+ * @param a quat to calculate the exponential of
129
+ * @returns out
130
+ */
131
+ export declare function ln(out: Quat, a: Quat): Quat;
132
+ /**
133
+ * Calculate the scalar power of a unit quaternion.
134
+ *
135
+ * @param out the receiving quaternion
136
+ * @param a quat to calculate the exponential of
137
+ * @param b amount to scale the quaternion by
138
+ * @returns out
139
+ */
140
+ export declare function pow(out: Quat, a: Quat, b: number): Quat;
141
+ /**
142
+ * Performs a spherical linear interpolation between two quat
143
+ *
144
+ * @param out the receiving quaternion
145
+ * @param a the first operand
146
+ * @param b the second operand
147
+ * @param t interpolation amount, in the range [0-1], between the two inputs
148
+ * @returns out
149
+ */
150
+ export declare function slerp(out: Quat, a: Quat, b: Quat, t: number): Quat;
151
+ /**
152
+ * Calculates the inverse of a quat
153
+ *
154
+ * @param out the receiving quaternion
155
+ * @param a quat to calculate inverse of
156
+ * @returns out
157
+ */
158
+ export declare function invert(out: Quat, a: Quat): Quat;
159
+ /**
160
+ * Calculates the conjugate of a quat
161
+ * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
162
+ *
163
+ * @param out the receiving quaternion
164
+ * @param a quat to calculate conjugate of
165
+ * @returns out
166
+ */
167
+ export declare function conjugate(out: Quat, a: Quat): Quat;
168
+ /**
169
+ * Creates a quaternion from the given 3x3 rotation matrix.
170
+ *
171
+ * NOTE: The resultant quaternion is not normalized, so you should be sure
172
+ * to renormalize the quaternion yourself where necessary.
173
+ *
174
+ * @param out the receiving quaternion
175
+ * @param m rotation matrix
176
+ * @returns out
177
+ */
178
+ export declare function fromMat3(out: Quat, m: Mat3): Quat;
179
+ /**
180
+ * Calculates a quaternion from a 4x4 rotation matrix
181
+ * Extracts the 3x3 rotation part and calls fromMat3
182
+ *
183
+ * @param out the receiving quaternion
184
+ * @param m rotation matrix
185
+ * @returns out
186
+ */
187
+ export declare function fromMat4(out: Quat, m: Mat4): Quat;
188
+ /**
189
+ * Creates a quaternion from the given euler
190
+ * @param out the receiving quaternion
191
+ * @param euler the euler to create the quaternion from
192
+ * @returns out
193
+ */
194
+ export declare function fromEuler(out: Quat, euler: Euler): Quat;
195
+ /**
196
+ * Creates a quaternion from euler angles specified in degrees.
197
+ * Shorthand for converting degrees to radians and then creating a quaternion from euler.
198
+ *
199
+ * @param out the receiving quaternion
200
+ * @param x The x euler rotation in degrees
201
+ * @param y The y euler rotation in degrees
202
+ * @param z The z euler rotation in degrees
203
+ * @param order The order of rotation
204
+ * @returns out
205
+ */
206
+ export declare function fromDegrees(out: Quat, x: number, y: number, z: number, order: EulerOrder): Quat;
207
+ /**
208
+ * Returns a string representation of a quaternion
209
+ *
210
+ * @param a vector to represent as a string
211
+ * @returns string representation of the vector
212
+ */
213
+ export declare function str(a: Quat): string;
214
+ /**
215
+ * Creates a new quat initialized with values from an existing quaternion
216
+ *
217
+ * @param a quaternion to clone
218
+ * @returns a new quaternion
219
+ */
220
+ export declare const clone: typeof vec4.clone;
221
+ /**
222
+ * Creates a new quat initialized with the given values
223
+ *
224
+ * @param x X component
225
+ * @param y Y component
226
+ * @param z Z component
227
+ * @param w W component
228
+ * @returns a new quaternion
229
+ */
230
+ export declare const fromValues: typeof vec4.fromValues;
231
+ /**
232
+ * Copy the values from one quat to another
233
+ *
234
+ * @param out the receiving quaternion
235
+ * @param a the source quaternion
236
+ * @returns out
237
+ */
238
+ export declare const copy: typeof vec4.copy;
239
+ /**
240
+ * Set the components of a quat to the given values
241
+ *
242
+ * @param out the receiving quaternion
243
+ * @param x X component
244
+ * @param y Y component
245
+ * @param z Z component
246
+ * @param w W component
247
+ * @returns out
248
+ */
249
+ export declare const set: typeof vec4.set;
250
+ /**
251
+ * Adds two quat's
252
+ *
253
+ * @param out the receiving quaternion
254
+ * @param a the first operand
255
+ * @param b the second operand
256
+ * @returns out
257
+ */
258
+ export declare const add: typeof vec4.add;
259
+ /**
260
+ * Scales a quat by a scalar number
261
+ *
262
+ * @param out the receiving quaternion
263
+ * @param a the quaternion to scale
264
+ * @param b amount to scale the quaternion by
265
+ * @returns out
266
+ */
267
+ export declare const scale: typeof vec4.scale;
268
+ /**
269
+ * Calculates the dot product of two quat's
270
+ *
271
+ * @param a the first operand
272
+ * @param b the second operand
273
+ * @returns dot product of a and b
274
+ */
275
+ export declare const dot: typeof vec4.dot;
276
+ /**
277
+ * Performs a linear interpolation between two quat's
278
+ *
279
+ * @param out the receiving quaternion
280
+ * @param a the first operand
281
+ * @param b the second operand
282
+ * @param t interpolation amount, in the range [0-1], between the two inputs
283
+ * @returns out
284
+ */
285
+ export declare const lerp: typeof vec4.lerp;
286
+ /**
287
+ * Calculates the length of a quat
288
+ *
289
+ * @param a quaternion to calculate length of
290
+ * @returns length of a
291
+ */
292
+ export declare const length: typeof vec4.length;
293
+ /**
294
+ * Alias for {@link length}
295
+ */
296
+ export declare const len: typeof vec4.length;
297
+ /**
298
+ * Calculates the squared length of a quat
299
+ *
300
+ * @param a quaternion to calculate squared length of
301
+ * @returns squared length of a
302
+ */
303
+ export declare const squaredLength: typeof vec4.squaredLength;
304
+ /**
305
+ * Alias for {@link squaredLength}
306
+ */
307
+ export declare const sqrLen: typeof vec4.squaredLength;
308
+ /**
309
+ * Alias for {@link multiply}
310
+ */
311
+ export declare const mul: typeof multiply;
312
+ /**
313
+ * Normalize a quat
314
+ *
315
+ * @param out the receiving quaternion
316
+ * @param a quaternion to normalize
317
+ * @returns out
318
+ */
319
+ export declare const normalize: typeof vec4.normalize;
320
+ /**
321
+ * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)
322
+ *
323
+ * @param a The first quaternion.
324
+ * @param b The second quaternion.
325
+ * @returns True if the quaternions are equal, false otherwise.
326
+ */
327
+ export declare const exactEquals: typeof vec4.exactEquals;
328
+ /**
329
+ * Returns whether or not the quaternions have approximately the same elements in the same position.
330
+ *
331
+ * @param a The first quaternion.
332
+ * @param b The second quaternion.
333
+ * @returns True if the quaternions are equal, false otherwise.
334
+ */
335
+ export declare function equals(a: Quat, b: Quat): boolean;
336
+ /**
337
+ * Sets a quaternion to represent the shortest rotation from one
338
+ * vector to another.
339
+ *
340
+ * Both vectors are assumed to be unit length.
341
+ *
342
+ * @param out the receiving quaternion.
343
+ * @param a the initial vector
344
+ * @param b the destination vector
345
+ * @returns out
346
+ */
347
+ export declare const rotationTo: (out: Quat, a: Vec3, b: Vec3) => Quat;
348
+ /**
349
+ * Performs a spherical linear interpolation with two control points
350
+ *
351
+ * @param out the receiving quaternion
352
+ * @param a the first operand
353
+ * @param b the second operand
354
+ * @param c the third operand
355
+ * @param d the fourth operand
356
+ * @param t interpolation amount, in the range [0-1], between the two inputs
357
+ * @returns out
358
+ */
359
+ export declare const sqlerp: (out: Quat, a: Quat, b: Quat, c: Quat, d: Quat, t: number) => Quat;
360
+ /**
361
+ * Sets the specified quaternion with values corresponding to the given
362
+ * axes. Each axis is a vec3 and is expected to be unit length and
363
+ * perpendicular to all other specified axes.
364
+ *
365
+ * @param view the vector representing the viewing direction
366
+ * @param right the vector representing the local "right" direction
367
+ * @param up the vector representing the local "up" direction
368
+ * @returns out
369
+ */
370
+ export declare const setAxes: (out: Quat, view: Vec3, right: Vec3, up: Vec3) => Quat;