glmaths 0.0.2 → 0.0.4
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/README.md +570 -552
- package/benchmark.js +2 -2
- package/dist/cjs/glmaths.d.ts +240 -198
- package/dist/cjs/glmaths.js +544 -462
- package/dist/cjs/glmaths.js.map +1 -1
- package/dist/cjs/glmaths.min.js +1 -1
- package/dist/cjs/glmaths.min.js.map +1 -1
- package/dist/esm/glmaths.d.ts +240 -198
- package/dist/esm/glmaths.js +544 -462
- package/dist/esm/glmaths.js.map +1 -1
- package/dist/esm/glmaths.min.js +1 -1
- package/dist/esm/glmaths.min.js.map +1 -1
- package/dist/glmaths.d.ts +240 -198
- package/dist/glmaths.js +544 -462
- package/dist/glmaths.js.map +1 -1
- package/dist/glmaths.min.js +1 -1
- package/dist/glmaths.min.js.map +1 -1
- package/examples/index.html +23 -0
- package/examples/main.js +134 -0
- package/examples/main.ts +159 -0
- package/package.json +1 -1
- package/src/mat2.ts +27 -27
- package/src/mat2x3.ts +37 -31
- package/src/mat3.ts +53 -54
- package/src/mat4.ts +81 -82
- package/src/quat.ts +36 -23
- package/src/quat2.ts +45 -31
- package/src/vec2.ts +90 -70
- package/src/vec3.ts +143 -121
- package/src/vec4.ts +79 -57
- package/tests/mat2.test.ts +53 -53
- package/tests/mat2x3.test.ts +46 -46
- package/tests/mat3.test.ts +59 -59
package/src/vec2.ts
CHANGED
|
@@ -13,12 +13,12 @@ import { Mat4 } from './mat4'
|
|
|
13
13
|
*/
|
|
14
14
|
export class Vec2 extends Float32Array {
|
|
15
15
|
|
|
16
|
-
static get zero() { return
|
|
17
|
-
static get Zero() { return
|
|
18
|
-
static get ZERO() { return
|
|
19
|
-
static get one() { return
|
|
20
|
-
static get One() { return
|
|
21
|
-
static get ONE() { return
|
|
16
|
+
static get zero() { return vec2(0, 0) }
|
|
17
|
+
static get Zero() { return vec2(0, 0) }
|
|
18
|
+
static get ZERO() { return vec2(0, 0) }
|
|
19
|
+
static get one() { return vec2(1, 1) }
|
|
20
|
+
static get One() { return vec2(1, 1) }
|
|
21
|
+
static get ONE() { return vec2(1, 1) }
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Creates a new Vec2 initialized with the given values
|
|
@@ -42,10 +42,10 @@ export class Vec2 extends Float32Array {
|
|
|
42
42
|
* Adds two vec2's
|
|
43
43
|
*
|
|
44
44
|
* @param {Vec2 | Number} b the second operand
|
|
45
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
45
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
46
46
|
* @returns {Vec2} out
|
|
47
47
|
*/
|
|
48
|
-
plus(b: Vec2 | number, out = glmaths.ALWAYS_COPY ?
|
|
48
|
+
plus(b: Vec2 | number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
49
49
|
if (typeof b === 'number') {
|
|
50
50
|
out[0] = this[0] + b
|
|
51
51
|
out[1] = this[1] + b
|
|
@@ -60,10 +60,10 @@ export class Vec2 extends Float32Array {
|
|
|
60
60
|
* Subtracts vector b from a vector
|
|
61
61
|
*
|
|
62
62
|
* @param {Vec2 | Number} b the second operand
|
|
63
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
63
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
64
64
|
* @returns {Vec2} out
|
|
65
65
|
*/
|
|
66
|
-
minus(b: Vec2 | number, out = glmaths.ALWAYS_COPY ?
|
|
66
|
+
minus(b: Vec2 | number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
67
67
|
if (typeof b === 'number') {
|
|
68
68
|
out[0] = this[0] - b
|
|
69
69
|
out[1] = this[1] - b
|
|
@@ -78,10 +78,10 @@ export class Vec2 extends Float32Array {
|
|
|
78
78
|
* Multiplies two vec2's component-wise
|
|
79
79
|
*
|
|
80
80
|
* @param {Vec2 | Number} b the second operand
|
|
81
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
81
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
82
82
|
* @returns {Vec2} out
|
|
83
83
|
*/
|
|
84
|
-
mult(b: Vec2 | number, out = glmaths.ALWAYS_COPY ?
|
|
84
|
+
mult(b: Vec2 | number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
85
85
|
if (typeof b === 'number') {
|
|
86
86
|
out[0] = this[0] * b
|
|
87
87
|
out[1] = this[1] * b
|
|
@@ -96,10 +96,10 @@ export class Vec2 extends Float32Array {
|
|
|
96
96
|
* Divides two vec2's component-wise
|
|
97
97
|
*
|
|
98
98
|
* @param {Vec2 | Number} b the second operand
|
|
99
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
99
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
100
100
|
* @returns {Vec2} out
|
|
101
101
|
*/
|
|
102
|
-
div(b: Vec2 | number, out = glmaths.ALWAYS_COPY ?
|
|
102
|
+
div(b: Vec2 | number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
103
103
|
if (typeof b === 'number') {
|
|
104
104
|
out[0] = this[0] / b
|
|
105
105
|
out[1] = this[1] / b
|
|
@@ -114,10 +114,10 @@ export class Vec2 extends Float32Array {
|
|
|
114
114
|
* Divides this vector by argument
|
|
115
115
|
*
|
|
116
116
|
* @param {Vec2 | Number} a the first operand
|
|
117
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
117
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
118
118
|
* @returns {Vec2} out
|
|
119
119
|
*/
|
|
120
|
-
invDiv(a: Vec2 | number, out = glmaths.ALWAYS_COPY ?
|
|
120
|
+
invDiv(a: Vec2 | number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
121
121
|
if (typeof a === 'number') {
|
|
122
122
|
out[0] = a / this[0]
|
|
123
123
|
out[1] = a / this[1]
|
|
@@ -132,10 +132,10 @@ export class Vec2 extends Float32Array {
|
|
|
132
132
|
* Remainder of this divided by argument
|
|
133
133
|
*
|
|
134
134
|
* @param {Vec2 | Number} a the first operand
|
|
135
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
135
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
136
136
|
* @returns {Vec2} out
|
|
137
137
|
*/
|
|
138
|
-
rem(b: Vec2 | number, out = glmaths.ALWAYS_COPY ?
|
|
138
|
+
rem(b: Vec2 | number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
139
139
|
if (typeof b === 'number') {
|
|
140
140
|
out[0] = this[0] % b
|
|
141
141
|
out[1] = this[1] % b
|
|
@@ -149,15 +149,15 @@ export class Vec2 extends Float32Array {
|
|
|
149
149
|
/**
|
|
150
150
|
* Negates the components of a vec2
|
|
151
151
|
*
|
|
152
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
152
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
153
153
|
* @returns {Vec2} out
|
|
154
154
|
*/
|
|
155
|
-
negate(out = glmaths.ALWAYS_COPY ?
|
|
155
|
+
negate(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
156
156
|
out[0] = -this[0]
|
|
157
157
|
out[1] = -this[1]
|
|
158
158
|
return out
|
|
159
159
|
}
|
|
160
|
-
unaryPlus(out = glmaths.ALWAYS_COPY ?
|
|
160
|
+
unaryPlus(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
161
161
|
if (out != this) {
|
|
162
162
|
out[0] = this[0]
|
|
163
163
|
out[1] = this[1]
|
|
@@ -166,11 +166,29 @@ export class Vec2 extends Float32Array {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
|
-
* Normalize a vector to unit length.
|
|
169
|
+
* Normalize a vector to unit length.
|
|
170
170
|
*
|
|
171
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
171
172
|
* @returns {Vec2} this
|
|
172
173
|
*/
|
|
173
|
-
normalize(out =
|
|
174
|
+
static normalize(v: Vec2, out = vec2()) {
|
|
175
|
+
const x = v[0], y = v[1]
|
|
176
|
+
let len = x * x + y * y
|
|
177
|
+
if (len > 0) {
|
|
178
|
+
len = 1.0 / Math.sqrt(len)
|
|
179
|
+
}
|
|
180
|
+
out[0] = x * len
|
|
181
|
+
out[1] = y * len
|
|
182
|
+
return out
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Normalize a vector to unit length.
|
|
187
|
+
*
|
|
188
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
189
|
+
* @returns {Vec2} this
|
|
190
|
+
*/
|
|
191
|
+
normalize(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
174
192
|
const x = this[0], y = this[1]
|
|
175
193
|
let len = x * x + y * y
|
|
176
194
|
if (len > 0) {
|
|
@@ -227,10 +245,10 @@ export class Vec2 extends Float32Array {
|
|
|
227
245
|
/**
|
|
228
246
|
* Math.floor the components of a vec2
|
|
229
247
|
*
|
|
230
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
248
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
231
249
|
* @returns {Vec2} out
|
|
232
250
|
*/
|
|
233
|
-
floor(out = glmaths.ALWAYS_COPY ?
|
|
251
|
+
floor(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
234
252
|
out[0] = Math.floor(this[0])
|
|
235
253
|
out[1] = Math.floor(this[1])
|
|
236
254
|
return out
|
|
@@ -238,10 +256,10 @@ export class Vec2 extends Float32Array {
|
|
|
238
256
|
/**
|
|
239
257
|
* Math.round the components of a vec2
|
|
240
258
|
*
|
|
241
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
259
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
242
260
|
* @returns {Vec2} out
|
|
243
261
|
*/
|
|
244
|
-
round(out = glmaths.ALWAYS_COPY ?
|
|
262
|
+
round(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
245
263
|
out[0] = Math.round(this[0])
|
|
246
264
|
out[1] = Math.round(this[1])
|
|
247
265
|
return out
|
|
@@ -250,10 +268,10 @@ export class Vec2 extends Float32Array {
|
|
|
250
268
|
/**
|
|
251
269
|
* Math.ceil the components of a vec2
|
|
252
270
|
*
|
|
253
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
271
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
254
272
|
* @returns {Vec2} out
|
|
255
273
|
*/
|
|
256
|
-
ceil(out = glmaths.ALWAYS_COPY ?
|
|
274
|
+
ceil(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
257
275
|
out[0] = Math.ceil(this[0])
|
|
258
276
|
out[1] = Math.ceil(this[1])
|
|
259
277
|
return out
|
|
@@ -262,10 +280,10 @@ export class Vec2 extends Float32Array {
|
|
|
262
280
|
/**
|
|
263
281
|
* Returns the inverse of the components (1/x, 1/y)
|
|
264
282
|
*
|
|
265
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
283
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
266
284
|
* @returns {Vec2} out
|
|
267
285
|
*/
|
|
268
|
-
inverse(out = glmaths.ALWAYS_COPY ?
|
|
286
|
+
inverse(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
269
287
|
out[0] = 1.0 / this[0]
|
|
270
288
|
out[1] = 1.0 / this[1]
|
|
271
289
|
return out
|
|
@@ -276,17 +294,17 @@ export class Vec2 extends Float32Array {
|
|
|
276
294
|
*
|
|
277
295
|
* @returns {Vec2} a new Vec2
|
|
278
296
|
*/
|
|
279
|
-
clone() { return
|
|
297
|
+
clone() { return vec2(this[0], this[1]) }
|
|
280
298
|
|
|
281
299
|
/**
|
|
282
300
|
* Rotates a vec2 around an origin point
|
|
283
301
|
*
|
|
284
302
|
* @param {Number} rad the angle of rotation in radians
|
|
285
|
-
* @param {Vec2} origin the origin of the rotation, defaults to
|
|
286
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
303
|
+
* @param {Vec2} origin the origin of the rotation, defaults to vec2(0, 0)
|
|
304
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
287
305
|
* @returns {Vec2} out
|
|
288
306
|
*/
|
|
289
|
-
rotate(rad = 0, origin: Vec2 =
|
|
307
|
+
rotate(rad = 0, origin: Vec2 = vec2.zero, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
290
308
|
const p0 = this[0] - origin[0]
|
|
291
309
|
const p1 = this[1] - origin[1]
|
|
292
310
|
const sinC = Math.sin(rad)
|
|
@@ -311,7 +329,7 @@ export class Vec2 extends Float32Array {
|
|
|
311
329
|
* @param {Number} scale length of the resulting vector, defaults to 1.0
|
|
312
330
|
* @returns {Vec2} a new random Vec2
|
|
313
331
|
*/
|
|
314
|
-
static random(scale = 1.0, out =
|
|
332
|
+
static random(scale = 1.0, out = vec2()) {
|
|
315
333
|
const angleR = glmaths.RANDOM() * 2.0 * Math.PI
|
|
316
334
|
out[0] = Math.cos(angleR) * scale
|
|
317
335
|
out[1] = Math.sin(angleR) * scale
|
|
@@ -413,7 +431,7 @@ export class Vec2 extends Float32Array {
|
|
|
413
431
|
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
414
432
|
* @returns {Vec2} a new interpolated Vec2
|
|
415
433
|
*/
|
|
416
|
-
static lerp(a: Vec2, b: Vec2, t: number, out =
|
|
434
|
+
static lerp(a: Vec2, b: Vec2, t: number, out = vec2()) {
|
|
417
435
|
const a0 = a[0], a1 = a[1]
|
|
418
436
|
out[0] = a0 + (b[0] - a0) * t
|
|
419
437
|
out[1] = a1 + (b[1] - a1) * t
|
|
@@ -427,7 +445,7 @@ export class Vec2 extends Float32Array {
|
|
|
427
445
|
* @param {Vec2} b the second operand
|
|
428
446
|
* @returns {Vec2} a new Vec2 with max components
|
|
429
447
|
*/
|
|
430
|
-
static max(a: Vec2, b: Vec2, out =
|
|
448
|
+
static max(a: Vec2, b: Vec2, out = vec2()) {
|
|
431
449
|
out[0] = Math.max(a[0], b[0])
|
|
432
450
|
out[1] = Math.max(a[1], b[1])
|
|
433
451
|
return out
|
|
@@ -439,7 +457,7 @@ export class Vec2 extends Float32Array {
|
|
|
439
457
|
* @param {Vec2} b the second operand
|
|
440
458
|
* @returns {Vec2} a new Vec2 with min components
|
|
441
459
|
*/
|
|
442
|
-
static min(a: Vec2, b: Vec2, out =
|
|
460
|
+
static min(a: Vec2, b: Vec2, out = vec2()) {
|
|
443
461
|
out[0] = Math.min(a[0], b[0])
|
|
444
462
|
out[1] = Math.min(a[1], b[1])
|
|
445
463
|
return out
|
|
@@ -453,7 +471,7 @@ export class Vec2 extends Float32Array {
|
|
|
453
471
|
* @param {Vec2 | Number} max the upper bound
|
|
454
472
|
* @returns {Vec2} a new clamped Vec2
|
|
455
473
|
*/
|
|
456
|
-
static clamp(v: Vec2, min: Vec2 | number, max: Vec2 | number, out =
|
|
474
|
+
static clamp(v: Vec2, min: Vec2 | number, max: Vec2 | number, out = vec2()) {
|
|
457
475
|
if (typeof min === 'number' && typeof max === 'number') {
|
|
458
476
|
out[0] = Math.min(Math.max(v[0], min), max)
|
|
459
477
|
out[1] = Math.min(Math.max(v[1], min), max)
|
|
@@ -476,7 +494,7 @@ export class Vec2 extends Float32Array {
|
|
|
476
494
|
* @param {Vec2 | Number} t interpolation factor (scalar or per-component)
|
|
477
495
|
* @returns {Vec2} a new interpolated Vec2
|
|
478
496
|
*/
|
|
479
|
-
static mix(a: Vec2, b: Vec2, t: Vec2 | number, out =
|
|
497
|
+
static mix(a: Vec2, b: Vec2, t: Vec2 | number, out = vec2()) {
|
|
480
498
|
if (typeof t === 'number') {
|
|
481
499
|
out[0] = a[0] + (b[0] - a[0]) * t
|
|
482
500
|
out[1] = a[1] + (b[1] - a[1]) * t
|
|
@@ -495,7 +513,7 @@ export class Vec2 extends Float32Array {
|
|
|
495
513
|
* @param {Vec2} v the source vector
|
|
496
514
|
* @returns {Vec2} a new smoothstepped Vec2
|
|
497
515
|
*/
|
|
498
|
-
static smoothstep(edge0: Vec2 | number, edge1: Vec2 | number, v: Vec2, out =
|
|
516
|
+
static smoothstep(edge0: Vec2 | number, edge1: Vec2 | number, v: Vec2, out = vec2()) {
|
|
499
517
|
const e0x = typeof edge0 === 'number' ? edge0 : edge0[0]
|
|
500
518
|
const e0y = typeof edge0 === 'number' ? edge0 : edge0[1]
|
|
501
519
|
const e1x = typeof edge1 === 'number' ? edge1 : edge1[0]
|
|
@@ -512,10 +530,10 @@ export class Vec2 extends Float32Array {
|
|
|
512
530
|
*
|
|
513
531
|
* @param {Vec2} b the second operand
|
|
514
532
|
* @param {Number} scale the amount to scale b by before adding
|
|
515
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
533
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
516
534
|
* @returns {Vec2} out
|
|
517
535
|
*/
|
|
518
|
-
scaleAndAdd(b: Vec2, scale: number, out = glmaths.ALWAYS_COPY ?
|
|
536
|
+
scaleAndAdd(b: Vec2, scale: number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
519
537
|
out[0] = this[0] + b[0] * scale
|
|
520
538
|
out[1] = this[1] + b[1] * scale
|
|
521
539
|
return out
|
|
@@ -524,10 +542,10 @@ export class Vec2 extends Float32Array {
|
|
|
524
542
|
/**
|
|
525
543
|
* Component-wise absolute value
|
|
526
544
|
*
|
|
527
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
545
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
528
546
|
* @returns {Vec2} out
|
|
529
547
|
*/
|
|
530
|
-
abs(out = glmaths.ALWAYS_COPY ?
|
|
548
|
+
abs(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
531
549
|
out[0] = Math.abs(this[0])
|
|
532
550
|
out[1] = Math.abs(this[1])
|
|
533
551
|
return out
|
|
@@ -536,10 +554,10 @@ export class Vec2 extends Float32Array {
|
|
|
536
554
|
/**
|
|
537
555
|
* Component-wise sign
|
|
538
556
|
*
|
|
539
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
557
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
540
558
|
* @returns {Vec2} out
|
|
541
559
|
*/
|
|
542
|
-
sign(out = glmaths.ALWAYS_COPY ?
|
|
560
|
+
sign(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
543
561
|
out[0] = this[0] > 0 ? 1 : this[0] < 0 ? -1 : 0
|
|
544
562
|
out[1] = this[1] > 0 ? 1 : this[1] < 0 ? -1 : 0
|
|
545
563
|
return out
|
|
@@ -548,10 +566,10 @@ export class Vec2 extends Float32Array {
|
|
|
548
566
|
/**
|
|
549
567
|
* Component-wise fractional part (x - floor(x))
|
|
550
568
|
*
|
|
551
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
569
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
552
570
|
* @returns {Vec2} out
|
|
553
571
|
*/
|
|
554
|
-
fract(out = glmaths.ALWAYS_COPY ?
|
|
572
|
+
fract(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
555
573
|
out[0] = this[0] - Math.floor(this[0])
|
|
556
574
|
out[1] = this[1] - Math.floor(this[1])
|
|
557
575
|
return out
|
|
@@ -562,10 +580,10 @@ export class Vec2 extends Float32Array {
|
|
|
562
580
|
*
|
|
563
581
|
* @param {Vec2 | Number} min the lower bound
|
|
564
582
|
* @param {Vec2 | Number} max the upper bound
|
|
565
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
583
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
566
584
|
* @returns {Vec2} out
|
|
567
585
|
*/
|
|
568
|
-
clamp(min: Vec2 | number, max: Vec2 | number, out = glmaths.ALWAYS_COPY ?
|
|
586
|
+
clamp(min: Vec2 | number, max: Vec2 | number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
569
587
|
if (typeof min === 'number' && typeof max === 'number') {
|
|
570
588
|
out[0] = Math.min(Math.max(this[0], min), max)
|
|
571
589
|
out[1] = Math.min(Math.max(this[1], min), max)
|
|
@@ -583,10 +601,10 @@ export class Vec2 extends Float32Array {
|
|
|
583
601
|
/**
|
|
584
602
|
* Clamp components to [0, 1]
|
|
585
603
|
*
|
|
586
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
604
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
587
605
|
* @returns {Vec2} out
|
|
588
606
|
*/
|
|
589
|
-
saturate(out = glmaths.ALWAYS_COPY ?
|
|
607
|
+
saturate(out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
590
608
|
out[0] = Math.min(Math.max(this[0], 0), 1)
|
|
591
609
|
out[1] = Math.min(Math.max(this[1], 0), 1)
|
|
592
610
|
return out
|
|
@@ -597,10 +615,10 @@ export class Vec2 extends Float32Array {
|
|
|
597
615
|
*
|
|
598
616
|
* @param {Vec2} b the second operand
|
|
599
617
|
* @param {Vec2 | Number} t interpolation factor (scalar or per-component)
|
|
600
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
618
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
601
619
|
* @returns {Vec2} out
|
|
602
620
|
*/
|
|
603
|
-
mix(b: Vec2, t: Vec2 | number, out = glmaths.ALWAYS_COPY ?
|
|
621
|
+
mix(b: Vec2, t: Vec2 | number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
604
622
|
if (typeof t === 'number') {
|
|
605
623
|
out[0] = this[0] + (b[0] - this[0]) * t
|
|
606
624
|
out[1] = this[1] + (b[1] - this[1]) * t
|
|
@@ -615,10 +633,10 @@ export class Vec2 extends Float32Array {
|
|
|
615
633
|
* Component-wise step function
|
|
616
634
|
*
|
|
617
635
|
* @param {Vec2 | Number} edge the edge threshold
|
|
618
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
636
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
619
637
|
* @returns {Vec2} out
|
|
620
638
|
*/
|
|
621
|
-
step(edge: Vec2 | number, out = glmaths.ALWAYS_COPY ?
|
|
639
|
+
step(edge: Vec2 | number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
622
640
|
if (typeof edge === 'number') {
|
|
623
641
|
out[0] = this[0] < edge ? 0 : 1
|
|
624
642
|
out[1] = this[1] < edge ? 0 : 1
|
|
@@ -634,10 +652,10 @@ export class Vec2 extends Float32Array {
|
|
|
634
652
|
*
|
|
635
653
|
* @param {Vec2 | Number} edge0 the lower edge
|
|
636
654
|
* @param {Vec2 | Number} edge1 the upper edge
|
|
637
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
655
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
638
656
|
* @returns {Vec2} out
|
|
639
657
|
*/
|
|
640
|
-
smoothstep(edge0: Vec2 | number, edge1: Vec2 | number, out = glmaths.ALWAYS_COPY ?
|
|
658
|
+
smoothstep(edge0: Vec2 | number, edge1: Vec2 | number, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
641
659
|
const e0x = typeof edge0 === 'number' ? edge0 : edge0[0]
|
|
642
660
|
const e0y = typeof edge0 === 'number' ? edge0 : edge0[1]
|
|
643
661
|
const e1x = typeof edge1 === 'number' ? edge1 : edge1[0]
|
|
@@ -653,10 +671,10 @@ export class Vec2 extends Float32Array {
|
|
|
653
671
|
* Transforms the vec2 with a Mat2 (column-major 2x2)
|
|
654
672
|
*
|
|
655
673
|
* @param {Mat2} m matrix to transform with
|
|
656
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
674
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
657
675
|
* @returns {Vec2} out
|
|
658
676
|
*/
|
|
659
|
-
transformMat2(m: Mat2, out = glmaths.ALWAYS_COPY ?
|
|
677
|
+
transformMat2(m: Mat2, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
660
678
|
const x = this[0], y = this[1]
|
|
661
679
|
out[0] = m[0] * x + m[2] * y
|
|
662
680
|
out[1] = m[1] * x + m[3] * y
|
|
@@ -667,10 +685,10 @@ export class Vec2 extends Float32Array {
|
|
|
667
685
|
* Transforms the vec2 with a Mat2x3 (2D affine transform)
|
|
668
686
|
*
|
|
669
687
|
* @param {Mat2x3} m matrix to transform with
|
|
670
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
688
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
671
689
|
* @returns {Vec2} out
|
|
672
690
|
*/
|
|
673
|
-
transformMat2x3(m: Mat2x3, out = glmaths.ALWAYS_COPY ?
|
|
691
|
+
transformMat2x3(m: Mat2x3, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
674
692
|
const x = this[0], y = this[1]
|
|
675
693
|
out[0] = m[0] * x + m[2] * y + m[4]
|
|
676
694
|
out[1] = m[1] * x + m[3] * y + m[5]
|
|
@@ -681,10 +699,10 @@ export class Vec2 extends Float32Array {
|
|
|
681
699
|
* Transforms the vec2 with a Mat3 (column-major 3x3)
|
|
682
700
|
*
|
|
683
701
|
* @param {Mat3} m matrix to transform with
|
|
684
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
702
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
685
703
|
* @returns {Vec2} out
|
|
686
704
|
*/
|
|
687
|
-
transformMat3(m: Mat3, out = glmaths.ALWAYS_COPY ?
|
|
705
|
+
transformMat3(m: Mat3, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
688
706
|
const x = this[0], y = this[1]
|
|
689
707
|
out[0] = m[0] * x + m[3] * y + m[6]
|
|
690
708
|
out[1] = m[1] * x + m[4] * y + m[7]
|
|
@@ -695,10 +713,10 @@ export class Vec2 extends Float32Array {
|
|
|
695
713
|
* Transforms the vec2 with a Mat4 (column-major 4x4)
|
|
696
714
|
*
|
|
697
715
|
* @param {Mat4} m matrix to transform with
|
|
698
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
716
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
699
717
|
* @returns {Vec2} out
|
|
700
718
|
*/
|
|
701
|
-
transformMat4(m: Mat4, out = glmaths.ALWAYS_COPY ?
|
|
719
|
+
transformMat4(m: Mat4, out = glmaths.ALWAYS_COPY ? vec2() : this) {
|
|
702
720
|
const x = this[0], y = this[1]
|
|
703
721
|
out[0] = m[0] * x + m[4] * y + m[12]
|
|
704
722
|
out[1] = m[1] * x + m[5] * y + m[13]
|
|
@@ -714,7 +732,7 @@ export class Vec2 extends Float32Array {
|
|
|
714
732
|
* @param {Vec2} out the receiving vector
|
|
715
733
|
* @returns {Vec2} out
|
|
716
734
|
*/
|
|
717
|
-
static scaleAndAdd(a: Vec2, b: Vec2, scale: number, out =
|
|
735
|
+
static scaleAndAdd(a: Vec2, b: Vec2, scale: number, out = vec2()) {
|
|
718
736
|
out[0] = a[0] + b[0] * scale
|
|
719
737
|
out[1] = a[1] + b[1] * scale
|
|
720
738
|
return out
|
|
@@ -728,7 +746,7 @@ export class Vec2 extends Float32Array {
|
|
|
728
746
|
* @param {Vec2} out the receiving vector
|
|
729
747
|
* @returns {Vec2} out
|
|
730
748
|
*/
|
|
731
|
-
static reflect(I: Vec2, N: Vec2, out =
|
|
749
|
+
static reflect(I: Vec2, N: Vec2, out = vec2()) {
|
|
732
750
|
const d = Vec2.dot(N, I)
|
|
733
751
|
out[0] = I[0] - 2 * d * N[0]
|
|
734
752
|
out[1] = I[1] - 2 * d * N[1]
|
|
@@ -754,6 +772,7 @@ export interface Vec2 {
|
|
|
754
772
|
transformMat2d: (m: Mat2x3, out?: Vec2) => Vec2
|
|
755
773
|
transformMat3x3: (m: Mat3, out?: Vec2) => Vec2
|
|
756
774
|
transformMat4x4: (m: Mat4, out?: Vec2) => Vec2
|
|
775
|
+
normalized: (out?: Vec2) => Vec2
|
|
757
776
|
|
|
758
777
|
// Auto-generated
|
|
759
778
|
x0: Vec2; x1: Vec2; xx: Vec2; xy: Vec2; y0: Vec2; y1: Vec2; yx: Vec2; yy: Vec2; x00: Vec3; x01: Vec3; x0x: Vec3; x0y: Vec3; x0z: Vec3; x10: Vec3; x11: Vec3; x1x: Vec3; x1y: Vec3; x1z: Vec3; xx0: Vec3; xx1: Vec3; xxx: Vec3; xxy: Vec3; xxz: Vec3; xy0: Vec3; xy1: Vec3; xyx: Vec3; xyy: Vec3; xyz: Vec3; xz0: Vec3; xz1: Vec3; xzx: Vec3; xzy: Vec3; xzz: Vec3; y00: Vec3; y01: Vec3; y0x: Vec3; y0y: Vec3; y0z: Vec3; y10: Vec3; y11: Vec3; y1x: Vec3; y1y: Vec3; y1z: Vec3; yx0: Vec3; yx1: Vec3; yxx: Vec3; yxy: Vec3; yxz: Vec3; yy0: Vec3; yy1: Vec3; yyx: Vec3; yyy: Vec3; yyz: Vec3; yz0: Vec3; yz1: Vec3; yzx: Vec3; yzy: Vec3; yzz: Vec3; z00: Vec3; z01: Vec3; z0x: Vec3; z0y: Vec3; z0z: Vec3; z10: Vec3; z11: Vec3; z1x: Vec3; z1y: Vec3; z1z: Vec3; zx0: Vec3; zx1: Vec3; zxx: Vec3; zxy: Vec3; zxz: Vec3; zy0: Vec3; zy1: Vec3; zyx: Vec3; zyy: Vec3; zyz: Vec3; zz0: Vec3; zz1: Vec3; zzx: Vec3; zzy: Vec3; zzz: Vec3; x000: Vec4; x001: Vec4; x00x: Vec4; x00y: Vec4; x00z: Vec4; x00w: Vec4; x010: Vec4; x011: Vec4; x01x: Vec4; x01y: Vec4; x01z: Vec4; x01w: Vec4; x0x0: Vec4; x0x1: Vec4; x0xx: Vec4; x0xy: Vec4; x0xz: Vec4; x0xw: Vec4; x0y0: Vec4; x0y1: Vec4; x0yx: Vec4; x0yy: Vec4; x0yz: Vec4; x0yw: Vec4; x0z0: Vec4; x0z1: Vec4; x0zx: Vec4; x0zy: Vec4; x0zz: Vec4; x0zw: Vec4; x0w0: Vec4; x0w1: Vec4; x0wx: Vec4; x0wy: Vec4; x0wz: Vec4; x0ww: Vec4; x100: Vec4; x101: Vec4; x10x: Vec4; x10y: Vec4; x10z: Vec4; x10w: Vec4; x110: Vec4; x111: Vec4; x11x: Vec4; x11y: Vec4; x11z: Vec4; x11w: Vec4; x1x0: Vec4; x1x1: Vec4; x1xx: Vec4; x1xy: Vec4; x1xz: Vec4; x1xw: Vec4; x1y0: Vec4; x1y1: Vec4; x1yx: Vec4; x1yy: Vec4; x1yz: Vec4; x1yw: Vec4; x1z0: Vec4; x1z1: Vec4; x1zx: Vec4; x1zy: Vec4; x1zz: Vec4; x1zw: Vec4; x1w0: Vec4; x1w1: Vec4; x1wx: Vec4; x1wy: Vec4; x1wz: Vec4; x1ww: Vec4; xx00: Vec4; xx01: Vec4; xx0x: Vec4; xx0y: Vec4; xx0z: Vec4; xx0w: Vec4; xx10: Vec4; xx11: Vec4; xx1x: Vec4; xx1y: Vec4; xx1z: Vec4; xx1w: Vec4; xxx0: Vec4; xxx1: Vec4; xxxx: Vec4; xxxy: Vec4; xxxz: Vec4; xxxw: Vec4; xxy0: Vec4; xxy1: Vec4; xxyx: Vec4; xxyy: Vec4; xxyz: Vec4; xxyw: Vec4; xxz0: Vec4; xxz1: Vec4; xxzx: Vec4; xxzy: Vec4; xxzz: Vec4; xxzw: Vec4; xxw0: Vec4; xxw1: Vec4; xxwx: Vec4; xxwy: Vec4; xxwz: Vec4; xxww: Vec4; xy00: Vec4; xy01: Vec4; xy0x: Vec4; xy0y: Vec4; xy0z: Vec4; xy0w: Vec4; xy10: Vec4; xy11: Vec4; xy1x: Vec4; xy1y: Vec4; xy1z: Vec4; xy1w: Vec4; xyx0: Vec4; xyx1: Vec4; xyxx: Vec4; xyxy: Vec4; xyxz: Vec4; xyxw: Vec4; xyy0: Vec4; xyy1: Vec4; xyyx: Vec4; xyyy: Vec4; xyyz: Vec4; xyyw: Vec4; xyz0: Vec4; xyz1: Vec4; xyzx: Vec4; xyzy: Vec4; xyzz: Vec4; xyzw: Vec4; xyw0: Vec4; xyw1: Vec4; xywx: Vec4; xywy: Vec4; xywz: Vec4; xyww: Vec4; xz00: Vec4; xz01: Vec4; xz0x: Vec4; xz0y: Vec4; xz0z: Vec4; xz0w: Vec4; xz10: Vec4; xz11: Vec4; xz1x: Vec4; xz1y: Vec4; xz1z: Vec4; xz1w: Vec4; xzx0: Vec4; xzx1: Vec4; xzxx: Vec4; xzxy: Vec4; xzxz: Vec4; xzxw: Vec4; xzy0: Vec4; xzy1: Vec4; xzyx: Vec4; xzyy: Vec4; xzyz: Vec4; xzyw: Vec4; xzz0: Vec4; xzz1: Vec4; xzzx: Vec4; xzzy: Vec4; xzzz: Vec4; xzzw: Vec4; xzw0: Vec4; xzw1: Vec4; xzwx: Vec4; xzwy: Vec4; xzwz: Vec4; xzww: Vec4; xw00: Vec4; xw01: Vec4; xw0x: Vec4; xw0y: Vec4; xw0z: Vec4; xw0w: Vec4; xw10: Vec4; xw11: Vec4; xw1x: Vec4; xw1y: Vec4; xw1z: Vec4; xw1w: Vec4; xwx0: Vec4; xwx1: Vec4; xwxx: Vec4; xwxy: Vec4; xwxz: Vec4; xwxw: Vec4; xwy0: Vec4; xwy1: Vec4; xwyx: Vec4; xwyy: Vec4; xwyz: Vec4; xwyw: Vec4; xwz0: Vec4; xwz1: Vec4; xwzx: Vec4; xwzy: Vec4; xwzz: Vec4; xwzw: Vec4; xww0: Vec4; xww1: Vec4; xwwx: Vec4; xwwy: Vec4; xwwz: Vec4; xwww: Vec4; y000: Vec4; y001: Vec4; y00x: Vec4; y00y: Vec4; y00z: Vec4; y00w: Vec4; y010: Vec4; y011: Vec4; y01x: Vec4; y01y: Vec4; y01z: Vec4; y01w: Vec4; y0x0: Vec4; y0x1: Vec4; y0xx: Vec4; y0xy: Vec4; y0xz: Vec4; y0xw: Vec4; y0y0: Vec4; y0y1: Vec4; y0yx: Vec4; y0yy: Vec4; y0yz: Vec4; y0yw: Vec4; y0z0: Vec4; y0z1: Vec4; y0zx: Vec4; y0zy: Vec4; y0zz: Vec4; y0zw: Vec4; y0w0: Vec4; y0w1: Vec4; y0wx: Vec4; y0wy: Vec4; y0wz: Vec4; y0ww: Vec4; y100: Vec4; y101: Vec4; y10x: Vec4; y10y: Vec4; y10z: Vec4; y10w: Vec4; y110: Vec4; y111: Vec4; y11x: Vec4; y11y: Vec4; y11z: Vec4; y11w: Vec4; y1x0: Vec4; y1x1: Vec4; y1xx: Vec4; y1xy: Vec4; y1xz: Vec4; y1xw: Vec4; y1y0: Vec4; y1y1: Vec4; y1yx: Vec4; y1yy: Vec4; y1yz: Vec4; y1yw: Vec4; y1z0: Vec4; y1z1: Vec4; y1zx: Vec4; y1zy: Vec4; y1zz: Vec4; y1zw: Vec4; y1w0: Vec4; y1w1: Vec4; y1wx: Vec4; y1wy: Vec4; y1wz: Vec4; y1ww: Vec4; yx00: Vec4; yx01: Vec4; yx0x: Vec4; yx0y: Vec4; yx0z: Vec4; yx0w: Vec4; yx10: Vec4; yx11: Vec4; yx1x: Vec4; yx1y: Vec4; yx1z: Vec4; yx1w: Vec4; yxx0: Vec4; yxx1: Vec4; yxxx: Vec4; yxxy: Vec4; yxxz: Vec4; yxxw: Vec4; yxy0: Vec4; yxy1: Vec4; yxyx: Vec4; yxyy: Vec4; yxyz: Vec4; yxyw: Vec4; yxz0: Vec4; yxz1: Vec4; yxzx: Vec4; yxzy: Vec4; yxzz: Vec4; yxzw: Vec4; yxw0: Vec4; yxw1: Vec4; yxwx: Vec4; yxwy: Vec4; yxwz: Vec4; yxww: Vec4; yy00: Vec4; yy01: Vec4; yy0x: Vec4; yy0y: Vec4; yy0z: Vec4; yy0w: Vec4; yy10: Vec4; yy11: Vec4; yy1x: Vec4; yy1y: Vec4; yy1z: Vec4; yy1w: Vec4; yyx0: Vec4; yyx1: Vec4; yyxx: Vec4; yyxy: Vec4; yyxz: Vec4; yyxw: Vec4; yyy0: Vec4; yyy1: Vec4; yyyx: Vec4; yyyy: Vec4; yyyz: Vec4; yyyw: Vec4; yyz0: Vec4; yyz1: Vec4; yyzx: Vec4; yyzy: Vec4; yyzz: Vec4; yyzw: Vec4; yyw0: Vec4; yyw1: Vec4; yywx: Vec4; yywy: Vec4; yywz: Vec4; yyww: Vec4; yz00: Vec4; yz01: Vec4; yz0x: Vec4; yz0y: Vec4; yz0z: Vec4; yz0w: Vec4; yz10: Vec4; yz11: Vec4; yz1x: Vec4; yz1y: Vec4; yz1z: Vec4; yz1w: Vec4; yzx0: Vec4; yzx1: Vec4; yzxx: Vec4; yzxy: Vec4; yzxz: Vec4; yzxw: Vec4; yzy0: Vec4; yzy1: Vec4; yzyx: Vec4; yzyy: Vec4; yzyz: Vec4; yzyw: Vec4; yzz0: Vec4; yzz1: Vec4; yzzx: Vec4; yzzy: Vec4; yzzz: Vec4; yzzw: Vec4; yzw0: Vec4; yzw1: Vec4; yzwx: Vec4; yzwy: Vec4; yzwz: Vec4; yzww: Vec4; yw00: Vec4; yw01: Vec4; yw0x: Vec4; yw0y: Vec4; yw0z: Vec4; yw0w: Vec4; yw10: Vec4; yw11: Vec4; yw1x: Vec4; yw1y: Vec4; yw1z: Vec4; yw1w: Vec4; ywx0: Vec4; ywx1: Vec4; ywxx: Vec4; ywxy: Vec4; ywxz: Vec4; ywxw: Vec4; ywy0: Vec4; ywy1: Vec4; ywyx: Vec4; ywyy: Vec4; ywyz: Vec4; ywyw: Vec4; ywz0: Vec4; ywz1: Vec4; ywzx: Vec4; ywzy: Vec4; ywzz: Vec4; ywzw: Vec4; yww0: Vec4; yww1: Vec4; ywwx: Vec4; ywwy: Vec4; ywwz: Vec4; ywww: Vec4; z000: Vec4; z001: Vec4; z00x: Vec4; z00y: Vec4; z00z: Vec4; z00w: Vec4; z010: Vec4; z011: Vec4; z01x: Vec4; z01y: Vec4; z01z: Vec4; z01w: Vec4; z0x0: Vec4; z0x1: Vec4; z0xx: Vec4; z0xy: Vec4; z0xz: Vec4; z0xw: Vec4; z0y0: Vec4; z0y1: Vec4; z0yx: Vec4; z0yy: Vec4; z0yz: Vec4; z0yw: Vec4; z0z0: Vec4; z0z1: Vec4; z0zx: Vec4; z0zy: Vec4; z0zz: Vec4; z0zw: Vec4; z0w0: Vec4; z0w1: Vec4; z0wx: Vec4; z0wy: Vec4; z0wz: Vec4; z0ww: Vec4; z100: Vec4; z101: Vec4; z10x: Vec4; z10y: Vec4; z10z: Vec4; z10w: Vec4; z110: Vec4; z111: Vec4; z11x: Vec4; z11y: Vec4; z11z: Vec4; z11w: Vec4; z1x0: Vec4; z1x1: Vec4; z1xx: Vec4; z1xy: Vec4; z1xz: Vec4; z1xw: Vec4; z1y0: Vec4; z1y1: Vec4; z1yx: Vec4; z1yy: Vec4; z1yz: Vec4; z1yw: Vec4; z1z0: Vec4; z1z1: Vec4; z1zx: Vec4; z1zy: Vec4; z1zz: Vec4; z1zw: Vec4; z1w0: Vec4; z1w1: Vec4; z1wx: Vec4; z1wy: Vec4; z1wz: Vec4; z1ww: Vec4; zx00: Vec4; zx01: Vec4; zx0x: Vec4; zx0y: Vec4; zx0z: Vec4; zx0w: Vec4; zx10: Vec4; zx11: Vec4; zx1x: Vec4; zx1y: Vec4; zx1z: Vec4; zx1w: Vec4; zxx0: Vec4; zxx1: Vec4; zxxx: Vec4; zxxy: Vec4; zxxz: Vec4; zxxw: Vec4; zxy0: Vec4; zxy1: Vec4; zxyx: Vec4; zxyy: Vec4; zxyz: Vec4; zxyw: Vec4; zxz0: Vec4; zxz1: Vec4; zxzx: Vec4; zxzy: Vec4; zxzz: Vec4; zxzw: Vec4; zxw0: Vec4; zxw1: Vec4; zxwx: Vec4; zxwy: Vec4; zxwz: Vec4; zxww: Vec4; zy00: Vec4; zy01: Vec4; zy0x: Vec4; zy0y: Vec4; zy0z: Vec4; zy0w: Vec4; zy10: Vec4; zy11: Vec4; zy1x: Vec4; zy1y: Vec4; zy1z: Vec4; zy1w: Vec4; zyx0: Vec4; zyx1: Vec4; zyxx: Vec4; zyxy: Vec4; zyxz: Vec4; zyxw: Vec4; zyy0: Vec4; zyy1: Vec4; zyyx: Vec4; zyyy: Vec4; zyyz: Vec4; zyyw: Vec4; zyz0: Vec4; zyz1: Vec4; zyzx: Vec4; zyzy: Vec4; zyzz: Vec4; zyzw: Vec4; zyw0: Vec4; zyw1: Vec4; zywx: Vec4; zywy: Vec4; zywz: Vec4; zyww: Vec4; zz00: Vec4; zz01: Vec4; zz0x: Vec4; zz0y: Vec4; zz0z: Vec4; zz0w: Vec4; zz10: Vec4; zz11: Vec4; zz1x: Vec4; zz1y: Vec4; zz1z: Vec4; zz1w: Vec4; zzx0: Vec4; zzx1: Vec4; zzxx: Vec4; zzxy: Vec4; zzxz: Vec4; zzxw: Vec4; zzy0: Vec4; zzy1: Vec4; zzyx: Vec4; zzyy: Vec4; zzyz: Vec4; zzyw: Vec4; zzz0: Vec4; zzz1: Vec4; zzzx: Vec4; zzzy: Vec4; zzzz: Vec4; zzzw: Vec4; zzw0: Vec4; zzw1: Vec4; zzwx: Vec4; zzwy: Vec4; zzwz: Vec4; zzww: Vec4; zw00: Vec4; zw01: Vec4; zw0x: Vec4; zw0y: Vec4; zw0z: Vec4; zw0w: Vec4; zw10: Vec4; zw11: Vec4; zw1x: Vec4; zw1y: Vec4; zw1z: Vec4; zw1w: Vec4; zwx0: Vec4; zwx1: Vec4; zwxx: Vec4; zwxy: Vec4; zwxz: Vec4; zwxw: Vec4; zwy0: Vec4; zwy1: Vec4; zwyx: Vec4; zwyy: Vec4; zwyz: Vec4; zwyw: Vec4; zwz0: Vec4; zwz1: Vec4; zwzx: Vec4; zwzy: Vec4; zwzz: Vec4; zwzw: Vec4; zww0: Vec4; zww1: Vec4; zwwx: Vec4; zwwy: Vec4; zwwz: Vec4; zwww: Vec4; w000: Vec4; w001: Vec4; w00x: Vec4; w00y: Vec4; w00z: Vec4; w00w: Vec4; w010: Vec4; w011: Vec4; w01x: Vec4; w01y: Vec4; w01z: Vec4; w01w: Vec4; w0x0: Vec4; w0x1: Vec4; w0xx: Vec4; w0xy: Vec4; w0xz: Vec4; w0xw: Vec4; w0y0: Vec4; w0y1: Vec4; w0yx: Vec4; w0yy: Vec4; w0yz: Vec4; w0yw: Vec4; w0z0: Vec4; w0z1: Vec4; w0zx: Vec4; w0zy: Vec4; w0zz: Vec4; w0zw: Vec4; w0w0: Vec4; w0w1: Vec4; w0wx: Vec4; w0wy: Vec4; w0wz: Vec4; w0ww: Vec4; w100: Vec4; w101: Vec4; w10x: Vec4; w10y: Vec4; w10z: Vec4; w10w: Vec4; w110: Vec4; w111: Vec4; w11x: Vec4; w11y: Vec4; w11z: Vec4; w11w: Vec4; w1x0: Vec4; w1x1: Vec4; w1xx: Vec4; w1xy: Vec4; w1xz: Vec4; w1xw: Vec4; w1y0: Vec4; w1y1: Vec4; w1yx: Vec4; w1yy: Vec4; w1yz: Vec4; w1yw: Vec4; w1z0: Vec4; w1z1: Vec4; w1zx: Vec4; w1zy: Vec4; w1zz: Vec4; w1zw: Vec4; w1w0: Vec4; w1w1: Vec4; w1wx: Vec4; w1wy: Vec4; w1wz: Vec4; w1ww: Vec4; wx00: Vec4; wx01: Vec4; wx0x: Vec4; wx0y: Vec4; wx0z: Vec4; wx0w: Vec4; wx10: Vec4; wx11: Vec4; wx1x: Vec4; wx1y: Vec4; wx1z: Vec4; wx1w: Vec4; wxx0: Vec4; wxx1: Vec4; wxxx: Vec4; wxxy: Vec4; wxxz: Vec4; wxxw: Vec4; wxy0: Vec4; wxy1: Vec4; wxyx: Vec4; wxyy: Vec4; wxyz: Vec4; wxyw: Vec4; wxz0: Vec4; wxz1: Vec4; wxzx: Vec4; wxzy: Vec4; wxzz: Vec4; wxzw: Vec4; wxw0: Vec4; wxw1: Vec4; wxwx: Vec4; wxwy: Vec4; wxwz: Vec4; wxww: Vec4; wy00: Vec4; wy01: Vec4; wy0x: Vec4; wy0y: Vec4; wy0z: Vec4; wy0w: Vec4; wy10: Vec4; wy11: Vec4; wy1x: Vec4; wy1y: Vec4; wy1z: Vec4; wy1w: Vec4; wyx0: Vec4; wyx1: Vec4; wyxx: Vec4; wyxy: Vec4; wyxz: Vec4; wyxw: Vec4; wyy0: Vec4; wyy1: Vec4; wyyx: Vec4; wyyy: Vec4; wyyz: Vec4; wyyw: Vec4; wyz0: Vec4; wyz1: Vec4; wyzx: Vec4; wyzy: Vec4; wyzz: Vec4; wyzw: Vec4; wyw0: Vec4; wyw1: Vec4; wywx: Vec4; wywy: Vec4; wywz: Vec4; wyww: Vec4; wz00: Vec4; wz01: Vec4; wz0x: Vec4; wz0y: Vec4; wz0z: Vec4; wz0w: Vec4; wz10: Vec4; wz11: Vec4; wz1x: Vec4; wz1y: Vec4; wz1z: Vec4; wz1w: Vec4; wzx0: Vec4; wzx1: Vec4; wzxx: Vec4; wzxy: Vec4; wzxz: Vec4; wzxw: Vec4; wzy0: Vec4; wzy1: Vec4; wzyx: Vec4; wzyy: Vec4; wzyz: Vec4; wzyw: Vec4; wzz0: Vec4; wzz1: Vec4; wzzx: Vec4; wzzy: Vec4; wzzz: Vec4; wzzw: Vec4; wzw0: Vec4; wzw1: Vec4; wzwx: Vec4; wzwy: Vec4; wzwz: Vec4; wzww: Vec4; ww00: Vec4; ww01: Vec4; ww0x: Vec4; ww0y: Vec4; ww0z: Vec4; ww0w: Vec4; ww10: Vec4; ww11: Vec4; ww1x: Vec4; ww1y: Vec4; ww1z: Vec4; ww1w: Vec4; wwx0: Vec4; wwx1: Vec4; wwxx: Vec4; wwxy: Vec4; wwxz: Vec4; wwxw: Vec4; wwy0: Vec4; wwy1: Vec4; wwyx: Vec4; wwyy: Vec4; wwyz: Vec4; wwyw: Vec4; wwz0: Vec4; wwz1: Vec4; wwzx: Vec4; wwzy: Vec4; wwzz: Vec4; wwzw: Vec4; www0: Vec4; www1: Vec4; wwwx: Vec4; wwwy: Vec4; wwwz: Vec4; wwww: Vec4;
|
|
@@ -779,6 +798,7 @@ Vec2.prototype.unaryMinus = Vec2.prototype.negate
|
|
|
779
798
|
Vec2.prototype.sqrLen = Vec2.prototype.squaredLength
|
|
780
799
|
Vec2.prototype.str = Vec2.prototype.toString
|
|
781
800
|
Vec2.prototype.lerpV = Vec2.prototype.mix
|
|
801
|
+
Vec2.prototype.normalized = Vec2.prototype.normalize
|
|
782
802
|
Vec2.prototype.transformMat2x2 = Vec2.prototype.transformMat2
|
|
783
803
|
Vec2.prototype.transformMat2d = Vec2.prototype.transformMat2x3
|
|
784
804
|
Vec2.prototype.transformMat3x3 = Vec2.prototype.transformMat3
|