x_ite 8.6.0 → 8.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +7 -7
- package/dist/assets/components/Annotation.js +13 -13
- package/dist/assets/components/Annotation.min.js +1 -1
- package/dist/assets/components/CADGeometry.js +13 -13
- package/dist/assets/components/CADGeometry.min.js +1 -1
- package/dist/assets/components/CubeMapTexturing.js +25 -25
- package/dist/assets/components/CubeMapTexturing.min.js +1 -1
- package/dist/assets/components/DIS.js +13 -13
- package/dist/assets/components/DIS.min.js +1 -1
- package/dist/assets/components/EventUtilities.js +9 -9
- package/dist/assets/components/EventUtilities.min.js +1 -1
- package/dist/assets/components/Geometry2D.js +19 -19
- package/dist/assets/components/Geometry2D.min.js +1 -1
- package/dist/assets/components/Geospatial.js +33 -33
- package/dist/assets/components/Geospatial.min.js +1 -1
- package/dist/assets/components/HAnim.js +18 -18
- package/dist/assets/components/HAnim.min.js +1 -1
- package/dist/assets/components/KeyDeviceSensor.js +8 -8
- package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
- package/dist/assets/components/Layout.js +27 -27
- package/dist/assets/components/Layout.min.js +1 -1
- package/dist/assets/components/NURBS.js +24 -24
- package/dist/assets/components/NURBS.min.js +1 -1
- package/dist/assets/components/ParticleSystems.js +23 -23
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +19 -19
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +18 -18
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +28 -28
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +39 -48
- package/dist/assets/components/Text.min.js +1 -1
- package/dist/assets/components/TextureProjector.js +14 -14
- package/dist/assets/components/TextureProjector.min.js +1 -1
- package/dist/assets/components/Texturing3D.js +32 -32
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +19 -19
- package/dist/assets/components/VolumeRendering.min.js +1 -1
- package/dist/assets/components/X_ITE.js +9 -9
- package/dist/assets/components/X_ITE.min.js +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +690 -936
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +2 -2
- package/docs/_includes/scripts.html +2 -2
- package/docs/_posts/components/CADGeometry/IndexedQuadSet.md +1 -1
- package/docs/_posts/components/CADGeometry/QuadSet.md +1 -1
- package/docs/_posts/components/Geometry3D/ElevationGrid.md +1 -1
- package/docs/_posts/components/Geometry3D/Extrusion.md +1 -1
- package/docs/_posts/components/Geometry3D/IndexedFaceSet.md +1 -1
- package/docs/_posts/components/Geospatial/GeoElevationGrid.md +1 -1
- package/docs/_posts/components/NURBS/NurbsSweptSurface.md +1 -1
- package/docs/_posts/components/NURBS/NurbsSwungSurface.md +1 -1
- package/docs/_posts/components/Rendering/IndexedTriangleFanSet.md +1 -1
- package/docs/_posts/components/Rendering/IndexedTriangleSet.md +1 -1
- package/docs/_posts/components/Rendering/IndexedTriangleStripSet.md +1 -1
- package/docs/_posts/components/Rendering/TriangleFanSet.md +1 -1
- package/docs/_posts/components/Rendering/TriangleSet.md +1 -1
- package/docs/_posts/components/Rendering/TriangleStripSet.md +1 -1
- package/docs/_posts/components/Shape/Material.md +1 -1
- package/docs/_posts/getting-started.md +1 -1
- package/docs/_posts/laboratory/x3d-file-converter.md +178 -0
- package/docs/_tabs/playground.html +80 -133
- package/docs/assets/css/style.scss +2 -42
- package/docs/laboratory/3d-l-system-generator.html +1 -1
- package/docs/laboratory/gltf-sample-viewer.html +1 -1
- package/docs/laboratory/online-dicom-and-nrrd-file-viewer.html +1 -1
- package/docs/laboratory/real-time-earth-quake-information.html +1 -1
- package/docs/laboratory/x3d-visual-blend-mode-editor.html +1 -1
- package/package.json +1 -1
- package/src/standard/Math/Algorithms/Bezier.js +133 -182
- package/src/standard/Math/Geometry/Box2.js +0 -1
- package/src/standard/Math/Geometry/Box3.js +0 -1
- package/src/standard/Math/Geometry/Cylinder3.js +1 -1
- package/src/standard/Math/Geometry/Line2.js +2 -4
- package/src/standard/Math/Geometry/Line3.js +2 -4
- package/src/standard/Math/Geometry/Plane3.js +1 -3
- package/src/standard/Math/Geometry/Sphere3.js +8 -12
- package/src/standard/Math/Geometry/Triangle3.js +8 -0
- package/src/standard/Math/Geometry/ViewVolume.js +17 -27
- package/src/standard/Math/Numbers/Color3.js +4 -7
- package/src/standard/Math/Numbers/Complex.js +8 -9
- package/src/standard/Math/Numbers/Matrix2.js +31 -42
- package/src/standard/Math/Numbers/Matrix3.js +54 -97
- package/src/standard/Math/Numbers/Matrix4.js +49 -160
- package/src/standard/Math/Numbers/Quaternion.js +20 -24
- package/src/standard/Math/Numbers/Rotation4.js +1 -2
- package/src/standard/Math/Numbers/Vector2.js +4 -12
- package/src/standard/Math/Numbers/Vector3.js +6 -18
- package/src/standard/Math/Numbers/Vector4.js +4 -20
- package/src/standard/Time/StopWatch.js +9 -14
- package/src/tests.js +11 -0
- package/src/x_ite/Browser/Core/BrowserTimings.js +10 -10
- package/src/x_ite/Browser/Core/X3DCoreContext.js +4 -6
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator.js +94 -88
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator1.js +2 -3
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +17 -14
- package/src/x_ite/Browser/Text/PolygonText.js +15 -24
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Components/Core/X3DNode.js +12 -0
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +18 -0
- package/src/x_ite/Components/Interpolation/SquadOrientationInterpolator.js +8 -7
- package/src/x_ite/Configuration/UnitInfo.js +2 -0
- package/src/x_ite/Execution/X3DExportedNode.js +4 -0
- package/src/x_ite/Execution/X3DImportedNode.js +14 -0
- package/src/x_ite/Execution/X3DScene.js +4 -0
- package/src/x_ite/Fields/SFString.js +4 -6
- package/src/x_ite/InputOutput/FileLoader.js +1 -1
- package/src/x_ite/InputOutput/Generator.js +35 -55
- package/src/x_ite/Parser/GLTF2Parser.js +4 -4
- package/src/x_ite/Parser/SVGParser.js +24 -47
- package/src/x_ite/Parser/X3DParser.js +1 -1
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +4 -0
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +4 -0
- package/src/x_ite/Routing/X3DRoute.js +8 -0
|
@@ -56,22 +56,8 @@ function Matrix4 ()
|
|
|
56
56
|
{
|
|
57
57
|
if (arguments .length)
|
|
58
58
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this [ 2] = arguments [ 2];
|
|
62
|
-
this [ 3] = arguments [ 3];
|
|
63
|
-
this [ 4] = arguments [ 4];
|
|
64
|
-
this [ 5] = arguments [ 5];
|
|
65
|
-
this [ 6] = arguments [ 6];
|
|
66
|
-
this [ 7] = arguments [ 7];
|
|
67
|
-
this [ 8] = arguments [ 8];
|
|
68
|
-
this [ 9] = arguments [ 9];
|
|
69
|
-
this [10] = arguments [10];
|
|
70
|
-
this [11] = arguments [11];
|
|
71
|
-
this [12] = arguments [12];
|
|
72
|
-
this [13] = arguments [13];
|
|
73
|
-
this [14] = arguments [14];
|
|
74
|
-
this [15] = arguments [15];
|
|
59
|
+
for (let i = 0; i < 16; ++ i)
|
|
60
|
+
this [i] = arguments [i];
|
|
75
61
|
}
|
|
76
62
|
else
|
|
77
63
|
{
|
|
@@ -94,42 +80,17 @@ Matrix4 .prototype =
|
|
|
94
80
|
copy: function ()
|
|
95
81
|
{
|
|
96
82
|
const copy = Object .create (Matrix4 .prototype);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
copy [ 4] = this [ 4];
|
|
102
|
-
copy [ 5] = this [ 5];
|
|
103
|
-
copy [ 6] = this [ 6];
|
|
104
|
-
copy [ 7] = this [ 7];
|
|
105
|
-
copy [ 8] = this [ 8];
|
|
106
|
-
copy [ 9] = this [ 9];
|
|
107
|
-
copy [10] = this [10];
|
|
108
|
-
copy [11] = this [11];
|
|
109
|
-
copy [12] = this [12];
|
|
110
|
-
copy [13] = this [13];
|
|
111
|
-
copy [14] = this [14];
|
|
112
|
-
copy [15] = this [15];
|
|
83
|
+
|
|
84
|
+
for (let i = 0; i < 16; ++ i)
|
|
85
|
+
copy [i] = this [i];
|
|
86
|
+
|
|
113
87
|
return copy;
|
|
114
88
|
},
|
|
115
89
|
assign: function (matrix)
|
|
116
90
|
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
this [ 3] = matrix [ 3];
|
|
121
|
-
this [ 4] = matrix [ 4];
|
|
122
|
-
this [ 5] = matrix [ 5];
|
|
123
|
-
this [ 6] = matrix [ 6];
|
|
124
|
-
this [ 7] = matrix [ 7];
|
|
125
|
-
this [ 8] = matrix [ 8];
|
|
126
|
-
this [ 9] = matrix [ 9];
|
|
127
|
-
this [10] = matrix [10];
|
|
128
|
-
this [11] = matrix [11];
|
|
129
|
-
this [12] = matrix [12];
|
|
130
|
-
this [13] = matrix [13];
|
|
131
|
-
this [14] = matrix [14];
|
|
132
|
-
this [15] = matrix [15];
|
|
91
|
+
for (let i = 0; i < 16; ++ i)
|
|
92
|
+
this [i] = matrix [i];
|
|
93
|
+
|
|
133
94
|
return this;
|
|
134
95
|
},
|
|
135
96
|
equals: function (matrix)
|
|
@@ -282,22 +243,9 @@ Matrix4 .prototype =
|
|
|
282
243
|
}
|
|
283
244
|
case 16:
|
|
284
245
|
{
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
this [ 3] = arguments [ 3];
|
|
289
|
-
this [ 4] = arguments [ 4];
|
|
290
|
-
this [ 5] = arguments [ 5];
|
|
291
|
-
this [ 6] = arguments [ 6];
|
|
292
|
-
this [ 7] = arguments [ 7];
|
|
293
|
-
this [ 8] = arguments [ 8];
|
|
294
|
-
this [ 9] = arguments [ 9];
|
|
295
|
-
this [10] = arguments [10];
|
|
296
|
-
this [11] = arguments [11];
|
|
297
|
-
this [12] = arguments [12];
|
|
298
|
-
this [13] = arguments [13];
|
|
299
|
-
this [14] = arguments [14];
|
|
300
|
-
this [15] = arguments [15];
|
|
246
|
+
for (let i = 0; i < 16; ++ i)
|
|
247
|
+
this [i] = arguments [i];
|
|
248
|
+
|
|
301
249
|
break;
|
|
302
250
|
}
|
|
303
251
|
}
|
|
@@ -369,10 +317,7 @@ Matrix4 .prototype =
|
|
|
369
317
|
setQuaternion: function (quaternion)
|
|
370
318
|
{
|
|
371
319
|
const
|
|
372
|
-
x = quaternion
|
|
373
|
-
y = quaternion .y,
|
|
374
|
-
z = quaternion .z,
|
|
375
|
-
w = quaternion .w,
|
|
320
|
+
{ x, y, z, w } = quaternion,
|
|
376
321
|
A = y * y,
|
|
377
322
|
B = z * z,
|
|
378
323
|
C = x * y,
|
|
@@ -461,22 +406,8 @@ Matrix4 .prototype =
|
|
|
461
406
|
determinant: function ()
|
|
462
407
|
{
|
|
463
408
|
const
|
|
464
|
-
m00
|
|
465
|
-
|
|
466
|
-
m02 = this [ 2],
|
|
467
|
-
m03 = this [ 3],
|
|
468
|
-
m04 = this [ 4],
|
|
469
|
-
m05 = this [ 5],
|
|
470
|
-
m06 = this [ 6],
|
|
471
|
-
m07 = this [ 7],
|
|
472
|
-
m08 = this [ 8],
|
|
473
|
-
m09 = this [ 9],
|
|
474
|
-
m10 = this [10],
|
|
475
|
-
m11 = this [11],
|
|
476
|
-
m12 = this [12],
|
|
477
|
-
m13 = this [13],
|
|
478
|
-
m14 = this [14],
|
|
479
|
-
m15 = this [15],
|
|
409
|
+
{ 0: m00, 1: m01, 2: m02, 3: m03, 4: m04, 5: m05, 6: m06, 7: m07,
|
|
410
|
+
8: m08, 9: m09, 10: m10, 11: m11, 12: m12, 13: m13, 14: m14, 15: m15 } = this,
|
|
480
411
|
b = m10 * m15,
|
|
481
412
|
c = m14 * m11,
|
|
482
413
|
d = m06 * m15,
|
|
@@ -512,22 +443,8 @@ Matrix4 .prototype =
|
|
|
512
443
|
inverse: function ()
|
|
513
444
|
{
|
|
514
445
|
const
|
|
515
|
-
m00
|
|
516
|
-
|
|
517
|
-
m02 = this [ 2],
|
|
518
|
-
m03 = this [ 3],
|
|
519
|
-
m04 = this [ 4],
|
|
520
|
-
m05 = this [ 5],
|
|
521
|
-
m06 = this [ 6],
|
|
522
|
-
m07 = this [ 7],
|
|
523
|
-
m08 = this [ 8],
|
|
524
|
-
m09 = this [ 9],
|
|
525
|
-
m10 = this [10],
|
|
526
|
-
m11 = this [11],
|
|
527
|
-
m12 = this [12],
|
|
528
|
-
m13 = this [13],
|
|
529
|
-
m14 = this [14],
|
|
530
|
-
m15 = this [15],
|
|
446
|
+
{ 0: m00, 1: m01, 2: m02, 3: m03, 4: m04, 5: m05, 6: m06, 7: m07,
|
|
447
|
+
8: m08, 9: m09, 10: m10, 11: m11, 12: m12, 13: m13, 14: m14, 15: m15 } = this,
|
|
531
448
|
b = m10 * m15,
|
|
532
449
|
c = m14 * m11,
|
|
533
450
|
d = m06 * m15,
|
|
@@ -585,14 +502,10 @@ Matrix4 .prototype =
|
|
|
585
502
|
multLeft: function (matrix)
|
|
586
503
|
{
|
|
587
504
|
const
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
b00 = matrix [ 0], b01 = matrix [ 1], b02 = matrix [ 2], b03 = matrix [ 3],
|
|
593
|
-
b04 = matrix [ 4], b05 = matrix [ 5], b06 = matrix [ 6], b07 = matrix [ 7],
|
|
594
|
-
b08 = matrix [ 8], b09 = matrix [ 9], b10 = matrix [10], b11 = matrix [11],
|
|
595
|
-
b12 = matrix [12], b13 = matrix [13], b14 = matrix [14], b15 = matrix [15];
|
|
505
|
+
{ 0: a00, 1: a01, 2: a02, 3: a03, 4: a04, 5: a05, 6: a06, 7: a07,
|
|
506
|
+
8: a08, 9: a09, 10: a10, 11: a11, 12: a12, 13: a13, 14: a14, 15: a15 } = this,
|
|
507
|
+
{ 0: b00, 1: b01, 2: b02, 3: b03, 4: b04, 5: b05, 6: b06, 7: b07,
|
|
508
|
+
8: b08, 9: b09, 10: b10, 11: b11, 12: b12, 13: b13, 14: b14, 15: b15 } = matrix;
|
|
596
509
|
|
|
597
510
|
this [ 0] = a00 * b00 + a04 * b01 + a08 * b02 + a12 * b03;
|
|
598
511
|
this [ 1] = a01 * b00 + a05 * b01 + a09 * b02 + a13 * b03;
|
|
@@ -616,14 +529,10 @@ Matrix4 .prototype =
|
|
|
616
529
|
multRight: function (matrix)
|
|
617
530
|
{
|
|
618
531
|
const
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
b00 = matrix [ 0], b01 = matrix [ 1], b02 = matrix [ 2], b03 = matrix [ 3],
|
|
624
|
-
b04 = matrix [ 4], b05 = matrix [ 5], b06 = matrix [ 6], b07 = matrix [ 7],
|
|
625
|
-
b08 = matrix [ 8], b09 = matrix [ 9], b10 = matrix [10], b11 = matrix [11],
|
|
626
|
-
b12 = matrix [12], b13 = matrix [13], b14 = matrix [14], b15 = matrix [15];
|
|
532
|
+
{ 0: a00, 1: a01, 2: a02, 3: a03, 4: a04, 5: a05, 6: a06, 7: a07,
|
|
533
|
+
8: a08, 9: a09, 10: a10, 11: a11, 12: a12, 13: a13, 14: a14, 15: a15 } = this,
|
|
534
|
+
{ 0: b00, 1: b01, 2: b02, 3: b03, 4: b04, 5: b05, 6: b06, 7: b07,
|
|
535
|
+
8: b08, 9: b09, 10: b10, 11: b11, 12: b12, 13: b13, 14: b14, 15: b15 } = matrix;
|
|
627
536
|
|
|
628
537
|
this [ 0] = a00 * b00 + a01 * b04 + a02 * b08 + a03 * b12;
|
|
629
538
|
this [ 1] = a00 * b01 + a01 * b05 + a02 * b09 + a03 * b13;
|
|
@@ -649,9 +558,7 @@ Matrix4 .prototype =
|
|
|
649
558
|
if (vector .length === 3)
|
|
650
559
|
{
|
|
651
560
|
const
|
|
652
|
-
x = vector
|
|
653
|
-
y = vector .y,
|
|
654
|
-
z = vector .z,
|
|
561
|
+
{ x, y, z } = vector,
|
|
655
562
|
w = 1 / (x * this [3] + y * this [7] + z * this [11] + this [15]);
|
|
656
563
|
|
|
657
564
|
vector .x = (x * this [0] + y * this [4] + z * this [ 8] + this [12]) * w;
|
|
@@ -660,28 +567,24 @@ Matrix4 .prototype =
|
|
|
660
567
|
|
|
661
568
|
return vector;
|
|
662
569
|
}
|
|
570
|
+
else
|
|
571
|
+
{
|
|
572
|
+
const { x, y, z, w } = vector;
|
|
663
573
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
w = vector .w;
|
|
669
|
-
|
|
670
|
-
vector .x = x * this [0] + y * this [4] + z * this [ 8] + w * this [12];
|
|
671
|
-
vector .y = x * this [1] + y * this [5] + z * this [ 9] + w * this [13];
|
|
672
|
-
vector .z = x * this [2] + y * this [6] + z * this [10] + w * this [14];
|
|
673
|
-
vector .w = x * this [3] + y * this [7] + z * this [11] + w * this [15];
|
|
574
|
+
vector .x = x * this [0] + y * this [4] + z * this [ 8] + w * this [12];
|
|
575
|
+
vector .y = x * this [1] + y * this [5] + z * this [ 9] + w * this [13];
|
|
576
|
+
vector .z = x * this [2] + y * this [6] + z * this [10] + w * this [14];
|
|
577
|
+
vector .w = x * this [3] + y * this [7] + z * this [11] + w * this [15];
|
|
674
578
|
|
|
675
|
-
|
|
579
|
+
return vector;
|
|
580
|
+
}
|
|
676
581
|
},
|
|
677
582
|
multMatrixVec: function (vector)
|
|
678
583
|
{
|
|
679
584
|
if (vector .length === 3)
|
|
680
585
|
{
|
|
681
586
|
const
|
|
682
|
-
x = vector
|
|
683
|
-
y = vector .y,
|
|
684
|
-
z = vector .z,
|
|
587
|
+
{ x, y, z } = vector,
|
|
685
588
|
w = 1 / (x * this [12] + y * this [13] + z * this [14] + this [15]);
|
|
686
589
|
|
|
687
590
|
vector .x = (x * this [0] + y * this [1] + z * this [ 2] + this [ 3]) * w;
|
|
@@ -690,26 +593,21 @@ Matrix4 .prototype =
|
|
|
690
593
|
|
|
691
594
|
return vector;
|
|
692
595
|
}
|
|
596
|
+
else
|
|
597
|
+
{
|
|
598
|
+
const { x, y, z, w } = vector;
|
|
693
599
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
w = vector .w;
|
|
699
|
-
|
|
700
|
-
vector .x = x * this [ 0] + y * this [ 1] + z * this [ 2] + w * this [ 3];
|
|
701
|
-
vector .y = x * this [ 4] + y * this [ 5] + z * this [ 6] + w * this [ 7];
|
|
702
|
-
vector .z = x * this [ 8] + y * this [ 9] + z * this [10] + w * this [11];
|
|
703
|
-
vector .w = x * this [12] + y * this [13] + z * this [14] + w * this [15];
|
|
600
|
+
vector .x = x * this [ 0] + y * this [ 1] + z * this [ 2] + w * this [ 3];
|
|
601
|
+
vector .y = x * this [ 4] + y * this [ 5] + z * this [ 6] + w * this [ 7];
|
|
602
|
+
vector .z = x * this [ 8] + y * this [ 9] + z * this [10] + w * this [11];
|
|
603
|
+
vector .w = x * this [12] + y * this [13] + z * this [14] + w * this [15];
|
|
704
604
|
|
|
705
|
-
|
|
605
|
+
return vector;
|
|
606
|
+
}
|
|
706
607
|
},
|
|
707
608
|
multDirMatrix: function (vector)
|
|
708
609
|
{
|
|
709
|
-
const
|
|
710
|
-
x = vector .x,
|
|
711
|
-
y = vector .y,
|
|
712
|
-
z = vector .z;
|
|
610
|
+
const { x, y, z } = vector;
|
|
713
611
|
|
|
714
612
|
vector .x = x * this [0] + y * this [4] + z * this [ 8];
|
|
715
613
|
vector .y = x * this [1] + y * this [5] + z * this [ 9];
|
|
@@ -719,10 +617,7 @@ Matrix4 .prototype =
|
|
|
719
617
|
},
|
|
720
618
|
multMatrixDir: function (vector)
|
|
721
619
|
{
|
|
722
|
-
const
|
|
723
|
-
x = vector .x,
|
|
724
|
-
y = vector .y,
|
|
725
|
-
z = vector .z;
|
|
620
|
+
const { x, y, z } = vector;
|
|
726
621
|
|
|
727
622
|
vector .x = x * this [0] + y * this [1] + z * this [ 2];
|
|
728
623
|
vector .y = x * this [4] + y * this [5] + z * this [ 6];
|
|
@@ -741,10 +636,7 @@ Matrix4 .prototype =
|
|
|
741
636
|
},
|
|
742
637
|
translate: function (translation)
|
|
743
638
|
{
|
|
744
|
-
const
|
|
745
|
-
x = translation .x,
|
|
746
|
-
y = translation .y,
|
|
747
|
-
z = translation .z;
|
|
639
|
+
const { x, y, z } = translation;
|
|
748
640
|
|
|
749
641
|
this [12] += this [ 0] * x + this [ 4] * y + this [ 8] * z;
|
|
750
642
|
this [13] += this [ 1] * x + this [ 5] * y + this [ 9] * z;
|
|
@@ -758,10 +650,7 @@ Matrix4 .prototype =
|
|
|
758
650
|
},
|
|
759
651
|
scale: function (scale)
|
|
760
652
|
{
|
|
761
|
-
const
|
|
762
|
-
x = scale .x,
|
|
763
|
-
y = scale .y,
|
|
764
|
-
z = scale .z;
|
|
653
|
+
const { x, y, z } = scale;
|
|
765
654
|
|
|
766
655
|
this [ 0] *= x;
|
|
767
656
|
this [ 4] *= y;
|
|
@@ -139,11 +139,7 @@ Quaternion .prototype =
|
|
|
139
139
|
},
|
|
140
140
|
getMatrix: function (matrix)
|
|
141
141
|
{
|
|
142
|
-
const
|
|
143
|
-
x = this .x,
|
|
144
|
-
y = this .y,
|
|
145
|
-
z = this .z,
|
|
146
|
-
w = this .w;
|
|
142
|
+
const { x, y, z, w } = this;
|
|
147
143
|
|
|
148
144
|
const
|
|
149
145
|
a = x * x,
|
|
@@ -227,8 +223,8 @@ Quaternion .prototype =
|
|
|
227
223
|
multLeft: function (quat)
|
|
228
224
|
{
|
|
229
225
|
const
|
|
230
|
-
|
|
231
|
-
|
|
226
|
+
{ x: ax, y: ay, z: az, w: aw } = this,
|
|
227
|
+
{ x: bx, y: by, z: bz, w: bw } = quat;
|
|
232
228
|
|
|
233
229
|
this .x = aw * bx + ax * bw + ay * bz - az * by;
|
|
234
230
|
this .y = aw * by + ay * bw + az * bx - ax * bz;
|
|
@@ -240,8 +236,8 @@ Quaternion .prototype =
|
|
|
240
236
|
multRight: function (quat)
|
|
241
237
|
{
|
|
242
238
|
const
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
{ x: ax, y: ay, z: az, w: aw } = this,
|
|
240
|
+
{ x: bx, y: by, z: bz, w: bw } = quat;
|
|
245
241
|
|
|
246
242
|
this .x = bw * ax + bx * aw + by * az - bz * ay;
|
|
247
243
|
this .y = bw * ay + by * aw + bz * ax - bx * az;
|
|
@@ -261,8 +257,8 @@ Quaternion .prototype =
|
|
|
261
257
|
multVecQuat: function (vector)
|
|
262
258
|
{
|
|
263
259
|
const
|
|
264
|
-
|
|
265
|
-
|
|
260
|
+
{ x: qx, y: qy, z: qz, w: qw } = this,
|
|
261
|
+
{ x: vx, y: vy, z: vz } = vector,
|
|
266
262
|
a = qw * qw - qx * qx - qy * qy - qz * qz,
|
|
267
263
|
b = 2 * (vx * qx + vy * qy + vz * qz),
|
|
268
264
|
c = 2 * qw;
|
|
@@ -276,8 +272,8 @@ Quaternion .prototype =
|
|
|
276
272
|
multQuatVec: function (vector)
|
|
277
273
|
{
|
|
278
274
|
const
|
|
279
|
-
|
|
280
|
-
|
|
275
|
+
{ x: qx, y: qy, z: qz, w: qw } = this,
|
|
276
|
+
{ x: vx, y: vy, z: vz } = vector,
|
|
281
277
|
a = qw * qw - qx * qx - qy * qy - qz * qz,
|
|
282
278
|
b = 2 * (vx * qx + vy * qy + vz * qz),
|
|
283
279
|
c = 2 * qw;
|
|
@@ -290,16 +286,14 @@ Quaternion .prototype =
|
|
|
290
286
|
},
|
|
291
287
|
normalize: function ()
|
|
292
288
|
{
|
|
293
|
-
|
|
289
|
+
const length = Math .hypot (this .x, this .y, this .z, this .w);
|
|
294
290
|
|
|
295
291
|
if (length)
|
|
296
292
|
{
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
this .
|
|
300
|
-
this .
|
|
301
|
-
this .z *= length;
|
|
302
|
-
this .w *= length;
|
|
293
|
+
this .x /= length;
|
|
294
|
+
this .y /= length;
|
|
295
|
+
this .z /= length;
|
|
296
|
+
this .w /= length;
|
|
303
297
|
}
|
|
304
298
|
|
|
305
299
|
return this;
|
|
@@ -313,10 +307,12 @@ Quaternion .prototype =
|
|
|
313
307
|
},
|
|
314
308
|
norm: function ()
|
|
315
309
|
{
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
310
|
+
const { x, y, z, w } = this;
|
|
311
|
+
|
|
312
|
+
return x * x +
|
|
313
|
+
y * y +
|
|
314
|
+
z * z +
|
|
315
|
+
w * w;
|
|
320
316
|
},
|
|
321
317
|
magnitude: function ()
|
|
322
318
|
{
|
|
@@ -151,9 +151,7 @@ Vector2 .prototype =
|
|
|
151
151
|
},
|
|
152
152
|
norm: function ()
|
|
153
153
|
{
|
|
154
|
-
const
|
|
155
|
-
x = this .x,
|
|
156
|
-
y = this .y;
|
|
154
|
+
const { x, y } = this;
|
|
157
155
|
|
|
158
156
|
return x * x +
|
|
159
157
|
y * y;
|
|
@@ -169,9 +167,7 @@ Vector2 .prototype =
|
|
|
169
167
|
},
|
|
170
168
|
lerp: function (destination, t)
|
|
171
169
|
{
|
|
172
|
-
const
|
|
173
|
-
x = this .x,
|
|
174
|
-
y = this .y;
|
|
170
|
+
const { x, y } = this;
|
|
175
171
|
|
|
176
172
|
this .x = x + t * (destination .x - x);
|
|
177
173
|
this .y = y + t * (destination .y - y);
|
|
@@ -185,9 +181,7 @@ Vector2 .prototype =
|
|
|
185
181
|
},
|
|
186
182
|
min: function (vector)
|
|
187
183
|
{
|
|
188
|
-
let
|
|
189
|
-
x = this .x,
|
|
190
|
-
y = this .y;
|
|
184
|
+
let { x, y } = this;
|
|
191
185
|
|
|
192
186
|
for (const vector of arguments)
|
|
193
187
|
{
|
|
@@ -201,9 +195,7 @@ Vector2 .prototype =
|
|
|
201
195
|
},
|
|
202
196
|
max: function (vector)
|
|
203
197
|
{
|
|
204
|
-
let
|
|
205
|
-
x = this .x,
|
|
206
|
-
y = this .y;
|
|
198
|
+
let { x, y } = this;
|
|
207
199
|
|
|
208
200
|
for (const vector of arguments)
|
|
209
201
|
{
|
|
@@ -151,8 +151,8 @@ Vector3 .prototype =
|
|
|
151
151
|
cross: function (vector)
|
|
152
152
|
{
|
|
153
153
|
const
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
{ x: ax, y: ay, z: az } = this,
|
|
155
|
+
{ x: bx, y: by, z: bz } = vector;
|
|
156
156
|
|
|
157
157
|
this .x = ay * bz - az * by;
|
|
158
158
|
this .y = az * bx - ax * bz;
|
|
@@ -181,10 +181,7 @@ Vector3 .prototype =
|
|
|
181
181
|
},
|
|
182
182
|
norm: function ()
|
|
183
183
|
{
|
|
184
|
-
|
|
185
|
-
x = this .x,
|
|
186
|
-
y = this .y,
|
|
187
|
-
z = this .z;
|
|
184
|
+
const { x, y, z } = this;
|
|
188
185
|
|
|
189
186
|
return x * x +
|
|
190
187
|
y * y +
|
|
@@ -202,10 +199,7 @@ Vector3 .prototype =
|
|
|
202
199
|
},
|
|
203
200
|
lerp: function (destination, t)
|
|
204
201
|
{
|
|
205
|
-
const
|
|
206
|
-
x = this .x,
|
|
207
|
-
y = this .y,
|
|
208
|
-
z = this .z;
|
|
202
|
+
const { x, y, z } = this;
|
|
209
203
|
|
|
210
204
|
this .x = x + t * (destination .x - x);
|
|
211
205
|
this .y = y + t * (destination .y - y);
|
|
@@ -230,10 +224,7 @@ Vector3 .prototype =
|
|
|
230
224
|
},
|
|
231
225
|
min: function (vector)
|
|
232
226
|
{
|
|
233
|
-
let
|
|
234
|
-
x = this .x,
|
|
235
|
-
y = this .y,
|
|
236
|
-
z = this .z;
|
|
227
|
+
let { x, y, z } = this;
|
|
237
228
|
|
|
238
229
|
for (const vector of arguments)
|
|
239
230
|
{
|
|
@@ -249,10 +240,7 @@ Vector3 .prototype =
|
|
|
249
240
|
},
|
|
250
241
|
max: function (vector)
|
|
251
242
|
{
|
|
252
|
-
let
|
|
253
|
-
x = this .x,
|
|
254
|
-
y = this .y,
|
|
255
|
-
z = this .z;
|
|
243
|
+
let { x, y, z } = this;
|
|
256
244
|
|
|
257
245
|
for (const vector of arguments)
|
|
258
246
|
{
|
|
@@ -189,11 +189,7 @@ Vector4 .prototype =
|
|
|
189
189
|
},
|
|
190
190
|
norm: function ()
|
|
191
191
|
{
|
|
192
|
-
const
|
|
193
|
-
x = this .x,
|
|
194
|
-
y = this .y,
|
|
195
|
-
z = this .z,
|
|
196
|
-
w = this .w;
|
|
192
|
+
const { x, y, z, w } = this;
|
|
197
193
|
|
|
198
194
|
return x * x +
|
|
199
195
|
y * y +
|
|
@@ -213,11 +209,7 @@ Vector4 .prototype =
|
|
|
213
209
|
},
|
|
214
210
|
lerp: function (destination, t)
|
|
215
211
|
{
|
|
216
|
-
const
|
|
217
|
-
x = this .x,
|
|
218
|
-
y = this .y,
|
|
219
|
-
z = this .z,
|
|
220
|
-
w = this .w;
|
|
212
|
+
const { x, y, z, w } = this;
|
|
221
213
|
|
|
222
214
|
this .x = x + t * (destination .x - x);
|
|
223
215
|
this .y = y + t * (destination .y - y);
|
|
@@ -235,11 +227,7 @@ Vector4 .prototype =
|
|
|
235
227
|
},
|
|
236
228
|
min: function (vector)
|
|
237
229
|
{
|
|
238
|
-
let
|
|
239
|
-
x = this .x,
|
|
240
|
-
y = this .y,
|
|
241
|
-
z = this .z,
|
|
242
|
-
w = this .w;
|
|
230
|
+
let { x, y, z, w } = this;
|
|
243
231
|
|
|
244
232
|
for (const vector of arguments)
|
|
245
233
|
{
|
|
@@ -257,11 +245,7 @@ Vector4 .prototype =
|
|
|
257
245
|
},
|
|
258
246
|
max: function (vector)
|
|
259
247
|
{
|
|
260
|
-
let
|
|
261
|
-
x = this .x,
|
|
262
|
-
y = this .y,
|
|
263
|
-
z = this .z,
|
|
264
|
-
w = this .w;
|
|
248
|
+
let { x, y, z, w } = this;
|
|
265
249
|
|
|
266
250
|
for (const vector of arguments)
|
|
267
251
|
{
|
|
@@ -47,40 +47,35 @@
|
|
|
47
47
|
|
|
48
48
|
class StopWatch
|
|
49
49
|
{
|
|
50
|
-
startTime = 0;
|
|
51
|
-
stopTime = 0;
|
|
50
|
+
#startTime = 0;
|
|
51
|
+
#stopTime = 0;
|
|
52
52
|
cycles = 0;
|
|
53
53
|
elapsedTime = 0;
|
|
54
54
|
|
|
55
55
|
start ()
|
|
56
56
|
{
|
|
57
|
-
this
|
|
57
|
+
this .#startTime = Date .now ();
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
stop ()
|
|
61
61
|
{
|
|
62
|
-
if (this
|
|
62
|
+
if (this .#startTime <= this .#stopTime)
|
|
63
63
|
return;
|
|
64
64
|
|
|
65
|
-
this
|
|
65
|
+
this .#stopTime = Date .now ();
|
|
66
66
|
this .cycles += 1;
|
|
67
|
-
this .elapsedTime += this
|
|
67
|
+
this .elapsedTime += this .#stopTime - this .#startTime;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
reset ()
|
|
71
71
|
{
|
|
72
|
-
this
|
|
73
|
-
this
|
|
72
|
+
this .#startTime = 0;
|
|
73
|
+
this .#stopTime = 0;
|
|
74
74
|
this .cycles = 0;
|
|
75
75
|
this .elapsedTime = 0;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
return this .elapsedTime ? this .cycles / this .elapsedTime : 0;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
averageTime ()
|
|
78
|
+
get averageTime ()
|
|
84
79
|
{
|
|
85
80
|
return this .cycles ? this .elapsedTime / this .cycles : 0;
|
|
86
81
|
}
|
package/src/tests.js
CHANGED
|
@@ -103,9 +103,20 @@ const X_ITE_TESTS = [
|
|
|
103
103
|
{ component: "HAnim" },
|
|
104
104
|
{ path: "HAnim/BoxManC.x3d" },
|
|
105
105
|
{ component: "Interpolation" },
|
|
106
|
+
{ path: "Interpolation/ComposeSFVec3f.wrl" },
|
|
107
|
+
{ path: "Interpolation/Cube.wrl" },
|
|
108
|
+
{ path: "Interpolation/EaseInEaseOut.wrl" },
|
|
109
|
+
{ path: "Interpolation/Interpolators.wrl" },
|
|
110
|
+
{ path: "Interpolation/LineTrail.wrl" },
|
|
106
111
|
{ path: "Interpolation/NormalInterpolator.x3d" },
|
|
107
112
|
{ path: "Interpolation/OrientationInterpolator.x3d" },
|
|
113
|
+
{ path: "Interpolation/ParticleShape.wrl" },
|
|
108
114
|
{ path: "Interpolation/PositionInterpolator.x3d" },
|
|
115
|
+
{ path: "Interpolation/SplinePositionInterpolator.wrl" },
|
|
116
|
+
{ path: "Interpolation/SplinePositionInterpolator2.wrl" },
|
|
117
|
+
{ path: "Interpolation/SplineScalarInterpolator.wrl" },
|
|
118
|
+
{ path: "Interpolation/SquadOrientationInterpolator.wrl" },
|
|
119
|
+
{ path: "Interpolation/warp.wrl" },
|
|
109
120
|
{ component: "Layering" },
|
|
110
121
|
{ path: "Layering/LayerSet.x3d" },
|
|
111
122
|
{ path: "Layering/Rotor.x3d" },
|