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.
- package/API.md +1605 -0
- package/LICENSE +21 -0
- package/README.md +197 -0
- package/dist/color/color.js +136 -0
- package/dist/color/color.js.map +1 -0
- package/dist/color/colorspace.js +43 -0
- package/dist/color/colorspace.js.map +1 -0
- package/dist/color/hsl.js +123 -0
- package/dist/color/hsl.js.map +1 -0
- package/dist/color/index.js +7 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/parse.js +276 -0
- package/dist/color/parse.js.map +1 -0
- package/dist/core/angle.js +43 -0
- package/dist/core/angle.js.map +1 -0
- package/dist/core/euler.js +212 -0
- package/dist/core/euler.js.map +1 -0
- package/dist/core/mat2.js +385 -0
- package/dist/core/mat2.js.map +1 -0
- package/dist/core/mat2d.js +422 -0
- package/dist/core/mat2d.js.map +1 -0
- package/dist/core/mat3.js +749 -0
- package/dist/core/mat3.js.map +1 -0
- package/dist/core/mat4.js +2197 -0
- package/dist/core/mat4.js.map +1 -0
- package/dist/core/polar.js +200 -0
- package/dist/core/polar.js.map +1 -0
- package/dist/core/quat.js +730 -0
- package/dist/core/quat.js.map +1 -0
- package/dist/core/quat2.js +883 -0
- package/dist/core/quat2.js.map +1 -0
- package/dist/core/scalar.js +112 -0
- package/dist/core/scalar.js.map +1 -0
- package/dist/core/spherical.js +248 -0
- package/dist/core/spherical.js.map +1 -0
- package/dist/core/vec2.js +597 -0
- package/dist/core/vec2.js.map +1 -0
- package/dist/core/vec3.js +916 -0
- package/dist/core/vec3.js.map +1 -0
- package/dist/core/vec4.js +573 -0
- package/dist/core/vec4.js.map +1 -0
- package/dist/geometry/circumcircle.js +39 -0
- package/dist/geometry/circumcircle.js.map +1 -0
- package/dist/geometry/index.js +6 -0
- package/dist/geometry/index.js.map +1 -0
- package/dist/geometry/polygon2-decompose.js +411 -0
- package/dist/geometry/polygon2-decompose.js.map +1 -0
- package/dist/geometry/polygon2-triangulate.js +222 -0
- package/dist/geometry/polygon2-triangulate.js.map +1 -0
- package/dist/geometry/quickhull2.js +123 -0
- package/dist/geometry/quickhull2.js.map +1 -0
- package/dist/geometry/quickhull3.js +605 -0
- package/dist/geometry/quickhull3.js.map +1 -0
- package/dist/ik/fabrik2.js +675 -0
- package/dist/ik/fabrik2.js.map +1 -0
- package/dist/ik/fabrik3.js +912 -0
- package/dist/ik/fabrik3.js.map +1 -0
- package/dist/ik/index.js +5 -0
- package/dist/ik/index.js.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/noise/fractal.js +185 -0
- package/dist/noise/fractal.js.map +1 -0
- package/dist/noise/index.js +16 -0
- package/dist/noise/index.js.map +1 -0
- package/dist/noise/perlin2d.js +50 -0
- package/dist/noise/perlin2d.js.map +1 -0
- package/dist/noise/perlin3d.js +72 -0
- package/dist/noise/perlin3d.js.map +1 -0
- package/dist/noise/permutation.js +120 -0
- package/dist/noise/permutation.js.map +1 -0
- package/dist/noise/simplex2d.js +84 -0
- package/dist/noise/simplex2d.js.map +1 -0
- package/dist/noise/simplex3d.js +147 -0
- package/dist/noise/simplex3d.js.map +1 -0
- package/dist/noise/simplex4d.js +149 -0
- package/dist/noise/simplex4d.js.map +1 -0
- package/dist/noise/worley2d.js +50 -0
- package/dist/noise/worley2d.js.map +1 -0
- package/dist/noise/worley3d.js +61 -0
- package/dist/noise/worley3d.js.map +1 -0
- package/dist/random/index.js +9 -0
- package/dist/random/index.js.map +1 -0
- package/dist/random/isaac32.js +164 -0
- package/dist/random/isaac32.js.map +1 -0
- package/dist/random/isaac64.js +215 -0
- package/dist/random/isaac64.js.map +1 -0
- package/dist/random/mulberry32.js +48 -0
- package/dist/random/mulberry32.js.map +1 -0
- package/dist/random/random.js +120 -0
- package/dist/random/random.js.map +1 -0
- package/dist/shapes/box2.js +300 -0
- package/dist/shapes/box2.js.map +1 -0
- package/dist/shapes/box3.js +550 -0
- package/dist/shapes/box3.js.map +1 -0
- package/dist/shapes/circle.js +6 -0
- package/dist/shapes/circle.js.map +1 -0
- package/dist/shapes/frustum.js +662 -0
- package/dist/shapes/frustum.js.map +1 -0
- package/dist/shapes/index.js +25 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/obb3.js +557 -0
- package/dist/shapes/obb3.js.map +1 -0
- package/dist/shapes/plane3.js +267 -0
- package/dist/shapes/plane3.js.map +1 -0
- package/dist/shapes/polygon2.js +451 -0
- package/dist/shapes/polygon2.js.map +1 -0
- package/dist/shapes/raycast3.js +164 -0
- package/dist/shapes/raycast3.js.map +1 -0
- package/dist/shapes/segment2.js +82 -0
- package/dist/shapes/segment2.js.map +1 -0
- package/dist/shapes/sphere.js +23 -0
- package/dist/shapes/sphere.js.map +1 -0
- package/dist/shapes/triangle2.js +79 -0
- package/dist/shapes/triangle2.js.map +1 -0
- package/dist/shapes/triangle3.js +60 -0
- package/dist/shapes/triangle3.js.map +1 -0
- package/dist/src/color/color.d.ts +50 -0
- package/dist/src/color/colorspace.d.ts +15 -0
- package/dist/src/color/hsl.d.ts +28 -0
- package/dist/src/color/index.d.ts +5 -0
- package/dist/src/color/parse.d.ts +15 -0
- package/dist/src/core/angle.d.ts +29 -0
- package/dist/src/core/arrays.d.ts +4 -0
- package/dist/src/core/euler.d.ts +78 -0
- package/dist/src/core/index.d.ts +27 -0
- package/dist/src/core/mat2.d.ts +217 -0
- package/dist/src/core/mat2d.d.ts +218 -0
- package/dist/src/core/mat3.d.ts +295 -0
- package/dist/src/core/mat4.d.ts +667 -0
- package/dist/src/core/polar.d.ts +151 -0
- package/dist/src/core/quat.d.ts +370 -0
- package/dist/src/core/quat2.d.ts +344 -0
- package/dist/src/core/scalar.d.ts +75 -0
- package/dist/src/core/spherical.d.ts +165 -0
- package/dist/src/core/vec2.d.ts +403 -0
- package/dist/src/core/vec3.d.ts +493 -0
- package/dist/src/core/vec4.d.ts +336 -0
- package/dist/src/geometry/circumcircle.d.ts +9 -0
- package/dist/src/geometry/index.d.ts +5 -0
- package/dist/src/geometry/polygon2-decompose.d.ts +25 -0
- package/dist/src/geometry/polygon2-triangulate.d.ts +15 -0
- package/dist/src/geometry/quickhull2.d.ts +10 -0
- package/dist/src/geometry/quickhull3.d.ts +27 -0
- package/dist/src/ik/fabrik2.d.ts +314 -0
- package/dist/src/ik/fabrik3.d.ts +371 -0
- package/dist/src/ik/index.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/noise/fractal.d.ts +95 -0
- package/dist/src/noise/index.d.ts +9 -0
- package/dist/src/noise/perlin2d.d.ts +19 -0
- package/dist/src/noise/perlin3d.d.ts +20 -0
- package/dist/src/noise/permutation.d.ts +22 -0
- package/dist/src/noise/simplex2d.d.ts +19 -0
- package/dist/src/noise/simplex3d.d.ts +20 -0
- package/dist/src/noise/simplex4d.d.ts +24 -0
- package/dist/src/noise/worley2d.d.ts +22 -0
- package/dist/src/noise/worley3d.d.ts +23 -0
- package/dist/src/random/index.d.ts +8 -0
- package/dist/src/random/isaac32.d.ts +62 -0
- package/dist/src/random/isaac64.d.ts +75 -0
- package/dist/src/random/mulberry32.d.ts +43 -0
- package/dist/src/random/random.d.ts +67 -0
- package/dist/src/shapes/box2.d.ts +174 -0
- package/dist/src/shapes/box3.d.ts +213 -0
- package/dist/src/shapes/circle.d.ts +7 -0
- package/dist/src/shapes/frustum.d.ts +147 -0
- package/dist/src/shapes/index.d.ts +20 -0
- package/dist/src/shapes/obb3.d.ts +105 -0
- package/dist/src/shapes/plane3.d.ts +130 -0
- package/dist/src/shapes/polygon2.d.ts +155 -0
- package/dist/src/shapes/raycast3.d.ts +42 -0
- package/dist/src/shapes/segment2.d.ts +34 -0
- package/dist/src/shapes/sphere.d.ts +19 -0
- package/dist/src/shapes/triangle2.d.ts +53 -0
- package/dist/src/shapes/triangle3.d.ts +29 -0
- package/dist/src/time/easing.d.ts +21 -0
- package/dist/src/time/index.d.ts +6 -0
- package/dist/src/time/spring-core.d.ts +15 -0
- package/dist/src/time/spring.d.ts +36 -0
- package/dist/src/time/spring2.d.ts +11 -0
- package/dist/src/time/spring3.d.ts +11 -0
- package/dist/src/time/spring4.d.ts +11 -0
- package/dist/time/easing.js +24 -0
- package/dist/time/easing.js.map +1 -0
- package/dist/time/index.js +11 -0
- package/dist/time/index.js.map +1 -0
- package/dist/time/spring-core.js +48 -0
- package/dist/time/spring-core.js.map +1 -0
- package/dist/time/spring.js +62 -0
- package/dist/time/spring.js.map +1 -0
- package/dist/time/spring2.js +31 -0
- package/dist/time/spring2.js.map +1 -0
- package/dist/time/spring3.js +32 -0
- package/dist/time/spring3.js.map +1 -0
- package/dist/time/spring4.js +32 -0
- package/dist/time/spring4.js.map +1 -0
- package/package.json +90 -16
- package/skills/math/SKILL.md +140 -0
- package/AUTHORS +0 -1
- package/Cakefile +0 -28
- package/math.coffee +0 -112
- package/math.js +0 -141
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
import { EPSILON, round as round$1 } from './scalar.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new, empty vec2
|
|
5
|
+
*
|
|
6
|
+
* @returns a new 2D vector
|
|
7
|
+
*/
|
|
8
|
+
function create() {
|
|
9
|
+
return [0, 0];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new vec2 initialized with values from an existing vector
|
|
13
|
+
*
|
|
14
|
+
* @param a vector to clone
|
|
15
|
+
* @returns a new 2D vector
|
|
16
|
+
*/
|
|
17
|
+
function clone(a) {
|
|
18
|
+
return [a[0], a[1]];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new vec2 initialized with the given values
|
|
22
|
+
*
|
|
23
|
+
* @param x X component
|
|
24
|
+
* @param y Y component
|
|
25
|
+
* @returns a new 2D vector
|
|
26
|
+
*/
|
|
27
|
+
function fromValues(x, y) {
|
|
28
|
+
return [x, y];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Copy the values from one vec2 to another
|
|
32
|
+
*
|
|
33
|
+
* @param out the receiving vector
|
|
34
|
+
* @param a the source vector
|
|
35
|
+
* @returns out
|
|
36
|
+
*/
|
|
37
|
+
function copy(out, a) {
|
|
38
|
+
out[0] = a[0];
|
|
39
|
+
out[1] = a[1];
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Set the components of a vec2 to the given values
|
|
44
|
+
*
|
|
45
|
+
* @param out the receiving vector
|
|
46
|
+
* @param x X component
|
|
47
|
+
* @param y Y component
|
|
48
|
+
* @returns out
|
|
49
|
+
*/
|
|
50
|
+
function set(out, x, y) {
|
|
51
|
+
out[0] = x;
|
|
52
|
+
out[1] = y;
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Sets the components of a vec2 from a buffer
|
|
57
|
+
* @param out the receiving vector
|
|
58
|
+
* @param buffer the source buffer
|
|
59
|
+
* @param startIndex the starting index in the buffer
|
|
60
|
+
* @returns out
|
|
61
|
+
*/
|
|
62
|
+
function fromBuffer(out, buffer, startIndex) {
|
|
63
|
+
out[0] = buffer[startIndex];
|
|
64
|
+
out[1] = buffer[startIndex + 1];
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Writes the components of a vec2 to a buffer
|
|
69
|
+
* @param outBuffer The output buffer
|
|
70
|
+
* @param vec The source vector
|
|
71
|
+
* @param startIndex The starting index in the buffer
|
|
72
|
+
* @returns The output buffer
|
|
73
|
+
*/
|
|
74
|
+
function toBuffer(outBuffer, vec, startIndex) {
|
|
75
|
+
outBuffer[startIndex] = vec[0];
|
|
76
|
+
outBuffer[startIndex + 1] = vec[1];
|
|
77
|
+
return outBuffer;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Adds two vec2's
|
|
81
|
+
*
|
|
82
|
+
* @param out the receiving vector
|
|
83
|
+
* @param a the first operand
|
|
84
|
+
* @param b the second operand
|
|
85
|
+
* @returns out
|
|
86
|
+
*/
|
|
87
|
+
function add(out, a, b) {
|
|
88
|
+
out[0] = a[0] + b[0];
|
|
89
|
+
out[1] = a[1] + b[1];
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Adds a scalar value to all components of a vec2
|
|
94
|
+
*
|
|
95
|
+
* @param out the receiving vector
|
|
96
|
+
* @param a the source vector
|
|
97
|
+
* @param b the scalar value to add
|
|
98
|
+
* @returns out
|
|
99
|
+
*/
|
|
100
|
+
function addScalar(out, a, b) {
|
|
101
|
+
out[0] = a[0] + b;
|
|
102
|
+
out[1] = a[1] + b;
|
|
103
|
+
return out;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Subtracts vector b from vector a
|
|
107
|
+
*
|
|
108
|
+
* @param out the receiving vector
|
|
109
|
+
* @param a the first operand
|
|
110
|
+
* @param b the second operand
|
|
111
|
+
* @returns out
|
|
112
|
+
*/
|
|
113
|
+
function subtract(out, a, b) {
|
|
114
|
+
out[0] = a[0] - b[0];
|
|
115
|
+
out[1] = a[1] - b[1];
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Subtracts a scalar value from all components of a vec2
|
|
120
|
+
*
|
|
121
|
+
* @param out the receiving vector
|
|
122
|
+
* @param a the source vector
|
|
123
|
+
* @param b the scalar value to subtract
|
|
124
|
+
* @returns out
|
|
125
|
+
*/
|
|
126
|
+
function subtractScalar(out, a, b) {
|
|
127
|
+
out[0] = a[0] - b;
|
|
128
|
+
out[1] = a[1] - b;
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Multiplies two vec2's
|
|
133
|
+
*
|
|
134
|
+
* @param out the receiving vector
|
|
135
|
+
* @param a the first operand
|
|
136
|
+
* @param b the second operand
|
|
137
|
+
* @returns out
|
|
138
|
+
*/
|
|
139
|
+
function multiply(out, a, b) {
|
|
140
|
+
out[0] = a[0] * b[0];
|
|
141
|
+
out[1] = a[1] * b[1];
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Divides two vec2's
|
|
146
|
+
*
|
|
147
|
+
* @param out the receiving vector
|
|
148
|
+
* @param a the first operand
|
|
149
|
+
* @param b the second operand
|
|
150
|
+
* @returns out
|
|
151
|
+
*/
|
|
152
|
+
function divide(out, a, b) {
|
|
153
|
+
out[0] = a[0] / b[0];
|
|
154
|
+
out[1] = a[1] / b[1];
|
|
155
|
+
return out;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Math.ceil the components of a vec2
|
|
159
|
+
*
|
|
160
|
+
* @param out the receiving vector
|
|
161
|
+
* @param a vector to ceil
|
|
162
|
+
* @returns out
|
|
163
|
+
*/
|
|
164
|
+
function ceil(out, a) {
|
|
165
|
+
out[0] = Math.ceil(a[0]);
|
|
166
|
+
out[1] = Math.ceil(a[1]);
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Math.floor the components of a vec2
|
|
171
|
+
*
|
|
172
|
+
* @param out the receiving vector
|
|
173
|
+
* @param a vector to floor
|
|
174
|
+
* @returns out
|
|
175
|
+
*/
|
|
176
|
+
function floor(out, a) {
|
|
177
|
+
out[0] = Math.floor(a[0]);
|
|
178
|
+
out[1] = Math.floor(a[1]);
|
|
179
|
+
return out;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Returns the minimum of two vec2's
|
|
183
|
+
*
|
|
184
|
+
* @param out the receiving vector
|
|
185
|
+
* @param a the first operand
|
|
186
|
+
* @param b the second operand
|
|
187
|
+
* @returns out
|
|
188
|
+
*/
|
|
189
|
+
function min(out, a, b) {
|
|
190
|
+
out[0] = Math.min(a[0], b[0]);
|
|
191
|
+
out[1] = Math.min(a[1], b[1]);
|
|
192
|
+
return out;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Returns the maximum of two vec2's
|
|
196
|
+
*
|
|
197
|
+
* @param out the receiving vector
|
|
198
|
+
* @param a the first operand
|
|
199
|
+
* @param b the second operand
|
|
200
|
+
* @returns out
|
|
201
|
+
*/
|
|
202
|
+
function max(out, a, b) {
|
|
203
|
+
out[0] = Math.max(a[0], b[0]);
|
|
204
|
+
out[1] = Math.max(a[1], b[1]);
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* symmetric round the components of a vec2
|
|
209
|
+
*
|
|
210
|
+
* @param out the receiving vector
|
|
211
|
+
* @param a vector to round
|
|
212
|
+
* @returns out
|
|
213
|
+
*/
|
|
214
|
+
function round(out, a) {
|
|
215
|
+
out[0] = round$1(a[0]);
|
|
216
|
+
out[1] = round$1(a[1]);
|
|
217
|
+
return out;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Scales a vec2 by a scalar number
|
|
221
|
+
*
|
|
222
|
+
* @param out the receiving vector
|
|
223
|
+
* @param a the vector to scale
|
|
224
|
+
* @param b amount to scale the vector by
|
|
225
|
+
* @returns out
|
|
226
|
+
*/
|
|
227
|
+
function scale(out, a, b) {
|
|
228
|
+
out[0] = a[0] * b;
|
|
229
|
+
out[1] = a[1] * b;
|
|
230
|
+
return out;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Adds two vec2's after scaling the second operand by a scalar value
|
|
234
|
+
*
|
|
235
|
+
* @param out the receiving vector
|
|
236
|
+
* @param a the first operand
|
|
237
|
+
* @param b the second operand
|
|
238
|
+
* @param scale the amount to scale b by before adding
|
|
239
|
+
* @returns out
|
|
240
|
+
*/
|
|
241
|
+
function scaleAndAdd(out, a, b, scale) {
|
|
242
|
+
out[0] = a[0] + b[0] * scale;
|
|
243
|
+
out[1] = a[1] + b[1] * scale;
|
|
244
|
+
return out;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Calculates the euclidian distance between two vec2's
|
|
248
|
+
*
|
|
249
|
+
* @param a the first operand
|
|
250
|
+
* @param b the second operand
|
|
251
|
+
* @returns distance between a and b
|
|
252
|
+
*/
|
|
253
|
+
function distance(a, b) {
|
|
254
|
+
const x = b[0] - a[0];
|
|
255
|
+
const y = b[1] - a[1];
|
|
256
|
+
return Math.sqrt(x * x + y * y);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Calculates the squared euclidian distance between two vec2's
|
|
260
|
+
*
|
|
261
|
+
* @param a the first operand
|
|
262
|
+
* @param b the second operand
|
|
263
|
+
* @returns squared distance between a and b
|
|
264
|
+
*/
|
|
265
|
+
function squaredDistance(a, b) {
|
|
266
|
+
const x = b[0] - a[0];
|
|
267
|
+
const y = b[1] - a[1];
|
|
268
|
+
return x * x + y * y;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Calculates the length of a vec2
|
|
272
|
+
*
|
|
273
|
+
* @param a vector to calculate length of
|
|
274
|
+
* @returns length of a
|
|
275
|
+
*/
|
|
276
|
+
function length(a) {
|
|
277
|
+
const x = a[0];
|
|
278
|
+
const y = a[1];
|
|
279
|
+
return Math.sqrt(x * x + y * y);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Calculates the squared length of a vec2
|
|
283
|
+
*
|
|
284
|
+
* @param a vector to calculate squared length of
|
|
285
|
+
* @returns squared length of a
|
|
286
|
+
*/
|
|
287
|
+
function squaredLength(a) {
|
|
288
|
+
const x = a[0];
|
|
289
|
+
const y = a[1];
|
|
290
|
+
return x * x + y * y;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Negates the components of a vec2
|
|
294
|
+
*
|
|
295
|
+
* @param out the receiving vector
|
|
296
|
+
* @param a vector to negate
|
|
297
|
+
* @returns out
|
|
298
|
+
*/
|
|
299
|
+
function negate(out, a) {
|
|
300
|
+
out[0] = -a[0];
|
|
301
|
+
out[1] = -a[1];
|
|
302
|
+
return out;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Returns the inverse of the components of a vec2
|
|
306
|
+
*
|
|
307
|
+
* @param out the receiving vector
|
|
308
|
+
* @param a vector to invert
|
|
309
|
+
* @returns out
|
|
310
|
+
*/
|
|
311
|
+
function inverse(out, a) {
|
|
312
|
+
out[0] = 1.0 / a[0];
|
|
313
|
+
out[1] = 1.0 / a[1];
|
|
314
|
+
return out;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Normalize a vec2
|
|
318
|
+
*
|
|
319
|
+
* @param out the receiving vector
|
|
320
|
+
* @param a vector to normalize
|
|
321
|
+
* @returns out
|
|
322
|
+
*/
|
|
323
|
+
function normalize(out, a) {
|
|
324
|
+
const x = a[0];
|
|
325
|
+
const y = a[1];
|
|
326
|
+
let len = x * x + y * y;
|
|
327
|
+
if (len > 0) {
|
|
328
|
+
len = 1 / Math.sqrt(len);
|
|
329
|
+
}
|
|
330
|
+
out[0] = a[0] * len;
|
|
331
|
+
out[1] = a[1] * len;
|
|
332
|
+
return out;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Calculates the dot product of two vec2's
|
|
336
|
+
*
|
|
337
|
+
* @param a the first operand
|
|
338
|
+
* @param b the second operand
|
|
339
|
+
* @returns dot product of a and b
|
|
340
|
+
*/
|
|
341
|
+
function dot(a, b) {
|
|
342
|
+
return a[0] * b[0] + a[1] * b[1];
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Computes the cross product of two vec2's
|
|
346
|
+
* Note that the cross product must by definition produce a 3D vector
|
|
347
|
+
*
|
|
348
|
+
* @param out the receiving vector
|
|
349
|
+
* @param a the first operand
|
|
350
|
+
* @param b the second operand
|
|
351
|
+
* @returns out
|
|
352
|
+
*/
|
|
353
|
+
function cross(out, a, b) {
|
|
354
|
+
const z = a[0] * b[1] - a[1] * b[0];
|
|
355
|
+
out[0] = out[1] = 0;
|
|
356
|
+
out[2] = z;
|
|
357
|
+
return out;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Performs a linear interpolation between two vec2's
|
|
361
|
+
*
|
|
362
|
+
* @param out the receiving vector
|
|
363
|
+
* @param a the first operand
|
|
364
|
+
* @param b the second operand
|
|
365
|
+
* @param t interpolation amount, in the range [0-1], between the two inputs
|
|
366
|
+
* @returns out
|
|
367
|
+
*/
|
|
368
|
+
function lerp(out, a, b, t) {
|
|
369
|
+
const ax = a[0];
|
|
370
|
+
const ay = a[1];
|
|
371
|
+
out[0] = ax + t * (b[0] - ax);
|
|
372
|
+
out[1] = ay + t * (b[1] - ay);
|
|
373
|
+
return out;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Quadratic interpolation through three vectors using Lagrange interpolation.
|
|
377
|
+
* Passes through a at t=0, b at t=0.5, and c at t=1.
|
|
378
|
+
*
|
|
379
|
+
* @param out the receiving vector
|
|
380
|
+
* @param a vector at t=0
|
|
381
|
+
* @param b vector at t=0.5
|
|
382
|
+
* @param c vector at t=1
|
|
383
|
+
* @param t interpolation amount
|
|
384
|
+
* @returns out
|
|
385
|
+
*/
|
|
386
|
+
function lagrange(out, a, b, c, t) {
|
|
387
|
+
const c0 = 2 * (t - 1) * (t - 0.5);
|
|
388
|
+
const c1 = -4 * (t - 1) * t;
|
|
389
|
+
const c2 = 2 * (t - 0.5) * t;
|
|
390
|
+
out[0] = c0 * a[0] + c1 * b[0] + c2 * c[0];
|
|
391
|
+
out[1] = c0 * a[1] + c1 * b[1] + c2 * c[1];
|
|
392
|
+
return out;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Transforms the vec2 with a mat2
|
|
396
|
+
*
|
|
397
|
+
* @param out the receiving vector
|
|
398
|
+
* @param a the vector to transform
|
|
399
|
+
* @param m matrix to transform with
|
|
400
|
+
* @returns out
|
|
401
|
+
*/
|
|
402
|
+
function transformMat2(out, a, m) {
|
|
403
|
+
const x = a[0];
|
|
404
|
+
const y = a[1];
|
|
405
|
+
out[0] = m[0] * x + m[2] * y;
|
|
406
|
+
out[1] = m[1] * x + m[3] * y;
|
|
407
|
+
return out;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Transforms the vec2 with a mat2d
|
|
411
|
+
*
|
|
412
|
+
* @param out the receiving vector
|
|
413
|
+
* @param a the vector to transform
|
|
414
|
+
* @param m matrix to transform with
|
|
415
|
+
* @returns out
|
|
416
|
+
*/
|
|
417
|
+
function transformMat2d(out, a, m) {
|
|
418
|
+
const x = a[0];
|
|
419
|
+
const y = a[1];
|
|
420
|
+
out[0] = m[0] * x + m[2] * y + m[4];
|
|
421
|
+
out[1] = m[1] * x + m[3] * y + m[5];
|
|
422
|
+
return out;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Transforms the vec2 with a mat3
|
|
426
|
+
* 3rd vector component is implicitly '1'
|
|
427
|
+
*
|
|
428
|
+
* @param out the receiving vector
|
|
429
|
+
* @param a the vector to transform
|
|
430
|
+
* @param m matrix to transform with
|
|
431
|
+
* @returns out
|
|
432
|
+
*/
|
|
433
|
+
function transformMat3(out, a, m) {
|
|
434
|
+
const x = a[0];
|
|
435
|
+
const y = a[1];
|
|
436
|
+
out[0] = m[0] * x + m[3] * y + m[6];
|
|
437
|
+
out[1] = m[1] * x + m[4] * y + m[7];
|
|
438
|
+
return out;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Transforms the vec2 with a mat4
|
|
442
|
+
* 3rd vector component is implicitly '0'
|
|
443
|
+
* 4th vector component is implicitly '1'
|
|
444
|
+
*
|
|
445
|
+
* @param out the receiving vector
|
|
446
|
+
* @param a the vector to transform
|
|
447
|
+
* @param m matrix to transform with
|
|
448
|
+
* @returns out
|
|
449
|
+
*/
|
|
450
|
+
function transformMat4(out, a, m) {
|
|
451
|
+
const x = a[0];
|
|
452
|
+
const y = a[1];
|
|
453
|
+
out[0] = m[0] * x + m[4] * y + m[12];
|
|
454
|
+
out[1] = m[1] * x + m[5] * y + m[13];
|
|
455
|
+
return out;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Rotate a 2D vector
|
|
459
|
+
* @param out The receiving vec2
|
|
460
|
+
* @param a The vec2 point to rotate
|
|
461
|
+
* @param b The origin of the rotation
|
|
462
|
+
* @param rad The angle of rotation in radians
|
|
463
|
+
* @returns out
|
|
464
|
+
*/
|
|
465
|
+
function rotate(out, a, b, rad) {
|
|
466
|
+
//Translate point to the origin
|
|
467
|
+
const p0 = a[0] - b[0];
|
|
468
|
+
const p1 = a[1] - b[1];
|
|
469
|
+
const sinC = Math.sin(rad);
|
|
470
|
+
const cosC = Math.cos(rad);
|
|
471
|
+
//perform rotation and translate to correct position
|
|
472
|
+
out[0] = p0 * cosC - p1 * sinC + b[0];
|
|
473
|
+
out[1] = p0 * sinC + p1 * cosC + b[1];
|
|
474
|
+
return out;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Get the angle between two 2D vectors
|
|
478
|
+
* @param a The first operand
|
|
479
|
+
* @param b The second operand
|
|
480
|
+
* @returns The angle in radians
|
|
481
|
+
*/
|
|
482
|
+
function angle(a, b) {
|
|
483
|
+
const x1 = a[0];
|
|
484
|
+
const y1 = a[1];
|
|
485
|
+
const x2 = b[0];
|
|
486
|
+
const y2 = b[1];
|
|
487
|
+
// mag is the product of the magnitudes of a and b
|
|
488
|
+
const mag = Math.sqrt((x1 * x1 + y1 * y1) * (x2 * x2 + y2 * y2));
|
|
489
|
+
// mag &&.. short circuits if mag == 0
|
|
490
|
+
const cosine = mag && (x1 * x2 + y1 * y2) / mag;
|
|
491
|
+
// Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1
|
|
492
|
+
return Math.acos(Math.min(Math.max(cosine, -1), 1));
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Get the signed angle from `a` to `b`, in the range (-PI, PI].
|
|
496
|
+
*
|
|
497
|
+
* Positive is counter-clockwise. Returns 0 if either vector is zero length.
|
|
498
|
+
*
|
|
499
|
+
* Unlike {@link angle}, this distinguishes the two directions of rotation, which is what
|
|
500
|
+
* joint limits and turn directions need.
|
|
501
|
+
*
|
|
502
|
+
* @param a the first operand
|
|
503
|
+
* @param b the second operand
|
|
504
|
+
* @returns the signed angle in radians
|
|
505
|
+
*/
|
|
506
|
+
function signedAngle(a, b) {
|
|
507
|
+
const ax = a[0];
|
|
508
|
+
const ay = a[1];
|
|
509
|
+
const bx = b[0];
|
|
510
|
+
const by = b[1];
|
|
511
|
+
// the 2D cross product is |a||b|sin(theta), the dot product is |a||b|cos(theta)
|
|
512
|
+
return Math.atan2(ax * by - ay * bx, ax * bx + ay * by);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Set the components of a vec2 to zero
|
|
516
|
+
*
|
|
517
|
+
* @param out the receiving vector
|
|
518
|
+
* @returns out
|
|
519
|
+
*/
|
|
520
|
+
function zero(out) {
|
|
521
|
+
out[0] = 0.0;
|
|
522
|
+
out[1] = 0.0;
|
|
523
|
+
return out;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Returns a string representation of a vector
|
|
527
|
+
*
|
|
528
|
+
* @param a vector to represent as a string
|
|
529
|
+
* @returns string representation of the vector
|
|
530
|
+
*/
|
|
531
|
+
function str(a) {
|
|
532
|
+
return `vec2(${a[0]}, ${a[1]})`;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
|
|
536
|
+
*
|
|
537
|
+
* @param a The first vector.
|
|
538
|
+
* @param b The second vector.
|
|
539
|
+
* @returns True if the vectors are equal, false otherwise.
|
|
540
|
+
*/
|
|
541
|
+
function exactEquals(a, b) {
|
|
542
|
+
return a[0] === b[0] && a[1] === b[1];
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Returns whether or not the vectors have approximately the same elements in the same position.
|
|
546
|
+
*
|
|
547
|
+
* @param a The first vector.
|
|
548
|
+
* @param b The second vector.
|
|
549
|
+
* @returns True if the vectors are equal, false otherwise.
|
|
550
|
+
*/
|
|
551
|
+
function equals(a, b) {
|
|
552
|
+
const a0 = a[0];
|
|
553
|
+
const a1 = a[1];
|
|
554
|
+
const b0 = b[0];
|
|
555
|
+
const b1 = b[1];
|
|
556
|
+
return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&
|
|
557
|
+
Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)));
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Returns whether or not the vector is finite
|
|
561
|
+
* @param a vector to test
|
|
562
|
+
* @returns whether or not the vector is finite
|
|
563
|
+
*/
|
|
564
|
+
function finite(a) {
|
|
565
|
+
return Number.isFinite(a[0]) && Number.isFinite(a[1]);
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Alias for {@link length}
|
|
569
|
+
*/
|
|
570
|
+
const len = length;
|
|
571
|
+
/**
|
|
572
|
+
* Alias for {@link subtract}
|
|
573
|
+
*/
|
|
574
|
+
const sub = subtract;
|
|
575
|
+
/**
|
|
576
|
+
* Alias for {@link multiply}
|
|
577
|
+
*/
|
|
578
|
+
const mul = multiply;
|
|
579
|
+
/**
|
|
580
|
+
* Alias for {@link divide}
|
|
581
|
+
*/
|
|
582
|
+
const div = divide;
|
|
583
|
+
/**
|
|
584
|
+
* Alias for {@link distance}
|
|
585
|
+
*/
|
|
586
|
+
const dist = distance;
|
|
587
|
+
/**
|
|
588
|
+
* Alias for {@link squaredDistance}
|
|
589
|
+
*/
|
|
590
|
+
const sqrDist = squaredDistance;
|
|
591
|
+
/**
|
|
592
|
+
* Alias for {@link squaredLength}
|
|
593
|
+
*/
|
|
594
|
+
const sqrLen = squaredLength;
|
|
595
|
+
|
|
596
|
+
export { add, addScalar, angle, ceil, clone, copy, create, cross, dist, distance, div, divide, dot, equals, exactEquals, finite, floor, fromBuffer, fromValues, inverse, lagrange, len, length, lerp, max, min, mul, multiply, negate, normalize, rotate, round, scale, scaleAndAdd, set, signedAngle, sqrDist, sqrLen, squaredDistance, squaredLength, str, sub, subtract, subtractScalar, toBuffer, transformMat2, transformMat2d, transformMat3, transformMat4, zero };
|
|
597
|
+
//# sourceMappingURL=vec2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vec2.js","sources":["../../src/core/vec2.ts"],"sourcesContent":["import type { MutableArrayLike } from './arrays';\nimport type { Mat2 } from './mat2';\nimport type { Mat2d } from './mat2d';\nimport type { Mat3 } from './mat3';\nimport type { Mat4 } from './mat4';\nimport * as scalar from './scalar';\nimport type { Vec3 } from './vec3';\n\n/** A 2D vector */\nexport type Vec2 = [x: number, y: number];\n\n/**\n * Creates a new, empty vec2\n *\n * @returns a new 2D vector\n */\nexport function create(): Vec2 {\n return [0, 0];\n}\n\n/**\n * Creates a new vec2 initialized with values from an existing vector\n *\n * @param a vector to clone\n * @returns a new 2D vector\n */\nexport function clone(a: Vec2): Vec2 {\n return [a[0], a[1]];\n}\n\n/**\n * Creates a new vec2 initialized with the given values\n *\n * @param x X component\n * @param y Y component\n * @returns a new 2D vector\n */\nexport function fromValues(x: number, y: number): Vec2 {\n return [x, y];\n}\n\n/**\n * Copy the values from one vec2 to another\n *\n * @param out the receiving vector\n * @param a the source vector\n * @returns out\n */\nexport function copy(out: Vec2, a: Vec2): Vec2 {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n\n/**\n * Set the components of a vec2 to the given values\n *\n * @param out the receiving vector\n * @param x X component\n * @param y Y component\n * @returns out\n */\nexport function set(out: Vec2, x: number, y: number): Vec2 {\n out[0] = x;\n out[1] = y;\n return out;\n}\n\n/**\n * Sets the components of a vec2 from a buffer\n * @param out the receiving vector\n * @param buffer the source buffer\n * @param startIndex the starting index in the buffer\n * @returns out\n */\nexport function fromBuffer(out: Vec2, buffer: ArrayLike<number>, startIndex: number): Vec2 {\n out[0] = buffer[startIndex];\n out[1] = buffer[startIndex + 1];\n return out;\n}\n\n/**\n * Writes the components of a vec2 to a buffer\n * @param outBuffer The output buffer\n * @param vec The source vector\n * @param startIndex The starting index in the buffer\n * @returns The output buffer\n */\nexport function toBuffer(outBuffer: MutableArrayLike<number>, vec: Vec2, startIndex: number): MutableArrayLike<number> {\n outBuffer[startIndex] = vec[0];\n outBuffer[startIndex + 1] = vec[1];\n return outBuffer;\n}\n\n/**\n * Adds two vec2's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function add(out: Vec2, a: Vec2, b: Vec2): Vec2 {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n}\n\n/**\n * Adds a scalar value to all components of a vec2\n *\n * @param out the receiving vector\n * @param a the source vector\n * @param b the scalar value to add\n * @returns out\n */\nexport function addScalar(out: Vec2, a: Vec2, b: number): Vec2 {\n out[0] = a[0] + b;\n out[1] = a[1] + b;\n return out;\n}\n\n/**\n * Subtracts vector b from vector a\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function subtract(out: Vec2, a: Vec2, b: Vec2): Vec2 {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n}\n\n/**\n * Subtracts a scalar value from all components of a vec2\n *\n * @param out the receiving vector\n * @param a the source vector\n * @param b the scalar value to subtract\n * @returns out\n */\nexport function subtractScalar(out: Vec2, a: Vec2, b: number): Vec2 {\n out[0] = a[0] - b;\n out[1] = a[1] - b;\n return out;\n}\n\n/**\n * Multiplies two vec2's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function multiply(out: Vec2, a: Vec2, b: Vec2): Vec2 {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n}\n\n/**\n * Divides two vec2's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function divide(out: Vec2, a: Vec2, b: Vec2): Vec2 {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n}\n\n/**\n * Math.ceil the components of a vec2\n *\n * @param out the receiving vector\n * @param a vector to ceil\n * @returns out\n */\nexport function ceil(out: Vec2, a: Vec2): Vec2 {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n}\n\n/**\n * Math.floor the components of a vec2\n *\n * @param out the receiving vector\n * @param a vector to floor\n * @returns out\n */\nexport function floor(out: Vec2, a: Vec2): Vec2 {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n}\n\n/**\n * Returns the minimum of two vec2's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function min(out: Vec2, a: Vec2, b: Vec2): Vec2 {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n}\n\n/**\n * Returns the maximum of two vec2's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function max(out: Vec2, a: Vec2, b: Vec2): Vec2 {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n}\n\n/**\n * symmetric round the components of a vec2\n *\n * @param out the receiving vector\n * @param a vector to round\n * @returns out\n */\nexport function round(out: Vec2, a: Vec2): Vec2 {\n out[0] = scalar.round(a[0]);\n out[1] = scalar.round(a[1]);\n return out;\n}\n\n/**\n * Scales a vec2 by a scalar number\n *\n * @param out the receiving vector\n * @param a the vector to scale\n * @param b amount to scale the vector by\n * @returns out\n */\nexport function scale(out: Vec2, a: Vec2, b: number): Vec2 {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n}\n\n/**\n * Adds two vec2's after scaling the second operand by a scalar value\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @param scale the amount to scale b by before adding\n * @returns out\n */\nexport function scaleAndAdd(out: Vec2, a: Vec2, b: Vec2, scale: number): Vec2 {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n}\n\n/**\n * Calculates the euclidian distance between two vec2's\n *\n * @param a the first operand\n * @param b the second operand\n * @returns distance between a and b\n */\nexport function distance(a: Vec2, b: Vec2): number {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n return Math.sqrt(x * x + y * y);\n}\n\n/**\n * Calculates the squared euclidian distance between two vec2's\n *\n * @param a the first operand\n * @param b the second operand\n * @returns squared distance between a and b\n */\nexport function squaredDistance(a: Vec2, b: Vec2): number {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n return x * x + y * y;\n}\n\n/**\n * Calculates the length of a vec2\n *\n * @param a vector to calculate length of\n * @returns length of a\n */\nexport function length(a: Vec2): number {\n const x = a[0];\n const y = a[1];\n return Math.sqrt(x * x + y * y);\n}\n\n/**\n * Calculates the squared length of a vec2\n *\n * @param a vector to calculate squared length of\n * @returns squared length of a\n */\nexport function squaredLength(a: Vec2): number {\n const x = a[0];\n const y = a[1];\n return x * x + y * y;\n}\n\n/**\n * Negates the components of a vec2\n *\n * @param out the receiving vector\n * @param a vector to negate\n * @returns out\n */\nexport function negate(out: Vec2, a: Vec2): Vec2 {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n}\n\n/**\n * Returns the inverse of the components of a vec2\n *\n * @param out the receiving vector\n * @param a vector to invert\n * @returns out\n */\nexport function inverse(out: Vec2, a: Vec2): Vec2 {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n}\n\n/**\n * Normalize a vec2\n *\n * @param out the receiving vector\n * @param a vector to normalize\n * @returns out\n */\nexport function normalize(out: Vec2, a: Vec2): Vec2 {\n const x = a[0];\n const y = a[1];\n let len = x * x + y * y;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n}\n\n/**\n * Calculates the dot product of two vec2's\n *\n * @param a the first operand\n * @param b the second operand\n * @returns dot product of a and b\n */\nexport function dot(a: Vec2, b: Vec2): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the cross product of two vec2's\n * Note that the cross product must by definition produce a 3D vector\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function cross(out: Vec3, a: Vec2, b: Vec2): Vec3 {\n const z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n}\n\n/**\n * Performs a linear interpolation between two vec2's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @param t interpolation amount, in the range [0-1], between the two inputs\n * @returns out\n */\nexport function lerp(out: Vec2, a: Vec2, b: Vec2, t: number): Vec2 {\n const ax = a[0];\n const ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n}\n\n/**\n * Quadratic interpolation through three vectors using Lagrange interpolation.\n * Passes through a at t=0, b at t=0.5, and c at t=1.\n *\n * @param out the receiving vector\n * @param a vector at t=0\n * @param b vector at t=0.5\n * @param c vector at t=1\n * @param t interpolation amount\n * @returns out\n */\nexport function lagrange(out: Vec2, a: Vec2, b: Vec2, c: Vec2, t: number): Vec2 {\n const c0 = 2 * (t - 1) * (t - 0.5);\n const c1 = -4 * (t - 1) * t;\n const c2 = 2 * (t - 0.5) * t;\n out[0] = c0 * a[0] + c1 * b[0] + c2 * c[0];\n out[1] = c0 * a[1] + c1 * b[1] + c2 * c[1];\n return out;\n}\n\n/**\n * Transforms the vec2 with a mat2\n *\n * @param out the receiving vector\n * @param a the vector to transform\n * @param m matrix to transform with\n * @returns out\n */\nexport function transformMat2(out: Vec2, a: Vec2, m: Mat2): Vec2 {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n}\n\n/**\n * Transforms the vec2 with a mat2d\n *\n * @param out the receiving vector\n * @param a the vector to transform\n * @param m matrix to transform with\n * @returns out\n */\nexport function transformMat2d(out: Vec2, a: Vec2, m: Mat2d): Vec2 {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\n\n/**\n * Transforms the vec2 with a mat3\n * 3rd vector component is implicitly '1'\n *\n * @param out the receiving vector\n * @param a the vector to transform\n * @param m matrix to transform with\n * @returns out\n */\nexport function transformMat3(out: Vec2, a: Vec2, m: Mat3): Vec2 {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n}\n\n/**\n * Transforms the vec2 with a mat4\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param out the receiving vector\n * @param a the vector to transform\n * @param m matrix to transform with\n * @returns out\n */\nexport function transformMat4(out: Vec2, a: Vec2, m: Mat4): Vec2 {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n}\n\n/**\n * Rotate a 2D vector\n * @param out The receiving vec2\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns out\n */\nexport function rotate(out: Vec2, a: Vec2, b: Vec2, rad: number): Vec2 {\n //Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n\n return out;\n}\n\n/**\n * Get the angle between two 2D vectors\n * @param a The first operand\n * @param b The second operand\n * @returns The angle in radians\n */\nexport function angle(a: Vec2, b: Vec2): number {\n const x1 = a[0];\n const y1 = a[1];\n const x2 = b[0];\n const y2 = b[1];\n // mag is the product of the magnitudes of a and b\n const mag = Math.sqrt((x1 * x1 + y1 * y1) * (x2 * x2 + y2 * y2));\n // mag &&.. short circuits if mag == 0\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n\n/**\n * Get the signed angle from `a` to `b`, in the range (-PI, PI].\n *\n * Positive is counter-clockwise. Returns 0 if either vector is zero length.\n *\n * Unlike {@link angle}, this distinguishes the two directions of rotation, which is what\n * joint limits and turn directions need.\n *\n * @param a the first operand\n * @param b the second operand\n * @returns the signed angle in radians\n */\nexport function signedAngle(a: Vec2, b: Vec2): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n\n // the 2D cross product is |a||b|sin(theta), the dot product is |a||b|cos(theta)\n return Math.atan2(ax * by - ay * bx, ax * bx + ay * by);\n}\n\n/**\n * Set the components of a vec2 to zero\n *\n * @param out the receiving vector\n * @returns out\n */\nexport function zero(out: Vec2): Vec2 {\n out[0] = 0.0;\n out[1] = 0.0;\n return out;\n}\n\n/**\n * Returns a string representation of a vector\n *\n * @param a vector to represent as a string\n * @returns string representation of the vector\n */\nexport function str(a: Vec2): string {\n return `vec2(${a[0]}, ${a[1]})`;\n}\n\n/**\n * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)\n *\n * @param a The first vector.\n * @param b The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\nexport function exactEquals(a: Vec2, b: Vec2): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param a The first vector.\n * @param b The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\nexport function equals(a: Vec2, b: Vec2): boolean {\n const a0 = a[0];\n const a1 = a[1];\n const b0 = b[0];\n const b1 = b[1];\n return (\n Math.abs(a0 - b0) <= scalar.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= scalar.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\n );\n}\n\n/**\n * Returns whether or not the vector is finite\n * @param a vector to test\n * @returns whether or not the vector is finite\n */\nexport function finite(a: Vec2): boolean {\n return Number.isFinite(a[0]) && Number.isFinite(a[1]);\n}\n\n/**\n * Alias for {@link length}\n */\nexport const len = length;\n\n/**\n * Alias for {@link subtract}\n */\nexport const sub = subtract;\n\n/**\n * Alias for {@link multiply}\n */\nexport const mul = multiply;\n\n/**\n * Alias for {@link divide}\n */\nexport const div = divide;\n\n/**\n * Alias for {@link distance}\n */\nexport const dist = distance;\n\n/**\n * Alias for {@link squaredDistance}\n */\nexport const sqrDist = squaredDistance;\n\n/**\n * Alias for {@link squaredLength}\n */\nexport const sqrLen = squaredLength;\n"],"names":["scalar.round","scalar.EPSILON"],"mappings":";;AAWA;;;;AAIG;SACa,MAAM,GAAA;AAClB,IAAA,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACjB;AAEA;;;;;AAKG;AACG,SAAU,KAAK,CAAC,CAAO,EAAA;IACzB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACvB;AAEA;;;;;;AAMG;AACG,SAAU,UAAU,CAAC,CAAS,EAAE,CAAS,EAAA;AAC3C,IAAA,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACjB;AAEA;;;;;;AAMG;AACG,SAAU,IAAI,CAAC,GAAS,EAAE,CAAO,EAAA;IACnC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACb,IAAA,OAAO,GAAG;AACd;AAEA;;;;;;;AAOG;SACa,GAAG,CAAC,GAAS,EAAE,CAAS,EAAE,CAAS,EAAA;AAC/C,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACV,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACV,IAAA,OAAO,GAAG;AACd;AAEA;;;;;;AAMG;SACa,UAAU,CAAC,GAAS,EAAE,MAAyB,EAAE,UAAkB,EAAA;IAC/E,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC;IAC3B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