@ohif/app 3.10.0-beta.2 → 3.10.0-beta.20
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/dist/{1185.bundle.52f04f41c08dc5853aed.js → 1185.bundle.f5bdc6fbf5cf6e77f1ca.js} +129 -29
- package/dist/{1266.bundle.4f06772fcf6b303d894d.js → 1266.bundle.723b1e14a8c03300ca49.js} +30 -0
- package/dist/1266.css +1 -1
- package/dist/1801.css +1 -1
- package/dist/{1927.bundle.49539e3ab5b0aad1399c.js → 1927.bundle.c55edd5a362e7d79e23d.js} +1 -1
- package/dist/{2701.bundle.8c1ff2e0faaa7d2f4716.js → 2701.bundle.caa28a0b2f7e0b79088a.js} +14 -22
- package/dist/{149.bundle.b8d177954628f4631fc0.js → 3022.bundle.51a7056ea0e39b06e095.js} +2095 -389
- package/dist/{3198.bundle.3b22ad50fb086338b85e.js → 3198.bundle.a27ad30339285ee88574.js} +2 -2
- package/dist/3198.css +1 -1
- package/dist/{3200.bundle.768571169c3d6e603324.js → 3200.bundle.eff6d0c695d962fe4b5b.js} +17 -9
- package/dist/3200.css +1 -1
- package/dist/{3677.bundle.7d9110e8c5682b56a456.js → 3677.bundle.d3c30c37d00fc58b4442.js} +876 -18
- package/dist/{3970.bundle.31942cc0c12a008e7ba0.js → 3970.bundle.216ca9d37288f34b8f0b.js} +15 -5
- package/dist/4182.css +1 -1
- package/dist/{4571.bundle.3b1691730b3c57bf4d35.js → 4571.bundle.142e8f6150bf81f1b7d2.js} +129 -107
- package/dist/5139.css +1 -1
- package/dist/{5247.bundle.17495c3d97cf29e44e73.js → 5247.bundle.affc956197b6220e3c94.js} +4 -4
- package/dist/{5252.bundle.5ec502c53a9cc877ed8d.js → 5252.bundle.9d1855f7fb56235709ec.js} +713 -280
- package/dist/{1520.bundle.83586195deb9d61702d9.js → 5630.bundle.d206792a2f04f7156442.js} +90 -70
- package/dist/{5687.bundle.2665d32af98b253b78fd.js → 5687.bundle.022f94286f70741366b3.js} +4 -4
- package/dist/{5823.bundle.cb588e5e33eea80cd49f.js → 573.bundle.d08dcb8e65e3b7729b58.js} +27 -865
- package/dist/{1436.bundle.773756cd51b69e887bac.js → 6498.bundle.02f5b640a94509a11180.js} +1057 -536
- package/dist/{717.bundle.ba680e992f721c5d8b4a.js → 717.bundle.0b47b3dba812d4554266.js} +2 -2
- package/dist/717.css +1 -1
- package/dist/{7197.bundle.c4ff7a71122131167cbb.js → 7197.bundle.580576f8db68a65a10ce.js} +4 -4
- package/dist/{5717.bundle.848e13f256818475f57f.js → 727.bundle.f93673c292647f58ee1e.js} +1833 -817
- package/dist/{7955.bundle.dd665937d280f9427909.js → 7955.bundle.70fe7524bf3c8b78cd15.js} +1 -1
- package/dist/{8228.bundle.55ac03d7165248f47d4e.js → 8228.bundle.22df751df68b512fc6fb.js} +2 -2
- package/dist/8228.css +2 -2
- package/dist/{8558.bundle.dfedfd13f3845ea7104a.js → 8558.bundle.487a5e67207aa1f91da9.js} +3 -0
- package/dist/{9551.bundle.01a1567f174986f74fcf.js → 9551.bundle.26cea86f50cb4800bdaa.js} +1 -1
- package/dist/{9611.bundle.767595c93877e5166c03.js → 9611.bundle.0feebcae79e65852d610.js} +14 -9
- package/dist/{5807.bundle.dac5ce36534a71c77723.js → 967.bundle.fee0d6c1e9e244ad5bb3.js} +1134 -1128
- package/dist/{8523.bundle.648334132159465cdc41.js → 9809.bundle.9d3afbcc67703574e298.js} +1265 -185
- package/dist/{9862.bundle.7146682e56aa66130ae6.js → 9862.bundle.6ea7e474a390b386e2b2.js} +1 -1
- package/dist/{app.bundle.b81b47f20105288797e2.js → app.bundle.64d91e75036855d4e31a.js} +9080 -8397
- package/dist/app.bundle.css +18 -18
- package/dist/{histogram-worker.bundle.f0e060cf2637a2ca94b7.js → histogram-worker.bundle.f978654858500a3080cc.js} +3 -3
- package/dist/index.html +1 -1
- package/dist/{polySeg.bundle.b79ae514989e86301c71.js → polySeg.bundle.70ed683f467a47e3c92d.js} +3 -3
- package/dist/serve.json +1 -10
- package/dist/{suv-peak-worker.bundle.76dd4fdf82aaa2c3ad41.js → suv-peak-worker.bundle.8c83e6e99d48223569b6.js} +4 -4
- package/dist/sw.js +1 -1
- package/package.json +19 -19
- /package/dist/{1374.bundle.e5b05fd7e1295bf06867.js → 1374.bundle.afdb21e02ca5a08f8060.js} +0 -0
- /package/dist/{213.bundle.68c723cdf7de1ebb18f2.js → 213.bundle.2e20b24ab08945ba56bb.js} +0 -0
- /package/dist/{2424.bundle.acefd29e9b3948544119.js → 2424.bundle.a72e288e00a909f3930b.js} +0 -0
- /package/dist/{2825.bundle.9b280fd4de22a0b2b729.js → 2825.bundle.9fcf88214bf70b49356f.js} +0 -0
- /package/dist/{3121.bundle.d3e7092e305cf6cecdb5.js → 3121.bundle.67ff7e799683191bb324.js} +0 -0
- /package/dist/{3334.bundle.0e6ba24024018199ab66.js → 3334.bundle.e36011d0fd5fcb7e8b84.js} +0 -0
- /package/dist/{4202.bundle.5c8120ed4841da0af211.js → 4202.bundle.1311396ecdb6c0b09eb0.js} +0 -0
- /package/dist/{4834.bundle.1deb034b995ef76461a3.js → 4834.bundle.71f72158944e5afd94e8.js} +0 -0
- /package/dist/{5139.bundle.61d9101ea220a8382f2b.js → 5139.bundle.36ec15905a109af39099.js} +0 -0
- /package/dist/{5261.bundle.74682659cce85f3ae592.js → 5261.bundle.54d7af66923a3bae707d.js} +0 -0
- /package/dist/{6939.bundle.9b79da82315a25f37d96.js → 6939.bundle.5e77a634e8784085c00e.js} +0 -0
- /package/dist/{7159.bundle.9f4856182f1eda29c59d.js → 7159.bundle.4ee84ebbce84383e30d4.js} +0 -0
- /package/dist/{8008.bundle.d24be79eebc455c4512a.js → 8008.bundle.6be72115a1d79d69e7ab.js} +0 -0
- /package/dist/{8259.bundle.a91eb7639bc72f522c16.js → 8259.bundle.127e657e46bcff886565.js} +0 -0
- /package/dist/{8295.bundle.4ecb27f9e58526f12bcb.js → 8295.bundle.14cddaccdcd3a7093398.js} +0 -0
|
@@ -7521,6 +7521,852 @@ var setAxes = function () {
|
|
|
7521
7521
|
|
|
7522
7522
|
/***/ }),
|
|
7523
7523
|
|
|
7524
|
+
/***/ 9175:
|
|
7525
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7526
|
+
|
|
7527
|
+
"use strict";
|
|
7528
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7529
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7530
|
+
/* harmony export */ add: () => (/* binding */ add),
|
|
7531
|
+
/* harmony export */ angle: () => (/* binding */ angle),
|
|
7532
|
+
/* harmony export */ bezier: () => (/* binding */ bezier),
|
|
7533
|
+
/* harmony export */ ceil: () => (/* binding */ ceil),
|
|
7534
|
+
/* harmony export */ clone: () => (/* binding */ clone),
|
|
7535
|
+
/* harmony export */ copy: () => (/* binding */ copy),
|
|
7536
|
+
/* harmony export */ create: () => (/* binding */ create),
|
|
7537
|
+
/* harmony export */ cross: () => (/* binding */ cross),
|
|
7538
|
+
/* harmony export */ dist: () => (/* binding */ dist),
|
|
7539
|
+
/* harmony export */ distance: () => (/* binding */ distance),
|
|
7540
|
+
/* harmony export */ div: () => (/* binding */ div),
|
|
7541
|
+
/* harmony export */ divide: () => (/* binding */ divide),
|
|
7542
|
+
/* harmony export */ dot: () => (/* binding */ dot),
|
|
7543
|
+
/* harmony export */ equals: () => (/* binding */ equals),
|
|
7544
|
+
/* harmony export */ exactEquals: () => (/* binding */ exactEquals),
|
|
7545
|
+
/* harmony export */ floor: () => (/* binding */ floor),
|
|
7546
|
+
/* harmony export */ forEach: () => (/* binding */ forEach),
|
|
7547
|
+
/* harmony export */ fromValues: () => (/* binding */ fromValues),
|
|
7548
|
+
/* harmony export */ hermite: () => (/* binding */ hermite),
|
|
7549
|
+
/* harmony export */ inverse: () => (/* binding */ inverse),
|
|
7550
|
+
/* harmony export */ len: () => (/* binding */ len),
|
|
7551
|
+
/* harmony export */ length: () => (/* binding */ length),
|
|
7552
|
+
/* harmony export */ lerp: () => (/* binding */ lerp),
|
|
7553
|
+
/* harmony export */ max: () => (/* binding */ max),
|
|
7554
|
+
/* harmony export */ min: () => (/* binding */ min),
|
|
7555
|
+
/* harmony export */ mul: () => (/* binding */ mul),
|
|
7556
|
+
/* harmony export */ multiply: () => (/* binding */ multiply),
|
|
7557
|
+
/* harmony export */ negate: () => (/* binding */ negate),
|
|
7558
|
+
/* harmony export */ normalize: () => (/* binding */ normalize),
|
|
7559
|
+
/* harmony export */ random: () => (/* binding */ random),
|
|
7560
|
+
/* harmony export */ rotateX: () => (/* binding */ rotateX),
|
|
7561
|
+
/* harmony export */ rotateY: () => (/* binding */ rotateY),
|
|
7562
|
+
/* harmony export */ rotateZ: () => (/* binding */ rotateZ),
|
|
7563
|
+
/* harmony export */ round: () => (/* binding */ round),
|
|
7564
|
+
/* harmony export */ scale: () => (/* binding */ scale),
|
|
7565
|
+
/* harmony export */ scaleAndAdd: () => (/* binding */ scaleAndAdd),
|
|
7566
|
+
/* harmony export */ set: () => (/* binding */ set),
|
|
7567
|
+
/* harmony export */ sqrDist: () => (/* binding */ sqrDist),
|
|
7568
|
+
/* harmony export */ sqrLen: () => (/* binding */ sqrLen),
|
|
7569
|
+
/* harmony export */ squaredDistance: () => (/* binding */ squaredDistance),
|
|
7570
|
+
/* harmony export */ squaredLength: () => (/* binding */ squaredLength),
|
|
7571
|
+
/* harmony export */ str: () => (/* binding */ str),
|
|
7572
|
+
/* harmony export */ sub: () => (/* binding */ sub),
|
|
7573
|
+
/* harmony export */ subtract: () => (/* binding */ subtract),
|
|
7574
|
+
/* harmony export */ transformMat3: () => (/* binding */ transformMat3),
|
|
7575
|
+
/* harmony export */ transformMat4: () => (/* binding */ transformMat4),
|
|
7576
|
+
/* harmony export */ transformQuat: () => (/* binding */ transformQuat),
|
|
7577
|
+
/* harmony export */ zero: () => (/* binding */ zero)
|
|
7578
|
+
/* harmony export */ });
|
|
7579
|
+
/* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24457);
|
|
7580
|
+
|
|
7581
|
+
/**
|
|
7582
|
+
* 3 Dimensional Vector
|
|
7583
|
+
* @module vec3
|
|
7584
|
+
*/
|
|
7585
|
+
|
|
7586
|
+
/**
|
|
7587
|
+
* Creates a new, empty vec3
|
|
7588
|
+
*
|
|
7589
|
+
* @returns {vec3} a new 3D vector
|
|
7590
|
+
*/
|
|
7591
|
+
|
|
7592
|
+
function create() {
|
|
7593
|
+
var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__.ARRAY_TYPE(3);
|
|
7594
|
+
|
|
7595
|
+
if (_common_js__WEBPACK_IMPORTED_MODULE_0__.ARRAY_TYPE != Float32Array) {
|
|
7596
|
+
out[0] = 0;
|
|
7597
|
+
out[1] = 0;
|
|
7598
|
+
out[2] = 0;
|
|
7599
|
+
}
|
|
7600
|
+
|
|
7601
|
+
return out;
|
|
7602
|
+
}
|
|
7603
|
+
/**
|
|
7604
|
+
* Creates a new vec3 initialized with values from an existing vector
|
|
7605
|
+
*
|
|
7606
|
+
* @param {ReadonlyVec3} a vector to clone
|
|
7607
|
+
* @returns {vec3} a new 3D vector
|
|
7608
|
+
*/
|
|
7609
|
+
|
|
7610
|
+
function clone(a) {
|
|
7611
|
+
var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__.ARRAY_TYPE(3);
|
|
7612
|
+
out[0] = a[0];
|
|
7613
|
+
out[1] = a[1];
|
|
7614
|
+
out[2] = a[2];
|
|
7615
|
+
return out;
|
|
7616
|
+
}
|
|
7617
|
+
/**
|
|
7618
|
+
* Calculates the length of a vec3
|
|
7619
|
+
*
|
|
7620
|
+
* @param {ReadonlyVec3} a vector to calculate length of
|
|
7621
|
+
* @returns {Number} length of a
|
|
7622
|
+
*/
|
|
7623
|
+
|
|
7624
|
+
function length(a) {
|
|
7625
|
+
var x = a[0];
|
|
7626
|
+
var y = a[1];
|
|
7627
|
+
var z = a[2];
|
|
7628
|
+
return Math.hypot(x, y, z);
|
|
7629
|
+
}
|
|
7630
|
+
/**
|
|
7631
|
+
* Creates a new vec3 initialized with the given values
|
|
7632
|
+
*
|
|
7633
|
+
* @param {Number} x X component
|
|
7634
|
+
* @param {Number} y Y component
|
|
7635
|
+
* @param {Number} z Z component
|
|
7636
|
+
* @returns {vec3} a new 3D vector
|
|
7637
|
+
*/
|
|
7638
|
+
|
|
7639
|
+
function fromValues(x, y, z) {
|
|
7640
|
+
var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__.ARRAY_TYPE(3);
|
|
7641
|
+
out[0] = x;
|
|
7642
|
+
out[1] = y;
|
|
7643
|
+
out[2] = z;
|
|
7644
|
+
return out;
|
|
7645
|
+
}
|
|
7646
|
+
/**
|
|
7647
|
+
* Copy the values from one vec3 to another
|
|
7648
|
+
*
|
|
7649
|
+
* @param {vec3} out the receiving vector
|
|
7650
|
+
* @param {ReadonlyVec3} a the source vector
|
|
7651
|
+
* @returns {vec3} out
|
|
7652
|
+
*/
|
|
7653
|
+
|
|
7654
|
+
function copy(out, a) {
|
|
7655
|
+
out[0] = a[0];
|
|
7656
|
+
out[1] = a[1];
|
|
7657
|
+
out[2] = a[2];
|
|
7658
|
+
return out;
|
|
7659
|
+
}
|
|
7660
|
+
/**
|
|
7661
|
+
* Set the components of a vec3 to the given values
|
|
7662
|
+
*
|
|
7663
|
+
* @param {vec3} out the receiving vector
|
|
7664
|
+
* @param {Number} x X component
|
|
7665
|
+
* @param {Number} y Y component
|
|
7666
|
+
* @param {Number} z Z component
|
|
7667
|
+
* @returns {vec3} out
|
|
7668
|
+
*/
|
|
7669
|
+
|
|
7670
|
+
function set(out, x, y, z) {
|
|
7671
|
+
out[0] = x;
|
|
7672
|
+
out[1] = y;
|
|
7673
|
+
out[2] = z;
|
|
7674
|
+
return out;
|
|
7675
|
+
}
|
|
7676
|
+
/**
|
|
7677
|
+
* Adds two vec3's
|
|
7678
|
+
*
|
|
7679
|
+
* @param {vec3} out the receiving vector
|
|
7680
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7681
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7682
|
+
* @returns {vec3} out
|
|
7683
|
+
*/
|
|
7684
|
+
|
|
7685
|
+
function add(out, a, b) {
|
|
7686
|
+
out[0] = a[0] + b[0];
|
|
7687
|
+
out[1] = a[1] + b[1];
|
|
7688
|
+
out[2] = a[2] + b[2];
|
|
7689
|
+
return out;
|
|
7690
|
+
}
|
|
7691
|
+
/**
|
|
7692
|
+
* Subtracts vector b from vector a
|
|
7693
|
+
*
|
|
7694
|
+
* @param {vec3} out the receiving vector
|
|
7695
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7696
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7697
|
+
* @returns {vec3} out
|
|
7698
|
+
*/
|
|
7699
|
+
|
|
7700
|
+
function subtract(out, a, b) {
|
|
7701
|
+
out[0] = a[0] - b[0];
|
|
7702
|
+
out[1] = a[1] - b[1];
|
|
7703
|
+
out[2] = a[2] - b[2];
|
|
7704
|
+
return out;
|
|
7705
|
+
}
|
|
7706
|
+
/**
|
|
7707
|
+
* Multiplies two vec3's
|
|
7708
|
+
*
|
|
7709
|
+
* @param {vec3} out the receiving vector
|
|
7710
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7711
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7712
|
+
* @returns {vec3} out
|
|
7713
|
+
*/
|
|
7714
|
+
|
|
7715
|
+
function multiply(out, a, b) {
|
|
7716
|
+
out[0] = a[0] * b[0];
|
|
7717
|
+
out[1] = a[1] * b[1];
|
|
7718
|
+
out[2] = a[2] * b[2];
|
|
7719
|
+
return out;
|
|
7720
|
+
}
|
|
7721
|
+
/**
|
|
7722
|
+
* Divides two vec3's
|
|
7723
|
+
*
|
|
7724
|
+
* @param {vec3} out the receiving vector
|
|
7725
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7726
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7727
|
+
* @returns {vec3} out
|
|
7728
|
+
*/
|
|
7729
|
+
|
|
7730
|
+
function divide(out, a, b) {
|
|
7731
|
+
out[0] = a[0] / b[0];
|
|
7732
|
+
out[1] = a[1] / b[1];
|
|
7733
|
+
out[2] = a[2] / b[2];
|
|
7734
|
+
return out;
|
|
7735
|
+
}
|
|
7736
|
+
/**
|
|
7737
|
+
* Math.ceil the components of a vec3
|
|
7738
|
+
*
|
|
7739
|
+
* @param {vec3} out the receiving vector
|
|
7740
|
+
* @param {ReadonlyVec3} a vector to ceil
|
|
7741
|
+
* @returns {vec3} out
|
|
7742
|
+
*/
|
|
7743
|
+
|
|
7744
|
+
function ceil(out, a) {
|
|
7745
|
+
out[0] = Math.ceil(a[0]);
|
|
7746
|
+
out[1] = Math.ceil(a[1]);
|
|
7747
|
+
out[2] = Math.ceil(a[2]);
|
|
7748
|
+
return out;
|
|
7749
|
+
}
|
|
7750
|
+
/**
|
|
7751
|
+
* Math.floor the components of a vec3
|
|
7752
|
+
*
|
|
7753
|
+
* @param {vec3} out the receiving vector
|
|
7754
|
+
* @param {ReadonlyVec3} a vector to floor
|
|
7755
|
+
* @returns {vec3} out
|
|
7756
|
+
*/
|
|
7757
|
+
|
|
7758
|
+
function floor(out, a) {
|
|
7759
|
+
out[0] = Math.floor(a[0]);
|
|
7760
|
+
out[1] = Math.floor(a[1]);
|
|
7761
|
+
out[2] = Math.floor(a[2]);
|
|
7762
|
+
return out;
|
|
7763
|
+
}
|
|
7764
|
+
/**
|
|
7765
|
+
* Returns the minimum of two vec3's
|
|
7766
|
+
*
|
|
7767
|
+
* @param {vec3} out the receiving vector
|
|
7768
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7769
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7770
|
+
* @returns {vec3} out
|
|
7771
|
+
*/
|
|
7772
|
+
|
|
7773
|
+
function min(out, a, b) {
|
|
7774
|
+
out[0] = Math.min(a[0], b[0]);
|
|
7775
|
+
out[1] = Math.min(a[1], b[1]);
|
|
7776
|
+
out[2] = Math.min(a[2], b[2]);
|
|
7777
|
+
return out;
|
|
7778
|
+
}
|
|
7779
|
+
/**
|
|
7780
|
+
* Returns the maximum of two vec3's
|
|
7781
|
+
*
|
|
7782
|
+
* @param {vec3} out the receiving vector
|
|
7783
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7784
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7785
|
+
* @returns {vec3} out
|
|
7786
|
+
*/
|
|
7787
|
+
|
|
7788
|
+
function max(out, a, b) {
|
|
7789
|
+
out[0] = Math.max(a[0], b[0]);
|
|
7790
|
+
out[1] = Math.max(a[1], b[1]);
|
|
7791
|
+
out[2] = Math.max(a[2], b[2]);
|
|
7792
|
+
return out;
|
|
7793
|
+
}
|
|
7794
|
+
/**
|
|
7795
|
+
* Math.round the components of a vec3
|
|
7796
|
+
*
|
|
7797
|
+
* @param {vec3} out the receiving vector
|
|
7798
|
+
* @param {ReadonlyVec3} a vector to round
|
|
7799
|
+
* @returns {vec3} out
|
|
7800
|
+
*/
|
|
7801
|
+
|
|
7802
|
+
function round(out, a) {
|
|
7803
|
+
out[0] = Math.round(a[0]);
|
|
7804
|
+
out[1] = Math.round(a[1]);
|
|
7805
|
+
out[2] = Math.round(a[2]);
|
|
7806
|
+
return out;
|
|
7807
|
+
}
|
|
7808
|
+
/**
|
|
7809
|
+
* Scales a vec3 by a scalar number
|
|
7810
|
+
*
|
|
7811
|
+
* @param {vec3} out the receiving vector
|
|
7812
|
+
* @param {ReadonlyVec3} a the vector to scale
|
|
7813
|
+
* @param {Number} b amount to scale the vector by
|
|
7814
|
+
* @returns {vec3} out
|
|
7815
|
+
*/
|
|
7816
|
+
|
|
7817
|
+
function scale(out, a, b) {
|
|
7818
|
+
out[0] = a[0] * b;
|
|
7819
|
+
out[1] = a[1] * b;
|
|
7820
|
+
out[2] = a[2] * b;
|
|
7821
|
+
return out;
|
|
7822
|
+
}
|
|
7823
|
+
/**
|
|
7824
|
+
* Adds two vec3's after scaling the second operand by a scalar value
|
|
7825
|
+
*
|
|
7826
|
+
* @param {vec3} out the receiving vector
|
|
7827
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7828
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7829
|
+
* @param {Number} scale the amount to scale b by before adding
|
|
7830
|
+
* @returns {vec3} out
|
|
7831
|
+
*/
|
|
7832
|
+
|
|
7833
|
+
function scaleAndAdd(out, a, b, scale) {
|
|
7834
|
+
out[0] = a[0] + b[0] * scale;
|
|
7835
|
+
out[1] = a[1] + b[1] * scale;
|
|
7836
|
+
out[2] = a[2] + b[2] * scale;
|
|
7837
|
+
return out;
|
|
7838
|
+
}
|
|
7839
|
+
/**
|
|
7840
|
+
* Calculates the euclidian distance between two vec3's
|
|
7841
|
+
*
|
|
7842
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7843
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7844
|
+
* @returns {Number} distance between a and b
|
|
7845
|
+
*/
|
|
7846
|
+
|
|
7847
|
+
function distance(a, b) {
|
|
7848
|
+
var x = b[0] - a[0];
|
|
7849
|
+
var y = b[1] - a[1];
|
|
7850
|
+
var z = b[2] - a[2];
|
|
7851
|
+
return Math.hypot(x, y, z);
|
|
7852
|
+
}
|
|
7853
|
+
/**
|
|
7854
|
+
* Calculates the squared euclidian distance between two vec3's
|
|
7855
|
+
*
|
|
7856
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7857
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7858
|
+
* @returns {Number} squared distance between a and b
|
|
7859
|
+
*/
|
|
7860
|
+
|
|
7861
|
+
function squaredDistance(a, b) {
|
|
7862
|
+
var x = b[0] - a[0];
|
|
7863
|
+
var y = b[1] - a[1];
|
|
7864
|
+
var z = b[2] - a[2];
|
|
7865
|
+
return x * x + y * y + z * z;
|
|
7866
|
+
}
|
|
7867
|
+
/**
|
|
7868
|
+
* Calculates the squared length of a vec3
|
|
7869
|
+
*
|
|
7870
|
+
* @param {ReadonlyVec3} a vector to calculate squared length of
|
|
7871
|
+
* @returns {Number} squared length of a
|
|
7872
|
+
*/
|
|
7873
|
+
|
|
7874
|
+
function squaredLength(a) {
|
|
7875
|
+
var x = a[0];
|
|
7876
|
+
var y = a[1];
|
|
7877
|
+
var z = a[2];
|
|
7878
|
+
return x * x + y * y + z * z;
|
|
7879
|
+
}
|
|
7880
|
+
/**
|
|
7881
|
+
* Negates the components of a vec3
|
|
7882
|
+
*
|
|
7883
|
+
* @param {vec3} out the receiving vector
|
|
7884
|
+
* @param {ReadonlyVec3} a vector to negate
|
|
7885
|
+
* @returns {vec3} out
|
|
7886
|
+
*/
|
|
7887
|
+
|
|
7888
|
+
function negate(out, a) {
|
|
7889
|
+
out[0] = -a[0];
|
|
7890
|
+
out[1] = -a[1];
|
|
7891
|
+
out[2] = -a[2];
|
|
7892
|
+
return out;
|
|
7893
|
+
}
|
|
7894
|
+
/**
|
|
7895
|
+
* Returns the inverse of the components of a vec3
|
|
7896
|
+
*
|
|
7897
|
+
* @param {vec3} out the receiving vector
|
|
7898
|
+
* @param {ReadonlyVec3} a vector to invert
|
|
7899
|
+
* @returns {vec3} out
|
|
7900
|
+
*/
|
|
7901
|
+
|
|
7902
|
+
function inverse(out, a) {
|
|
7903
|
+
out[0] = 1.0 / a[0];
|
|
7904
|
+
out[1] = 1.0 / a[1];
|
|
7905
|
+
out[2] = 1.0 / a[2];
|
|
7906
|
+
return out;
|
|
7907
|
+
}
|
|
7908
|
+
/**
|
|
7909
|
+
* Normalize a vec3
|
|
7910
|
+
*
|
|
7911
|
+
* @param {vec3} out the receiving vector
|
|
7912
|
+
* @param {ReadonlyVec3} a vector to normalize
|
|
7913
|
+
* @returns {vec3} out
|
|
7914
|
+
*/
|
|
7915
|
+
|
|
7916
|
+
function normalize(out, a) {
|
|
7917
|
+
var x = a[0];
|
|
7918
|
+
var y = a[1];
|
|
7919
|
+
var z = a[2];
|
|
7920
|
+
var len = x * x + y * y + z * z;
|
|
7921
|
+
|
|
7922
|
+
if (len > 0) {
|
|
7923
|
+
//TODO: evaluate use of glm_invsqrt here?
|
|
7924
|
+
len = 1 / Math.sqrt(len);
|
|
7925
|
+
}
|
|
7926
|
+
|
|
7927
|
+
out[0] = a[0] * len;
|
|
7928
|
+
out[1] = a[1] * len;
|
|
7929
|
+
out[2] = a[2] * len;
|
|
7930
|
+
return out;
|
|
7931
|
+
}
|
|
7932
|
+
/**
|
|
7933
|
+
* Calculates the dot product of two vec3's
|
|
7934
|
+
*
|
|
7935
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7936
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7937
|
+
* @returns {Number} dot product of a and b
|
|
7938
|
+
*/
|
|
7939
|
+
|
|
7940
|
+
function dot(a, b) {
|
|
7941
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
7942
|
+
}
|
|
7943
|
+
/**
|
|
7944
|
+
* Computes the cross product of two vec3's
|
|
7945
|
+
*
|
|
7946
|
+
* @param {vec3} out the receiving vector
|
|
7947
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7948
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7949
|
+
* @returns {vec3} out
|
|
7950
|
+
*/
|
|
7951
|
+
|
|
7952
|
+
function cross(out, a, b) {
|
|
7953
|
+
var ax = a[0],
|
|
7954
|
+
ay = a[1],
|
|
7955
|
+
az = a[2];
|
|
7956
|
+
var bx = b[0],
|
|
7957
|
+
by = b[1],
|
|
7958
|
+
bz = b[2];
|
|
7959
|
+
out[0] = ay * bz - az * by;
|
|
7960
|
+
out[1] = az * bx - ax * bz;
|
|
7961
|
+
out[2] = ax * by - ay * bx;
|
|
7962
|
+
return out;
|
|
7963
|
+
}
|
|
7964
|
+
/**
|
|
7965
|
+
* Performs a linear interpolation between two vec3's
|
|
7966
|
+
*
|
|
7967
|
+
* @param {vec3} out the receiving vector
|
|
7968
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7969
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7970
|
+
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
7971
|
+
* @returns {vec3} out
|
|
7972
|
+
*/
|
|
7973
|
+
|
|
7974
|
+
function lerp(out, a, b, t) {
|
|
7975
|
+
var ax = a[0];
|
|
7976
|
+
var ay = a[1];
|
|
7977
|
+
var az = a[2];
|
|
7978
|
+
out[0] = ax + t * (b[0] - ax);
|
|
7979
|
+
out[1] = ay + t * (b[1] - ay);
|
|
7980
|
+
out[2] = az + t * (b[2] - az);
|
|
7981
|
+
return out;
|
|
7982
|
+
}
|
|
7983
|
+
/**
|
|
7984
|
+
* Performs a hermite interpolation with two control points
|
|
7985
|
+
*
|
|
7986
|
+
* @param {vec3} out the receiving vector
|
|
7987
|
+
* @param {ReadonlyVec3} a the first operand
|
|
7988
|
+
* @param {ReadonlyVec3} b the second operand
|
|
7989
|
+
* @param {ReadonlyVec3} c the third operand
|
|
7990
|
+
* @param {ReadonlyVec3} d the fourth operand
|
|
7991
|
+
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
7992
|
+
* @returns {vec3} out
|
|
7993
|
+
*/
|
|
7994
|
+
|
|
7995
|
+
function hermite(out, a, b, c, d, t) {
|
|
7996
|
+
var factorTimes2 = t * t;
|
|
7997
|
+
var factor1 = factorTimes2 * (2 * t - 3) + 1;
|
|
7998
|
+
var factor2 = factorTimes2 * (t - 2) + t;
|
|
7999
|
+
var factor3 = factorTimes2 * (t - 1);
|
|
8000
|
+
var factor4 = factorTimes2 * (3 - 2 * t);
|
|
8001
|
+
out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
|
|
8002
|
+
out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
|
|
8003
|
+
out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
|
|
8004
|
+
return out;
|
|
8005
|
+
}
|
|
8006
|
+
/**
|
|
8007
|
+
* Performs a bezier interpolation with two control points
|
|
8008
|
+
*
|
|
8009
|
+
* @param {vec3} out the receiving vector
|
|
8010
|
+
* @param {ReadonlyVec3} a the first operand
|
|
8011
|
+
* @param {ReadonlyVec3} b the second operand
|
|
8012
|
+
* @param {ReadonlyVec3} c the third operand
|
|
8013
|
+
* @param {ReadonlyVec3} d the fourth operand
|
|
8014
|
+
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
8015
|
+
* @returns {vec3} out
|
|
8016
|
+
*/
|
|
8017
|
+
|
|
8018
|
+
function bezier(out, a, b, c, d, t) {
|
|
8019
|
+
var inverseFactor = 1 - t;
|
|
8020
|
+
var inverseFactorTimesTwo = inverseFactor * inverseFactor;
|
|
8021
|
+
var factorTimes2 = t * t;
|
|
8022
|
+
var factor1 = inverseFactorTimesTwo * inverseFactor;
|
|
8023
|
+
var factor2 = 3 * t * inverseFactorTimesTwo;
|
|
8024
|
+
var factor3 = 3 * factorTimes2 * inverseFactor;
|
|
8025
|
+
var factor4 = factorTimes2 * t;
|
|
8026
|
+
out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
|
|
8027
|
+
out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
|
|
8028
|
+
out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
|
|
8029
|
+
return out;
|
|
8030
|
+
}
|
|
8031
|
+
/**
|
|
8032
|
+
* Generates a random vector with the given scale
|
|
8033
|
+
*
|
|
8034
|
+
* @param {vec3} out the receiving vector
|
|
8035
|
+
* @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
|
|
8036
|
+
* @returns {vec3} out
|
|
8037
|
+
*/
|
|
8038
|
+
|
|
8039
|
+
function random(out, scale) {
|
|
8040
|
+
scale = scale || 1.0;
|
|
8041
|
+
var r = _common_js__WEBPACK_IMPORTED_MODULE_0__.RANDOM() * 2.0 * Math.PI;
|
|
8042
|
+
var z = _common_js__WEBPACK_IMPORTED_MODULE_0__.RANDOM() * 2.0 - 1.0;
|
|
8043
|
+
var zScale = Math.sqrt(1.0 - z * z) * scale;
|
|
8044
|
+
out[0] = Math.cos(r) * zScale;
|
|
8045
|
+
out[1] = Math.sin(r) * zScale;
|
|
8046
|
+
out[2] = z * scale;
|
|
8047
|
+
return out;
|
|
8048
|
+
}
|
|
8049
|
+
/**
|
|
8050
|
+
* Transforms the vec3 with a mat4.
|
|
8051
|
+
* 4th vector component is implicitly '1'
|
|
8052
|
+
*
|
|
8053
|
+
* @param {vec3} out the receiving vector
|
|
8054
|
+
* @param {ReadonlyVec3} a the vector to transform
|
|
8055
|
+
* @param {ReadonlyMat4} m matrix to transform with
|
|
8056
|
+
* @returns {vec3} out
|
|
8057
|
+
*/
|
|
8058
|
+
|
|
8059
|
+
function transformMat4(out, a, m) {
|
|
8060
|
+
var x = a[0],
|
|
8061
|
+
y = a[1],
|
|
8062
|
+
z = a[2];
|
|
8063
|
+
var w = m[3] * x + m[7] * y + m[11] * z + m[15];
|
|
8064
|
+
w = w || 1.0;
|
|
8065
|
+
out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
|
|
8066
|
+
out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
|
|
8067
|
+
out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
|
|
8068
|
+
return out;
|
|
8069
|
+
}
|
|
8070
|
+
/**
|
|
8071
|
+
* Transforms the vec3 with a mat3.
|
|
8072
|
+
*
|
|
8073
|
+
* @param {vec3} out the receiving vector
|
|
8074
|
+
* @param {ReadonlyVec3} a the vector to transform
|
|
8075
|
+
* @param {ReadonlyMat3} m the 3x3 matrix to transform with
|
|
8076
|
+
* @returns {vec3} out
|
|
8077
|
+
*/
|
|
8078
|
+
|
|
8079
|
+
function transformMat3(out, a, m) {
|
|
8080
|
+
var x = a[0],
|
|
8081
|
+
y = a[1],
|
|
8082
|
+
z = a[2];
|
|
8083
|
+
out[0] = x * m[0] + y * m[3] + z * m[6];
|
|
8084
|
+
out[1] = x * m[1] + y * m[4] + z * m[7];
|
|
8085
|
+
out[2] = x * m[2] + y * m[5] + z * m[8];
|
|
8086
|
+
return out;
|
|
8087
|
+
}
|
|
8088
|
+
/**
|
|
8089
|
+
* Transforms the vec3 with a quat
|
|
8090
|
+
* Can also be used for dual quaternions. (Multiply it with the real part)
|
|
8091
|
+
*
|
|
8092
|
+
* @param {vec3} out the receiving vector
|
|
8093
|
+
* @param {ReadonlyVec3} a the vector to transform
|
|
8094
|
+
* @param {ReadonlyQuat} q quaternion to transform with
|
|
8095
|
+
* @returns {vec3} out
|
|
8096
|
+
*/
|
|
8097
|
+
|
|
8098
|
+
function transformQuat(out, a, q) {
|
|
8099
|
+
// benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed
|
|
8100
|
+
var qx = q[0],
|
|
8101
|
+
qy = q[1],
|
|
8102
|
+
qz = q[2],
|
|
8103
|
+
qw = q[3];
|
|
8104
|
+
var x = a[0],
|
|
8105
|
+
y = a[1],
|
|
8106
|
+
z = a[2]; // var qvec = [qx, qy, qz];
|
|
8107
|
+
// var uv = vec3.cross([], qvec, a);
|
|
8108
|
+
|
|
8109
|
+
var uvx = qy * z - qz * y,
|
|
8110
|
+
uvy = qz * x - qx * z,
|
|
8111
|
+
uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);
|
|
8112
|
+
|
|
8113
|
+
var uuvx = qy * uvz - qz * uvy,
|
|
8114
|
+
uuvy = qz * uvx - qx * uvz,
|
|
8115
|
+
uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);
|
|
8116
|
+
|
|
8117
|
+
var w2 = qw * 2;
|
|
8118
|
+
uvx *= w2;
|
|
8119
|
+
uvy *= w2;
|
|
8120
|
+
uvz *= w2; // vec3.scale(uuv, uuv, 2);
|
|
8121
|
+
|
|
8122
|
+
uuvx *= 2;
|
|
8123
|
+
uuvy *= 2;
|
|
8124
|
+
uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));
|
|
8125
|
+
|
|
8126
|
+
out[0] = x + uvx + uuvx;
|
|
8127
|
+
out[1] = y + uvy + uuvy;
|
|
8128
|
+
out[2] = z + uvz + uuvz;
|
|
8129
|
+
return out;
|
|
8130
|
+
}
|
|
8131
|
+
/**
|
|
8132
|
+
* Rotate a 3D vector around the x-axis
|
|
8133
|
+
* @param {vec3} out The receiving vec3
|
|
8134
|
+
* @param {ReadonlyVec3} a The vec3 point to rotate
|
|
8135
|
+
* @param {ReadonlyVec3} b The origin of the rotation
|
|
8136
|
+
* @param {Number} rad The angle of rotation in radians
|
|
8137
|
+
* @returns {vec3} out
|
|
8138
|
+
*/
|
|
8139
|
+
|
|
8140
|
+
function rotateX(out, a, b, rad) {
|
|
8141
|
+
var p = [],
|
|
8142
|
+
r = []; //Translate point to the origin
|
|
8143
|
+
|
|
8144
|
+
p[0] = a[0] - b[0];
|
|
8145
|
+
p[1] = a[1] - b[1];
|
|
8146
|
+
p[2] = a[2] - b[2]; //perform rotation
|
|
8147
|
+
|
|
8148
|
+
r[0] = p[0];
|
|
8149
|
+
r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);
|
|
8150
|
+
r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position
|
|
8151
|
+
|
|
8152
|
+
out[0] = r[0] + b[0];
|
|
8153
|
+
out[1] = r[1] + b[1];
|
|
8154
|
+
out[2] = r[2] + b[2];
|
|
8155
|
+
return out;
|
|
8156
|
+
}
|
|
8157
|
+
/**
|
|
8158
|
+
* Rotate a 3D vector around the y-axis
|
|
8159
|
+
* @param {vec3} out The receiving vec3
|
|
8160
|
+
* @param {ReadonlyVec3} a The vec3 point to rotate
|
|
8161
|
+
* @param {ReadonlyVec3} b The origin of the rotation
|
|
8162
|
+
* @param {Number} rad The angle of rotation in radians
|
|
8163
|
+
* @returns {vec3} out
|
|
8164
|
+
*/
|
|
8165
|
+
|
|
8166
|
+
function rotateY(out, a, b, rad) {
|
|
8167
|
+
var p = [],
|
|
8168
|
+
r = []; //Translate point to the origin
|
|
8169
|
+
|
|
8170
|
+
p[0] = a[0] - b[0];
|
|
8171
|
+
p[1] = a[1] - b[1];
|
|
8172
|
+
p[2] = a[2] - b[2]; //perform rotation
|
|
8173
|
+
|
|
8174
|
+
r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);
|
|
8175
|
+
r[1] = p[1];
|
|
8176
|
+
r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position
|
|
8177
|
+
|
|
8178
|
+
out[0] = r[0] + b[0];
|
|
8179
|
+
out[1] = r[1] + b[1];
|
|
8180
|
+
out[2] = r[2] + b[2];
|
|
8181
|
+
return out;
|
|
8182
|
+
}
|
|
8183
|
+
/**
|
|
8184
|
+
* Rotate a 3D vector around the z-axis
|
|
8185
|
+
* @param {vec3} out The receiving vec3
|
|
8186
|
+
* @param {ReadonlyVec3} a The vec3 point to rotate
|
|
8187
|
+
* @param {ReadonlyVec3} b The origin of the rotation
|
|
8188
|
+
* @param {Number} rad The angle of rotation in radians
|
|
8189
|
+
* @returns {vec3} out
|
|
8190
|
+
*/
|
|
8191
|
+
|
|
8192
|
+
function rotateZ(out, a, b, rad) {
|
|
8193
|
+
var p = [],
|
|
8194
|
+
r = []; //Translate point to the origin
|
|
8195
|
+
|
|
8196
|
+
p[0] = a[0] - b[0];
|
|
8197
|
+
p[1] = a[1] - b[1];
|
|
8198
|
+
p[2] = a[2] - b[2]; //perform rotation
|
|
8199
|
+
|
|
8200
|
+
r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);
|
|
8201
|
+
r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);
|
|
8202
|
+
r[2] = p[2]; //translate to correct position
|
|
8203
|
+
|
|
8204
|
+
out[0] = r[0] + b[0];
|
|
8205
|
+
out[1] = r[1] + b[1];
|
|
8206
|
+
out[2] = r[2] + b[2];
|
|
8207
|
+
return out;
|
|
8208
|
+
}
|
|
8209
|
+
/**
|
|
8210
|
+
* Get the angle between two 3D vectors
|
|
8211
|
+
* @param {ReadonlyVec3} a The first operand
|
|
8212
|
+
* @param {ReadonlyVec3} b The second operand
|
|
8213
|
+
* @returns {Number} The angle in radians
|
|
8214
|
+
*/
|
|
8215
|
+
|
|
8216
|
+
function angle(a, b) {
|
|
8217
|
+
var ax = a[0],
|
|
8218
|
+
ay = a[1],
|
|
8219
|
+
az = a[2],
|
|
8220
|
+
bx = b[0],
|
|
8221
|
+
by = b[1],
|
|
8222
|
+
bz = b[2],
|
|
8223
|
+
mag1 = Math.sqrt(ax * ax + ay * ay + az * az),
|
|
8224
|
+
mag2 = Math.sqrt(bx * bx + by * by + bz * bz),
|
|
8225
|
+
mag = mag1 * mag2,
|
|
8226
|
+
cosine = mag && dot(a, b) / mag;
|
|
8227
|
+
return Math.acos(Math.min(Math.max(cosine, -1), 1));
|
|
8228
|
+
}
|
|
8229
|
+
/**
|
|
8230
|
+
* Set the components of a vec3 to zero
|
|
8231
|
+
*
|
|
8232
|
+
* @param {vec3} out the receiving vector
|
|
8233
|
+
* @returns {vec3} out
|
|
8234
|
+
*/
|
|
8235
|
+
|
|
8236
|
+
function zero(out) {
|
|
8237
|
+
out[0] = 0.0;
|
|
8238
|
+
out[1] = 0.0;
|
|
8239
|
+
out[2] = 0.0;
|
|
8240
|
+
return out;
|
|
8241
|
+
}
|
|
8242
|
+
/**
|
|
8243
|
+
* Returns a string representation of a vector
|
|
8244
|
+
*
|
|
8245
|
+
* @param {ReadonlyVec3} a vector to represent as a string
|
|
8246
|
+
* @returns {String} string representation of the vector
|
|
8247
|
+
*/
|
|
8248
|
+
|
|
8249
|
+
function str(a) {
|
|
8250
|
+
return "vec3(" + a[0] + ", " + a[1] + ", " + a[2] + ")";
|
|
8251
|
+
}
|
|
8252
|
+
/**
|
|
8253
|
+
* Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
|
|
8254
|
+
*
|
|
8255
|
+
* @param {ReadonlyVec3} a The first vector.
|
|
8256
|
+
* @param {ReadonlyVec3} b The second vector.
|
|
8257
|
+
* @returns {Boolean} True if the vectors are equal, false otherwise.
|
|
8258
|
+
*/
|
|
8259
|
+
|
|
8260
|
+
function exactEquals(a, b) {
|
|
8261
|
+
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
8262
|
+
}
|
|
8263
|
+
/**
|
|
8264
|
+
* Returns whether or not the vectors have approximately the same elements in the same position.
|
|
8265
|
+
*
|
|
8266
|
+
* @param {ReadonlyVec3} a The first vector.
|
|
8267
|
+
* @param {ReadonlyVec3} b The second vector.
|
|
8268
|
+
* @returns {Boolean} True if the vectors are equal, false otherwise.
|
|
8269
|
+
*/
|
|
8270
|
+
|
|
8271
|
+
function equals(a, b) {
|
|
8272
|
+
var a0 = a[0],
|
|
8273
|
+
a1 = a[1],
|
|
8274
|
+
a2 = a[2];
|
|
8275
|
+
var b0 = b[0],
|
|
8276
|
+
b1 = b[1],
|
|
8277
|
+
b2 = b[2];
|
|
8278
|
+
return Math.abs(a0 - b0) <= _common_js__WEBPACK_IMPORTED_MODULE_0__.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _common_js__WEBPACK_IMPORTED_MODULE_0__.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _common_js__WEBPACK_IMPORTED_MODULE_0__.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));
|
|
8279
|
+
}
|
|
8280
|
+
/**
|
|
8281
|
+
* Alias for {@link vec3.subtract}
|
|
8282
|
+
* @function
|
|
8283
|
+
*/
|
|
8284
|
+
|
|
8285
|
+
var sub = subtract;
|
|
8286
|
+
/**
|
|
8287
|
+
* Alias for {@link vec3.multiply}
|
|
8288
|
+
* @function
|
|
8289
|
+
*/
|
|
8290
|
+
|
|
8291
|
+
var mul = multiply;
|
|
8292
|
+
/**
|
|
8293
|
+
* Alias for {@link vec3.divide}
|
|
8294
|
+
* @function
|
|
8295
|
+
*/
|
|
8296
|
+
|
|
8297
|
+
var div = divide;
|
|
8298
|
+
/**
|
|
8299
|
+
* Alias for {@link vec3.distance}
|
|
8300
|
+
* @function
|
|
8301
|
+
*/
|
|
8302
|
+
|
|
8303
|
+
var dist = distance;
|
|
8304
|
+
/**
|
|
8305
|
+
* Alias for {@link vec3.squaredDistance}
|
|
8306
|
+
* @function
|
|
8307
|
+
*/
|
|
8308
|
+
|
|
8309
|
+
var sqrDist = squaredDistance;
|
|
8310
|
+
/**
|
|
8311
|
+
* Alias for {@link vec3.length}
|
|
8312
|
+
* @function
|
|
8313
|
+
*/
|
|
8314
|
+
|
|
8315
|
+
var len = length;
|
|
8316
|
+
/**
|
|
8317
|
+
* Alias for {@link vec3.squaredLength}
|
|
8318
|
+
* @function
|
|
8319
|
+
*/
|
|
8320
|
+
|
|
8321
|
+
var sqrLen = squaredLength;
|
|
8322
|
+
/**
|
|
8323
|
+
* Perform some operation over an array of vec3s.
|
|
8324
|
+
*
|
|
8325
|
+
* @param {Array} a the array of vectors to iterate over
|
|
8326
|
+
* @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
|
|
8327
|
+
* @param {Number} offset Number of elements to skip at the beginning of the array
|
|
8328
|
+
* @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
|
|
8329
|
+
* @param {Function} fn Function to call for each vector in the array
|
|
8330
|
+
* @param {Object} [arg] additional argument to pass to fn
|
|
8331
|
+
* @returns {Array} a
|
|
8332
|
+
* @function
|
|
8333
|
+
*/
|
|
8334
|
+
|
|
8335
|
+
var forEach = function () {
|
|
8336
|
+
var vec = create();
|
|
8337
|
+
return function (a, stride, offset, count, fn, arg) {
|
|
8338
|
+
var i, l;
|
|
8339
|
+
|
|
8340
|
+
if (!stride) {
|
|
8341
|
+
stride = 3;
|
|
8342
|
+
}
|
|
8343
|
+
|
|
8344
|
+
if (!offset) {
|
|
8345
|
+
offset = 0;
|
|
8346
|
+
}
|
|
8347
|
+
|
|
8348
|
+
if (count) {
|
|
8349
|
+
l = Math.min(count * stride + offset, a.length);
|
|
8350
|
+
} else {
|
|
8351
|
+
l = a.length;
|
|
8352
|
+
}
|
|
8353
|
+
|
|
8354
|
+
for (i = offset; i < l; i += stride) {
|
|
8355
|
+
vec[0] = a[i];
|
|
8356
|
+
vec[1] = a[i + 1];
|
|
8357
|
+
vec[2] = a[i + 2];
|
|
8358
|
+
fn(vec, vec, arg);
|
|
8359
|
+
a[i] = vec[0];
|
|
8360
|
+
a[i + 1] = vec[1];
|
|
8361
|
+
a[i + 2] = vec[2];
|
|
8362
|
+
}
|
|
8363
|
+
|
|
8364
|
+
return a;
|
|
8365
|
+
};
|
|
8366
|
+
}();
|
|
8367
|
+
|
|
8368
|
+
/***/ }),
|
|
8369
|
+
|
|
7524
8370
|
/***/ 15958:
|
|
7525
8371
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7526
8372
|
|
|
@@ -8450,7 +9296,24 @@ function closeEndPoint(endpoint) {
|
|
|
8450
9296
|
endpoint.close();
|
|
8451
9297
|
}
|
|
8452
9298
|
function wrap(ep, target) {
|
|
8453
|
-
|
|
9299
|
+
const pendingListeners = new Map();
|
|
9300
|
+
ep.addEventListener("message", function handleMessage(ev) {
|
|
9301
|
+
const { data } = ev;
|
|
9302
|
+
if (!data || !data.id) {
|
|
9303
|
+
return;
|
|
9304
|
+
}
|
|
9305
|
+
const resolver = pendingListeners.get(data.id);
|
|
9306
|
+
if (!resolver) {
|
|
9307
|
+
return;
|
|
9308
|
+
}
|
|
9309
|
+
try {
|
|
9310
|
+
resolver(data);
|
|
9311
|
+
}
|
|
9312
|
+
finally {
|
|
9313
|
+
pendingListeners.delete(data.id);
|
|
9314
|
+
}
|
|
9315
|
+
});
|
|
9316
|
+
return createProxy(ep, pendingListeners, [], target);
|
|
8454
9317
|
}
|
|
8455
9318
|
function throwIfProxyReleased(isReleased) {
|
|
8456
9319
|
if (isReleased) {
|
|
@@ -8458,7 +9321,7 @@ function throwIfProxyReleased(isReleased) {
|
|
|
8458
9321
|
}
|
|
8459
9322
|
}
|
|
8460
9323
|
function releaseEndpoint(ep) {
|
|
8461
|
-
return requestResponseMessage(ep, {
|
|
9324
|
+
return requestResponseMessage(ep, new Map(), {
|
|
8462
9325
|
type: "RELEASE" /* MessageType.RELEASE */,
|
|
8463
9326
|
}).then(() => {
|
|
8464
9327
|
closeEndPoint(ep);
|
|
@@ -8485,7 +9348,7 @@ function unregisterProxy(proxy) {
|
|
|
8485
9348
|
proxyFinalizers.unregister(proxy);
|
|
8486
9349
|
}
|
|
8487
9350
|
}
|
|
8488
|
-
function createProxy(ep, path = [], target = function () { }) {
|
|
9351
|
+
function createProxy(ep, pendingListeners, path = [], target = function () { }) {
|
|
8489
9352
|
let isProxyReleased = false;
|
|
8490
9353
|
const proxy = new Proxy(target, {
|
|
8491
9354
|
get(_target, prop) {
|
|
@@ -8494,6 +9357,7 @@ function createProxy(ep, path = [], target = function () { }) {
|
|
|
8494
9357
|
return () => {
|
|
8495
9358
|
unregisterProxy(proxy);
|
|
8496
9359
|
releaseEndpoint(ep);
|
|
9360
|
+
pendingListeners.clear();
|
|
8497
9361
|
isProxyReleased = true;
|
|
8498
9362
|
};
|
|
8499
9363
|
}
|
|
@@ -8501,20 +9365,20 @@ function createProxy(ep, path = [], target = function () { }) {
|
|
|
8501
9365
|
if (path.length === 0) {
|
|
8502
9366
|
return { then: () => proxy };
|
|
8503
9367
|
}
|
|
8504
|
-
const r = requestResponseMessage(ep, {
|
|
9368
|
+
const r = requestResponseMessage(ep, pendingListeners, {
|
|
8505
9369
|
type: "GET" /* MessageType.GET */,
|
|
8506
9370
|
path: path.map((p) => p.toString()),
|
|
8507
9371
|
}).then(fromWireValue);
|
|
8508
9372
|
return r.then.bind(r);
|
|
8509
9373
|
}
|
|
8510
|
-
return createProxy(ep, [...path, prop]);
|
|
9374
|
+
return createProxy(ep, pendingListeners, [...path, prop]);
|
|
8511
9375
|
},
|
|
8512
9376
|
set(_target, prop, rawValue) {
|
|
8513
9377
|
throwIfProxyReleased(isProxyReleased);
|
|
8514
9378
|
// FIXME: ES6 Proxy Handler `set` methods are supposed to return a
|
|
8515
9379
|
// boolean. To show good will, we return true asynchronously ¯\_(ツ)_/¯
|
|
8516
9380
|
const [value, transferables] = toWireValue(rawValue);
|
|
8517
|
-
return requestResponseMessage(ep, {
|
|
9381
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
8518
9382
|
type: "SET" /* MessageType.SET */,
|
|
8519
9383
|
path: [...path, prop].map((p) => p.toString()),
|
|
8520
9384
|
value,
|
|
@@ -8524,16 +9388,16 @@ function createProxy(ep, path = [], target = function () { }) {
|
|
|
8524
9388
|
throwIfProxyReleased(isProxyReleased);
|
|
8525
9389
|
const last = path[path.length - 1];
|
|
8526
9390
|
if (last === createEndpoint) {
|
|
8527
|
-
return requestResponseMessage(ep, {
|
|
9391
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
8528
9392
|
type: "ENDPOINT" /* MessageType.ENDPOINT */,
|
|
8529
9393
|
}).then(fromWireValue);
|
|
8530
9394
|
}
|
|
8531
9395
|
// We just pretend that `bind()` didn’t happen.
|
|
8532
9396
|
if (last === "bind") {
|
|
8533
|
-
return createProxy(ep, path.slice(0, -1));
|
|
9397
|
+
return createProxy(ep, pendingListeners, path.slice(0, -1));
|
|
8534
9398
|
}
|
|
8535
9399
|
const [argumentList, transferables] = processArguments(rawArgumentList);
|
|
8536
|
-
return requestResponseMessage(ep, {
|
|
9400
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
8537
9401
|
type: "APPLY" /* MessageType.APPLY */,
|
|
8538
9402
|
path: path.map((p) => p.toString()),
|
|
8539
9403
|
argumentList,
|
|
@@ -8542,7 +9406,7 @@ function createProxy(ep, path = [], target = function () { }) {
|
|
|
8542
9406
|
construct(_target, rawArgumentList) {
|
|
8543
9407
|
throwIfProxyReleased(isProxyReleased);
|
|
8544
9408
|
const [argumentList, transferables] = processArguments(rawArgumentList);
|
|
8545
|
-
return requestResponseMessage(ep, {
|
|
9409
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
8546
9410
|
type: "CONSTRUCT" /* MessageType.CONSTRUCT */,
|
|
8547
9411
|
path: path.map((p) => p.toString()),
|
|
8548
9412
|
argumentList,
|
|
@@ -8604,16 +9468,10 @@ function fromWireValue(value) {
|
|
|
8604
9468
|
return value.value;
|
|
8605
9469
|
}
|
|
8606
9470
|
}
|
|
8607
|
-
function requestResponseMessage(ep, msg, transfers) {
|
|
9471
|
+
function requestResponseMessage(ep, pendingListeners, msg, transfers) {
|
|
8608
9472
|
return new Promise((resolve) => {
|
|
8609
9473
|
const id = generateUUID();
|
|
8610
|
-
|
|
8611
|
-
if (!ev.data || !ev.data.id || ev.data.id !== id) {
|
|
8612
|
-
return;
|
|
8613
|
-
}
|
|
8614
|
-
ep.removeEventListener("message", l);
|
|
8615
|
-
resolve(ev.data);
|
|
8616
|
-
});
|
|
9474
|
+
pendingListeners.set(id, resolve);
|
|
8617
9475
|
if (ep.start) {
|
|
8618
9476
|
ep.start();
|
|
8619
9477
|
}
|