x_ite 8.7.3 → 8.7.5
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/tasks.json +1 -1
- package/build/bin/bump.pl +2 -0
- 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 +36 -31
- 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 +22 -22
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +20 -20
- 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 +24 -24
- 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 +31 -31
- 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 +1297 -1436
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +1 -1
- package/docs/_posts/reference/field-services-and-objects.md +27 -7
- package/package.json +2 -2
- package/src/standard/Math/Algorithms/eigen_decomposition.js +9 -9
- package/src/standard/Math/Geometry/Box2.js +20 -20
- package/src/standard/Math/Geometry/Box3.js +20 -20
- package/src/standard/Math/Numbers/Color3.js +10 -18
- package/src/standard/Math/Numbers/Color4.js +12 -23
- package/src/standard/Math/Numbers/Complex.js +59 -54
- package/src/standard/Math/Numbers/Matrix2.js +31 -45
- package/src/standard/Math/Numbers/Matrix3.js +59 -94
- package/src/standard/Math/Numbers/Matrix4.js +73 -114
- package/src/standard/Math/Numbers/Quaternion.js +49 -65
- package/src/standard/Math/Numbers/Rotation4.js +15 -13
- package/src/standard/Math/Numbers/Vector2.js +12 -14
- package/src/standard/Math/Numbers/Vector3.js +17 -22
- package/src/standard/Math/Numbers/Vector4.js +22 -30
- package/src/x_ite/Base/FieldArray.js +3 -2
- package/src/x_ite/Base/FieldDefinitionArray.js +3 -2
- package/src/x_ite/Base/X3DArrayField.js +27 -3
- package/src/x_ite/Base/X3DInfoArray.js +73 -14
- package/src/x_ite/Base/X3DObject.js +5 -0
- package/src/x_ite/Browser/Core/X3DCoreContext.js +3 -3
- package/src/x_ite/Browser/Layout/ScreenText.js +9 -4
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +60 -67
- package/src/x_ite/Browser/X3DBrowserContext.js +8 -8
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +4 -4
- package/src/x_ite/Components/Layering/X3DLayerNode.js +1 -1
- package/src/x_ite/Components/Navigation/X3DViewpointNode.js +2 -3
- package/src/x_ite/Components/Picking/X3DPickSensorNode.js +2 -2
- package/src/x_ite/Configuration/ComponentInfoArray.js +2 -2
- package/src/x_ite/Configuration/ProfileInfoArray.js +2 -2
- package/src/x_ite/Configuration/UnitInfoArray.js +15 -1
- package/src/x_ite/Execution/BindableList.js +1 -1
- package/src/x_ite/Execution/ExportedNodesArray.js +4 -3
- package/src/x_ite/Execution/ImportedNodesArray.js +4 -3
- package/src/x_ite/Execution/NamedNodesArray.js +16 -2
- package/src/x_ite/Execution/X3DExecutionContext.js +52 -58
- package/src/x_ite/Execution/X3DExportedNode.js +13 -11
- package/src/x_ite/Execution/X3DImportedNode.js +25 -25
- package/src/x_ite/Execution/X3DScene.js +130 -54
- package/src/x_ite/Fields/SFColor.js +10 -15
- package/src/x_ite/Fields/SFColorRGBA.js +11 -18
- package/src/x_ite/Fields/SFImage.js +38 -33
- package/src/x_ite/Fields/SFMatrix3.js +1 -3
- package/src/x_ite/Fields/SFMatrix4.js +1 -5
- package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +6 -5
- package/src/x_ite/Fields/SFNode.js +1 -1
- package/src/x_ite/Fields/SFRotation.js +14 -21
- package/src/x_ite/Fields/SFString.js +0 -1
- package/src/x_ite/Fields/SFVec2.js +8 -15
- package/src/x_ite/Fields/SFVec3.js +10 -17
- package/src/x_ite/Fields/SFVec4.js +12 -23
- package/src/x_ite/Fields/SFVecPrototypeTemplate.js +15 -14
- package/src/x_ite/InputOutput/FileLoader.js +2 -2
- package/src/x_ite/Parser/SVGParser.js +2 -2
- package/src/x_ite/Parser/X3DOptimizer.js +1 -1
- package/src/x_ite/Parser/XMLParser.js +18 -18
- package/src/x_ite/Prototype/ExternProtoDeclarationArray.js +3 -2
- package/src/x_ite/Prototype/ProtoDeclarationArray.js +4 -3
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +26 -27
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +16 -15
- package/src/x_ite/Routing/RouteArray.js +3 -2
- package/src/x_ite/Routing/X3DRoute.js +26 -25
- package/src/x_ite/Execution/Scene.js +0 -145
|
@@ -66,13 +66,9 @@ function Matrix3 ()
|
|
|
66
66
|
Matrix3 .prototype =
|
|
67
67
|
{
|
|
68
68
|
constructor: Matrix3,
|
|
69
|
-
order: 3,
|
|
70
|
-
length: 9,
|
|
71
69
|
[Symbol .iterator]: function* ()
|
|
72
70
|
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
for (let i = 0; i < length; ++ i)
|
|
71
|
+
for (let i = 0; i < 9; ++ i)
|
|
76
72
|
yield this [i];
|
|
77
73
|
},
|
|
78
74
|
copy: function ()
|
|
@@ -105,7 +101,7 @@ Matrix3 .prototype =
|
|
|
105
101
|
},
|
|
106
102
|
rotation: function ()
|
|
107
103
|
{
|
|
108
|
-
return
|
|
104
|
+
return Math .atan2 (this [1], this [0]);
|
|
109
105
|
},
|
|
110
106
|
set1: function (r, c, value)
|
|
111
107
|
{
|
|
@@ -578,93 +574,78 @@ Matrix3 .prototype =
|
|
|
578
574
|
},
|
|
579
575
|
};
|
|
580
576
|
|
|
581
|
-
Object .
|
|
577
|
+
Object .defineProperties (Matrix3 .prototype,
|
|
582
578
|
{
|
|
583
|
-
|
|
579
|
+
order: { value: 3 },
|
|
580
|
+
length: { value: 9 },
|
|
581
|
+
x:
|
|
584
582
|
{
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
})(),
|
|
589
|
-
enumerable: false,
|
|
590
|
-
configurable: false
|
|
591
|
-
});
|
|
583
|
+
get: (function ()
|
|
584
|
+
{
|
|
585
|
+
const vector = new Vector3 (0, 0, 0);
|
|
592
586
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
587
|
+
return function () { return vector .set (this [0], this [1], this [2]); };
|
|
588
|
+
})(),
|
|
589
|
+
},
|
|
590
|
+
y:
|
|
596
591
|
{
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
})(),
|
|
601
|
-
enumerable: false,
|
|
602
|
-
configurable: false
|
|
603
|
-
});
|
|
592
|
+
get: (function ()
|
|
593
|
+
{
|
|
594
|
+
const vector = new Vector3 (0, 0, 0);
|
|
604
595
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
596
|
+
return function () { return vector .set (this [3], this [4], this [5]); };
|
|
597
|
+
})(),
|
|
598
|
+
},
|
|
599
|
+
z:
|
|
608
600
|
{
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
})(),
|
|
613
|
-
enumerable: false,
|
|
614
|
-
configurable: false
|
|
615
|
-
});
|
|
601
|
+
get: (function ()
|
|
602
|
+
{
|
|
603
|
+
const vector = new Vector3 (0, 0, 0);
|
|
616
604
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
605
|
+
return function () { return vector .set (this [6], this [7], this [8]); };
|
|
606
|
+
})(),
|
|
607
|
+
},
|
|
608
|
+
xAxis:
|
|
620
609
|
{
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
})(),
|
|
625
|
-
enumerable: false,
|
|
626
|
-
configurable: false
|
|
627
|
-
});
|
|
610
|
+
get: (function ()
|
|
611
|
+
{
|
|
612
|
+
const vector = new Vector2 (0, 0);
|
|
628
613
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
614
|
+
return function () { return vector .set (this [0], this [1]); };
|
|
615
|
+
})(),
|
|
616
|
+
},
|
|
617
|
+
yAxis:
|
|
632
618
|
{
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
})(),
|
|
637
|
-
enumerable: false,
|
|
638
|
-
configurable: false
|
|
639
|
-
});
|
|
619
|
+
get: (function ()
|
|
620
|
+
{
|
|
621
|
+
const vector = new Vector2 (0, 0);
|
|
640
622
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
623
|
+
return function () { return vector .set (this [3], this [4]); };
|
|
624
|
+
})(),
|
|
625
|
+
},
|
|
626
|
+
origin:
|
|
644
627
|
{
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
})(),
|
|
649
|
-
enumerable: false,
|
|
650
|
-
configurable: false
|
|
651
|
-
});
|
|
628
|
+
get: (function ()
|
|
629
|
+
{
|
|
630
|
+
const vector = new Vector2 (0, 0);
|
|
652
631
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
632
|
+
return function () { return vector .set (this [6], this [7]); };
|
|
633
|
+
})(),
|
|
634
|
+
},
|
|
635
|
+
submatrix:
|
|
656
636
|
{
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
return function ()
|
|
637
|
+
get: (function ()
|
|
660
638
|
{
|
|
661
|
-
matrix
|
|
662
|
-
|
|
663
|
-
return
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
639
|
+
const matrix = new Matrix2 ();
|
|
640
|
+
|
|
641
|
+
return function ()
|
|
642
|
+
{
|
|
643
|
+
matrix [0] = this [0]; matrix [1] = this [1];
|
|
644
|
+
matrix [2] = this [3]; matrix [3] = this [4];
|
|
645
|
+
return matrix;
|
|
646
|
+
};
|
|
647
|
+
})(),
|
|
648
|
+
},
|
|
668
649
|
});
|
|
669
650
|
|
|
670
651
|
Object .assign (Matrix3,
|
|
@@ -686,22 +667,6 @@ Object .assign (Matrix3,
|
|
|
686
667
|
matrix [2], matrix [3], 0,
|
|
687
668
|
0, 0, 1);
|
|
688
669
|
},
|
|
689
|
-
transpose: function (matrix)
|
|
690
|
-
{
|
|
691
|
-
return matrix .copy () .transpose ();
|
|
692
|
-
},
|
|
693
|
-
inverse: function (matrix)
|
|
694
|
-
{
|
|
695
|
-
return matrix .copy () .inverse ();
|
|
696
|
-
},
|
|
697
|
-
multLeft: function (lhs, rhs)
|
|
698
|
-
{
|
|
699
|
-
return lhs .copy () .multLeft (rhs);
|
|
700
|
-
},
|
|
701
|
-
multRight: function (lhs, rhs)
|
|
702
|
-
{
|
|
703
|
-
return lhs .copy () .multRight (rhs);
|
|
704
|
-
},
|
|
705
670
|
});
|
|
706
671
|
|
|
707
672
|
const m = new Matrix3 ();
|
|
@@ -68,13 +68,9 @@ function Matrix4 ()
|
|
|
68
68
|
Matrix4 .prototype =
|
|
69
69
|
{
|
|
70
70
|
constructor: Matrix4,
|
|
71
|
-
order: 4,
|
|
72
|
-
length: 16,
|
|
73
71
|
[Symbol .iterator]: function* ()
|
|
74
72
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
for (let i = 0; i < length; ++ i)
|
|
73
|
+
for (let i = 0; i < 16; ++ i)
|
|
78
74
|
yield this [i];
|
|
79
75
|
},
|
|
80
76
|
copy: function ()
|
|
@@ -672,118 +668,97 @@ Matrix4 .prototype =
|
|
|
672
668
|
},
|
|
673
669
|
};
|
|
674
670
|
|
|
675
|
-
Object .
|
|
671
|
+
Object .defineProperties (Matrix4 .prototype,
|
|
676
672
|
{
|
|
677
|
-
|
|
673
|
+
order: { value: 4 },
|
|
674
|
+
length: { value: 16 },
|
|
675
|
+
x:
|
|
678
676
|
{
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
})(),
|
|
683
|
-
enumerable: false,
|
|
684
|
-
configurable: false
|
|
685
|
-
});
|
|
677
|
+
get: (function ()
|
|
678
|
+
{
|
|
679
|
+
const vector = new Vector4 (0, 0, 0, 0);
|
|
686
680
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
681
|
+
return function () { return vector .set (this [0], this [1], this [2], this [3]); };
|
|
682
|
+
})(),
|
|
683
|
+
},
|
|
684
|
+
y:
|
|
690
685
|
{
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
})(),
|
|
695
|
-
enumerable: false,
|
|
696
|
-
configurable: false
|
|
697
|
-
});
|
|
686
|
+
get: (function ()
|
|
687
|
+
{
|
|
688
|
+
const vector = new Vector4 (0, 0, 0, 0);
|
|
698
689
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
690
|
+
return function () { return vector .set (this [4], this [5], this [6], this [7]); };
|
|
691
|
+
})(),
|
|
692
|
+
},
|
|
693
|
+
z:
|
|
702
694
|
{
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
})(),
|
|
707
|
-
enumerable: false,
|
|
708
|
-
configurable: false
|
|
709
|
-
});
|
|
695
|
+
get: (function ()
|
|
696
|
+
{
|
|
697
|
+
const vector = new Vector4 (0, 0, 0, 0);
|
|
710
698
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
699
|
+
return function () { return vector .set (this [8], this [9], this [10], this [11]); };
|
|
700
|
+
})(),
|
|
701
|
+
},
|
|
702
|
+
w:
|
|
714
703
|
{
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
})(),
|
|
719
|
-
enumerable: false,
|
|
720
|
-
configurable: false
|
|
721
|
-
});
|
|
704
|
+
get: (function ()
|
|
705
|
+
{
|
|
706
|
+
const vector = new Vector4 (0, 0, 0, 0);
|
|
722
707
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
708
|
+
return function () { return vector .set (this [12], this [13], this [14], this [15]); };
|
|
709
|
+
})(),
|
|
710
|
+
},
|
|
711
|
+
xAxis:
|
|
726
712
|
{
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
})(),
|
|
731
|
-
enumerable: false,
|
|
732
|
-
configurable: false
|
|
733
|
-
});
|
|
713
|
+
get: (function ()
|
|
714
|
+
{
|
|
715
|
+
const vector = new Vector3 (0, 0, 0);
|
|
734
716
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
717
|
+
return function () { return vector .set (this [0], this [1], this [2]); };
|
|
718
|
+
})(),
|
|
719
|
+
},
|
|
720
|
+
yAxis:
|
|
738
721
|
{
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
})(),
|
|
743
|
-
enumerable: false,
|
|
744
|
-
configurable: false
|
|
745
|
-
});
|
|
722
|
+
get: (function ()
|
|
723
|
+
{
|
|
724
|
+
const vector = new Vector3 (0, 0, 0);
|
|
746
725
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
726
|
+
return function () { return vector .set (this [4], this [5], this [6]); };
|
|
727
|
+
})(),
|
|
728
|
+
},
|
|
729
|
+
zAxis:
|
|
750
730
|
{
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
})(),
|
|
755
|
-
enumerable: false,
|
|
756
|
-
configurable: false
|
|
757
|
-
});
|
|
731
|
+
get: (function ()
|
|
732
|
+
{
|
|
733
|
+
const vector = new Vector3 (0, 0, 0);
|
|
758
734
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
735
|
+
return function () { return vector .set (this [8], this [9], this [10]); };
|
|
736
|
+
})(),
|
|
737
|
+
},
|
|
738
|
+
origin:
|
|
762
739
|
{
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
})(),
|
|
767
|
-
enumerable: false,
|
|
768
|
-
configurable: false
|
|
769
|
-
});
|
|
740
|
+
get: (function ()
|
|
741
|
+
{
|
|
742
|
+
const vector = new Vector3 (0, 0, 0);
|
|
770
743
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
744
|
+
return function () { return vector .set (this [12], this [13], this [14]); };
|
|
745
|
+
})(),
|
|
746
|
+
},
|
|
747
|
+
submatrix:
|
|
774
748
|
{
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
return function ()
|
|
749
|
+
get: (function ()
|
|
778
750
|
{
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
751
|
+
const matrix = new Matrix3 ();
|
|
752
|
+
|
|
753
|
+
return function ()
|
|
754
|
+
{
|
|
755
|
+
matrix [0] = this [0]; matrix [1] = this [1]; matrix [2] = this [ 2];
|
|
756
|
+
matrix [3] = this [4]; matrix [4] = this [5]; matrix [5] = this [ 6];
|
|
757
|
+
matrix [6] = this [8]; matrix [7] = this [9]; matrix [8] = this [10];
|
|
758
|
+
return matrix;
|
|
759
|
+
};
|
|
760
|
+
})(),
|
|
761
|
+
},
|
|
787
762
|
});
|
|
788
763
|
|
|
789
764
|
Object .assign (Matrix4,
|
|
@@ -811,22 +786,6 @@ Object .assign (Matrix4,
|
|
|
811
786
|
matrix [6], matrix [7], matrix [8], 0,
|
|
812
787
|
0, 0, 0, 1);
|
|
813
788
|
},
|
|
814
|
-
transpose: function (matrix)
|
|
815
|
-
{
|
|
816
|
-
return matrix .copy () .transpose ();
|
|
817
|
-
},
|
|
818
|
-
inverse: function (matrix)
|
|
819
|
-
{
|
|
820
|
-
return matrix .copy () .inverse ();
|
|
821
|
-
},
|
|
822
|
-
multLeft: function (lhs, rhs)
|
|
823
|
-
{
|
|
824
|
-
return lhs .copy () .multLeft (rhs);
|
|
825
|
-
},
|
|
826
|
-
multRight: function (lhs, rhs)
|
|
827
|
-
{
|
|
828
|
-
return lhs .copy () .multRight (rhs);
|
|
829
|
-
},
|
|
830
789
|
});
|
|
831
790
|
|
|
832
791
|
const
|
|
@@ -60,7 +60,6 @@ function Quaternion (x, y, z, w)
|
|
|
60
60
|
Quaternion .prototype =
|
|
61
61
|
{
|
|
62
62
|
constructor: Quaternion,
|
|
63
|
-
length: 4,
|
|
64
63
|
[Symbol .iterator]: function* ()
|
|
65
64
|
{
|
|
66
65
|
yield this .x;
|
|
@@ -95,24 +94,22 @@ Quaternion .prototype =
|
|
|
95
94
|
},
|
|
96
95
|
setMatrix: function (matrix)
|
|
97
96
|
{
|
|
98
|
-
let i;
|
|
99
|
-
|
|
100
97
|
// First, find largest diagonal in matrix:
|
|
101
98
|
if (matrix [0] > matrix [4])
|
|
102
99
|
{
|
|
103
|
-
i = matrix [0] > matrix [8] ? 0 : 2;
|
|
100
|
+
var i = matrix [0] > matrix [8] ? 0 : 2;
|
|
104
101
|
}
|
|
105
102
|
else
|
|
106
103
|
{
|
|
107
|
-
i = matrix [4] > matrix [8] ? 1 : 2;
|
|
104
|
+
var i = matrix [4] > matrix [8] ? 1 : 2;
|
|
108
105
|
}
|
|
109
106
|
|
|
110
|
-
const
|
|
107
|
+
const scaleRow = matrix [0] + matrix [4] + matrix [8];
|
|
111
108
|
|
|
112
|
-
if (
|
|
109
|
+
if (scaleRow > matrix [i * 3 + i])
|
|
113
110
|
{
|
|
114
111
|
// Compute w first:
|
|
115
|
-
this [3] = Math .sqrt (
|
|
112
|
+
this [3] = Math .sqrt (scaleRow + 1) / 2;
|
|
116
113
|
|
|
117
114
|
// And compute other values:
|
|
118
115
|
const d = 4 * this [3];
|
|
@@ -260,9 +257,9 @@ Quaternion .prototype =
|
|
|
260
257
|
const
|
|
261
258
|
{ x: qx, y: qy, z: qz, w: qw } = this,
|
|
262
259
|
{ x: vx, y: vy, z: vz } = vector,
|
|
263
|
-
a
|
|
264
|
-
b
|
|
265
|
-
c
|
|
260
|
+
a = qw * qw - qx * qx - qy * qy - qz * qz,
|
|
261
|
+
b = 2 * (vx * qx + vy * qy + vz * qz),
|
|
262
|
+
c = 2 * qw;
|
|
266
263
|
|
|
267
264
|
vector .x = a * vx + b * qx + c * (qy * vz - qz * vy);
|
|
268
265
|
vector .y = a * vy + b * qy + c * (qz * vx - qx * vz);
|
|
@@ -275,9 +272,9 @@ Quaternion .prototype =
|
|
|
275
272
|
const
|
|
276
273
|
{ x: qx, y: qy, z: qz, w: qw } = this,
|
|
277
274
|
{ x: vx, y: vy, z: vz } = vector,
|
|
278
|
-
a
|
|
279
|
-
b
|
|
280
|
-
c
|
|
275
|
+
a = qw * qw - qx * qx - qy * qy - qz * qz,
|
|
276
|
+
b = 2 * (vx * qx + vy * qy + vz * qz),
|
|
277
|
+
c = 2 * qw;
|
|
281
278
|
|
|
282
279
|
vector .x = a * vx + b * qx - c * (qy * vz - qz * vy);
|
|
283
280
|
vector .y = a * vy + b * qy - c * (qz * vx - qx * vz);
|
|
@@ -402,60 +399,47 @@ Quaternion .prototype =
|
|
|
402
399
|
},
|
|
403
400
|
};
|
|
404
401
|
|
|
405
|
-
Object .
|
|
406
|
-
{
|
|
407
|
-
get: function () { return this .x; },
|
|
408
|
-
set: function (value) { this .x = value; },
|
|
409
|
-
enumerable: false,
|
|
410
|
-
configurable: false
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
Object .defineProperty (Quaternion .prototype, "1",
|
|
402
|
+
Object .defineProperties (Quaternion .prototype,
|
|
414
403
|
{
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
enumerable: false,
|
|
418
|
-
configurable: false
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
Object .defineProperty (Quaternion .prototype, "2",
|
|
422
|
-
{
|
|
423
|
-
get: function () { return this .z; },
|
|
424
|
-
set: function (value) { this .z = value; },
|
|
425
|
-
enumerable: false,
|
|
426
|
-
configurable: false
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
Object .defineProperty (Quaternion .prototype, "3",
|
|
430
|
-
{
|
|
431
|
-
get: function () { return this .w; },
|
|
432
|
-
set: function (value) { this .w = value; },
|
|
433
|
-
enumerable: false,
|
|
434
|
-
configurable: false
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
Object .defineProperty (Quaternion .prototype, "real",
|
|
438
|
-
{
|
|
439
|
-
get: function () { return this .w; },
|
|
440
|
-
enumerable: false,
|
|
441
|
-
configurable: false
|
|
442
|
-
});
|
|
443
|
-
|
|
444
|
-
Object .defineProperty (Quaternion .prototype, "imag",
|
|
445
|
-
{
|
|
446
|
-
get: (function ()
|
|
404
|
+
length: { value: 4 },
|
|
405
|
+
0:
|
|
447
406
|
{
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
407
|
+
get: function () { return this .x; },
|
|
408
|
+
set: function (value) { this .x = value; },
|
|
409
|
+
},
|
|
410
|
+
1:
|
|
411
|
+
{
|
|
412
|
+
get: function () { return this .y; },
|
|
413
|
+
set: function (value) { this .y = value; },
|
|
414
|
+
},
|
|
415
|
+
2:
|
|
416
|
+
{
|
|
417
|
+
get: function () { return this .z; },
|
|
418
|
+
set: function (value) { this .z = value; },
|
|
419
|
+
},
|
|
420
|
+
3:
|
|
421
|
+
{
|
|
422
|
+
get: function () { return this .w; },
|
|
423
|
+
set: function (value) { this .w = value; },
|
|
424
|
+
},
|
|
425
|
+
real:
|
|
426
|
+
{
|
|
427
|
+
get: function () { return this .w; },
|
|
428
|
+
},
|
|
429
|
+
imag:
|
|
430
|
+
{
|
|
431
|
+
get: (function ()
|
|
451
432
|
{
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
433
|
+
const result = new Vector3 (0, 0, 0);
|
|
434
|
+
|
|
435
|
+
return function ()
|
|
436
|
+
{
|
|
437
|
+
return result .set (this .x,
|
|
438
|
+
this .y,
|
|
439
|
+
this .z);
|
|
440
|
+
};
|
|
441
|
+
})(),
|
|
442
|
+
},
|
|
459
443
|
});
|
|
460
444
|
|
|
461
445
|
Object .assign (Quaternion,
|
|
@@ -108,7 +108,6 @@ function Rotation4 (x, y, z, angle)
|
|
|
108
108
|
Rotation4 .prototype =
|
|
109
109
|
{
|
|
110
110
|
constructor: Rotation4,
|
|
111
|
-
length: 4,
|
|
112
111
|
[Symbol .iterator]: function* ()
|
|
113
112
|
{
|
|
114
113
|
yield this [_x];
|
|
@@ -379,7 +378,6 @@ const x = {
|
|
|
379
378
|
this .set (x, this [_y], this [_z], this [_angle]);
|
|
380
379
|
},
|
|
381
380
|
enumerable: true,
|
|
382
|
-
configurable: false
|
|
383
381
|
};
|
|
384
382
|
|
|
385
383
|
const y = {
|
|
@@ -393,7 +391,6 @@ const y = {
|
|
|
393
391
|
this .set (this [_x], y, this [_z], this [_angle]);
|
|
394
392
|
},
|
|
395
393
|
enumerable: true,
|
|
396
|
-
configurable: false
|
|
397
394
|
};
|
|
398
395
|
|
|
399
396
|
const z = {
|
|
@@ -407,7 +404,6 @@ const z = {
|
|
|
407
404
|
this .set (this [_x], this [_y], z, this [_angle]);
|
|
408
405
|
},
|
|
409
406
|
enumerable: true,
|
|
410
|
-
configurable: false
|
|
411
407
|
};
|
|
412
408
|
|
|
413
409
|
const angle = {
|
|
@@ -421,23 +417,29 @@ const angle = {
|
|
|
421
417
|
this .set (this [_x], this [_y], this [_z], angle);
|
|
422
418
|
},
|
|
423
419
|
enumerable: true,
|
|
424
|
-
configurable: false
|
|
425
420
|
};
|
|
426
421
|
|
|
427
|
-
Object .
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
422
|
+
Object .defineProperties (Rotation4 .prototype,
|
|
423
|
+
{
|
|
424
|
+
length: { value: 4 },
|
|
425
|
+
x: x,
|
|
426
|
+
y: y,
|
|
427
|
+
z: z,
|
|
428
|
+
angle: angle,
|
|
429
|
+
});
|
|
431
430
|
|
|
432
431
|
x .enumerable = false;
|
|
433
432
|
y .enumerable = false;
|
|
434
433
|
z .enumerable = false;
|
|
435
434
|
angle .enumerable = false;
|
|
436
435
|
|
|
437
|
-
Object .
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
436
|
+
Object .defineProperties (Rotation4 .prototype,
|
|
437
|
+
{
|
|
438
|
+
0: x,
|
|
439
|
+
1: y,
|
|
440
|
+
2: z,
|
|
441
|
+
3: angle,
|
|
442
|
+
});
|
|
441
443
|
|
|
442
444
|
Object .assign (Rotation4,
|
|
443
445
|
{
|