x_ite 8.6.15 → 8.6.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/docs/_posts/getting-started.md +3 -2
- package/package.json +2 -2
- package/.gitmodules +0 -6
- package/docs/assets/lib/.editorconfig +0 -11
- package/docs/assets/lib/.gitignore +0 -4
- package/docs/assets/lib/LICENSE +0 -21
- package/docs/assets/lib/README.md +0 -50
- package/docs/assets/lib/bootstrap-4.6.1/bootstrap.bundle.min.js +0 -7
- package/docs/assets/lib/bootstrap-4.6.1/bootstrap.bundle.min.js.map +0 -1
- package/docs/assets/lib/bootstrap-4.6.1/bootstrap.min.css +0 -7
- package/docs/assets/lib/bootstrap-4.6.1/bootstrap.min.css.map +0 -1
- package/docs/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css +0 -4
- package/docs/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js +0 -5
- package/docs/assets/lib/clipboard-2.0.9/clipboard.min.js +0 -7
- package/docs/assets/lib/countup.js-1.9.3/countUp.min.js +0 -1
- package/docs/assets/lib/dayjs-1.10.7/dayjs.min.js +0 -1
- package/docs/assets/lib/dayjs-1.10.7/locale/en.min.js +0 -7
- package/docs/assets/lib/dayjs-1.10.7/plugin/localizedFormat.min.js +0 -5
- package/docs/assets/lib/dayjs-1.10.7/plugin/relativeTime.min.js +0 -5
- package/docs/assets/lib/fontawesome-free-6.2.1/LICENSE.txt +0 -165
- package/docs/assets/lib/fontawesome-free-6.2.1/css/all.min.css +0 -6
- package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-brands-400.ttf +0 -0
- package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-brands-400.woff2 +0 -0
- package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-regular-400.ttf +0 -0
- package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-regular-400.woff2 +0 -0
- package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-solid-900.ttf +0 -0
- package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-solid-900.woff2 +0 -0
- package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-v4compatibility.ttf +0 -0
- package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-v4compatibility.woff2 +0 -0
- package/docs/assets/lib/fonts/Lato/Lato-Regular.ttf +0 -0
- package/docs/assets/lib/fonts/Lato/OFL.txt +0 -93
- package/docs/assets/lib/fonts/Source_Sans_Pro/OFL.txt +0 -93
- package/docs/assets/lib/fonts/Source_Sans_Pro/SourceSansPro-Black.ttf +0 -0
- package/docs/assets/lib/fonts/Source_Sans_Pro/SourceSansPro-Bold.ttf +0 -0
- package/docs/assets/lib/fonts/Source_Sans_Pro/SourceSansPro-Regular.ttf +0 -0
- package/docs/assets/lib/fonts/Source_Sans_Pro/SourceSansPro-SemiBold.ttf +0 -0
- package/docs/assets/lib/fonts/main.css +0 -1
- package/docs/assets/lib/jquery-3.6.0/jquery.min.js +0 -2
- package/docs/assets/lib/lozad-1.16.0/lozad.min.js +0 -10
- package/docs/assets/lib/magnific-popup-1.1.0/jquery.magnific-popup.min.js +0 -4
- package/docs/assets/lib/magnific-popup-1.1.0/magnific-popup.css +0 -2
- package/docs/assets/lib/mathjax-3.2.0/a11y/assistive-mml.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/a11y/complexity.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/a11y/explorer.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/a11y/semantic-enrich.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/adaptors/liteDOM.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/core.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/asciimath.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/mml/entities.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/mml/extensions/mml3.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/mml/extensions/mml3.sef.json +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/mml.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/action.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/all-packages.js +0 -34
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/ams.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/amscd.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/autoload.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/bbox.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/boldsymbol.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/braket.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/bussproofs.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/cancel.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/centernot.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/color.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/colortbl.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/colorv2.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/configmacros.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/enclose.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/extpfeil.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/gensymb.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/html.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/mathtools.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/mhchem.js +0 -34
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/newcommand.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/noerrors.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/noundefined.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/physics.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/require.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/setoptions.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/tagformat.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/textcomp.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/textmacros.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/unicode.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/upgreek.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/verb.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex-base.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/input/tex-full.js +0 -34
- package/docs/assets/lib/mathjax-3.2.0/input/tex.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/latest.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/loader.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/mml-chtml.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/mml-svg.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/node-main.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/tex.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
- package/docs/assets/lib/mathjax-3.2.0/output/chtml.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/output/svg/fonts/tex.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/output/svg.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/de.js +0 -125
- package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/en.js +0 -131
- package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/es.js +0 -122
- package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/fr.js +0 -125
- package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/hi.js +0 -125
- package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/it.js +0 -125
- package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/nemeth.js +0 -113
- package/docs/assets/lib/mathjax-3.2.0/sre/sre-node.js +0 -11
- package/docs/assets/lib/mathjax-3.2.0/sre/sre_browser.js +0 -999
- package/docs/assets/lib/mathjax-3.2.0/startup.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/tex-chtml-full.js +0 -34
- package/docs/assets/lib/mathjax-3.2.0/tex-chtml.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/tex-mml-chtml.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/tex-mml-svg.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/tex-svg-full.js +0 -34
- package/docs/assets/lib/mathjax-3.2.0/tex-svg.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/ui/lazy.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/ui/menu.js +0 -1
- package/docs/assets/lib/mathjax-3.2.0/ui/safe.js +0 -1
- package/docs/assets/lib/mermaid-9.1.7/mermaid.min.js +0 -3
- package/docs/assets/lib/mermaid-9.1.7/mermaid.min.js.map +0 -1
- package/docs/assets/lib/polyfill-v3-es6/polyfill.min.js +0 -100
- package/docs/assets/lib/simple-jekyll-search-1.10.0/simple-jekyll-search.min.js +0 -6
- package/tests/.vscode/settings.json +0 -7
- package/tests/README.md +0 -2
- package/tests/package.json +0 -25
- package/tests/tests/X3D.js +0 -16
- package/tests/tests/X_ITE.test.js +0 -6
- package/tests/tests/standard/Math/Algorithm.test.js +0 -85
- package/tests/tests/standard/Math/Numbers/Color3.test.js +0 -162
- package/tests/tests/standard/Math/Numbers/Color4.test.js +0 -186
- package/tests/tests/standard/Math/Numbers/Complex.test.js +0 -199
- package/tests/tests/standard/Math/Numbers/Matrix2.test.js +0 -248
- package/tests/tests/standard/Math/Numbers/Matrix3.test.js +0 -585
- package/tests/tests/standard/Math/Numbers/Matrix4.test.js +0 -663
- package/tests/tests/standard/Math/Numbers/Rotation4.test.js +0 -197
- package/tests/tests/standard/Math/Numbers/Vector2.test.js +0 -259
- package/tests/tests/standard/Math/Numbers/Vector3.test.js +0 -291
- package/tests/tests/standard/Math/Numbers/Vector4.test.js +0 -309
- package/tests/tests/x_ite/Fields/SFDouble.test.js +0 -47
- package/tests/tests/x_ite/Fields/SFFloat.test.js +0 -47
- package/tests/tests/x_ite/Fields/SFInt32.test.js +0 -47
- package/tests/tests/x_ite/Fields/SFString.test.js +0 -47
- package/tests/tests/x_ite/Fields/SFTime.test.js +0 -47
|
@@ -1,663 +0,0 @@
|
|
|
1
|
-
const
|
|
2
|
-
X3D = require ("../../../X3D"),
|
|
3
|
-
Matrix4 = X3D .require ("standard/Math/Numbers/Matrix4"),
|
|
4
|
-
Vector3 = X3D .require ("standard/Math/Numbers/Vector3"),
|
|
5
|
-
Vector4 = X3D .require ("standard/Math/Numbers/Vector4"),
|
|
6
|
-
Rotation4 = X3D .require ("standard/Math/Numbers/Rotation4")
|
|
7
|
-
|
|
8
|
-
test ("constructor", () =>
|
|
9
|
-
{
|
|
10
|
-
const m1 = new Matrix4 ()
|
|
11
|
-
|
|
12
|
-
expect (m1) .toEqual ({
|
|
13
|
-
0:1, 1:0, 2:0, 3:0,
|
|
14
|
-
4:0, 5:1, 6:0, 7:0,
|
|
15
|
-
8:0, 9:0, 10:1, 11:0,
|
|
16
|
-
12:0, 13:0, 14:0, 15:1,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
expect ([... m1]) .toEqual ([
|
|
20
|
-
1, 0, 0, 0,
|
|
21
|
-
0, 1, 0, 0,
|
|
22
|
-
0, 0, 1, 0,
|
|
23
|
-
0, 0, 0, 1,
|
|
24
|
-
])
|
|
25
|
-
|
|
26
|
-
expect (m1 .length) .toBe (16)
|
|
27
|
-
expect (m1 .order) .toBe (4)
|
|
28
|
-
|
|
29
|
-
const m2 = new Matrix4 (2,3,4,5, 6,7,8,9, 10,11,12,13, 14,15,16,17)
|
|
30
|
-
|
|
31
|
-
expect (m2) .toEqual ({
|
|
32
|
-
0:2, 1:3, 2:4, 3:5,
|
|
33
|
-
4:6, 5:7, 6:8, 7:9,
|
|
34
|
-
8:10, 9:11, 10:12, 11:13,
|
|
35
|
-
12:14, 13:15, 14:16, 15:17,
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
expect ([... m2]) .toEqual ([
|
|
39
|
-
2,3,4,5, 6,7,8,9, 10,11,12,13, 14,15,16,17
|
|
40
|
-
])
|
|
41
|
-
|
|
42
|
-
expect (m2 .length) .toBe (16)
|
|
43
|
-
expect (m2 .order) .toBe (4)
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
test ("get1", () =>
|
|
47
|
-
{
|
|
48
|
-
const
|
|
49
|
-
m1 = new Matrix4 (2,0,0,0, 0,7,0,0, 0,0,12,0, 14,15,16,1),
|
|
50
|
-
t = new Vector3 (0, 0, 0),
|
|
51
|
-
s = new Vector3 (1, 1, 1)
|
|
52
|
-
|
|
53
|
-
m1 .get (t, null, s)
|
|
54
|
-
|
|
55
|
-
expect (t [0]) .toBeCloseTo (14)
|
|
56
|
-
expect (t [1]) .toBeCloseTo (15)
|
|
57
|
-
expect (t [2]) .toBeCloseTo (16)
|
|
58
|
-
|
|
59
|
-
expect (s [0]) .toBeCloseTo (2)
|
|
60
|
-
expect (s [1]) .toBeCloseTo (7)
|
|
61
|
-
expect (s [2]) .toBeCloseTo (12)
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
m2 = new Matrix4 (),
|
|
65
|
-
a = new Vector3 (2, 3, 4) .normalize (),
|
|
66
|
-
r = new Rotation4 ()
|
|
67
|
-
|
|
68
|
-
m2 .rotate (new Rotation4 (... a, 5))
|
|
69
|
-
m2 .get (null, r)
|
|
70
|
-
|
|
71
|
-
expect (r [0]) .toBeCloseTo (-0.3713906763541037)
|
|
72
|
-
expect (r [1]) .toBeCloseTo (-0.5570860145311556)
|
|
73
|
-
expect (r [2]) .toBeCloseTo (-0.7427813527082074)
|
|
74
|
-
expect (r [3]) .toBeCloseTo (Math.PI * 2 - 5)
|
|
75
|
-
|
|
76
|
-
const m3 = new Matrix4 ()
|
|
77
|
-
|
|
78
|
-
m3 .rotate (new Rotation4 (0, 0, 1, 5))
|
|
79
|
-
m3 .get (null, r)
|
|
80
|
-
|
|
81
|
-
expect (r [0]) .toBeCloseTo (0)
|
|
82
|
-
expect (r [1]) .toBeCloseTo (0)
|
|
83
|
-
expect (r [2]) .toBeCloseTo (-1)
|
|
84
|
-
expect (r [3]) .toBeCloseTo (Math.PI * 2 - 5)
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
m4 = new Matrix4 (),
|
|
88
|
-
so = new Rotation4 ()
|
|
89
|
-
|
|
90
|
-
m4 .set (null, null, new Vector3 (1, 2, 1), new Rotation4 (0, 0, 1, Math .PI / 4))
|
|
91
|
-
m4 .get (null, null, s, so)
|
|
92
|
-
|
|
93
|
-
expect (s [0]) .toBeCloseTo (2)
|
|
94
|
-
expect (s [1]) .toBeCloseTo (1)
|
|
95
|
-
expect (s [2]) .toBeCloseTo (1)
|
|
96
|
-
|
|
97
|
-
expect (so [0]) .toBeCloseTo (0)
|
|
98
|
-
expect (so [1]) .toBeCloseTo (0)
|
|
99
|
-
expect (so [2]) .toBeCloseTo (-1)
|
|
100
|
-
expect (so [3]) .toBeCloseTo (Math .PI / 4)
|
|
101
|
-
|
|
102
|
-
let v1, v2
|
|
103
|
-
|
|
104
|
-
m3 .set ()
|
|
105
|
-
|
|
106
|
-
expect ([... m3]) .toEqual ([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
|
|
107
|
-
|
|
108
|
-
m3 .set (new Vector3 (1, 2, 3))
|
|
109
|
-
|
|
110
|
-
v1 = m3 .multVecMatrix (new Vector3 (2,3,4))
|
|
111
|
-
|
|
112
|
-
m3 .get (t)
|
|
113
|
-
m4 .set (t)
|
|
114
|
-
|
|
115
|
-
v2 = m4 .multVecMatrix (new Vector3 (2,3,4))
|
|
116
|
-
|
|
117
|
-
expect (v1 [0]) .toBeCloseTo (v2 [0])
|
|
118
|
-
expect (v1 [1]) .toBeCloseTo (v2 [1])
|
|
119
|
-
expect (v1 [2]) .toBeCloseTo (v2 [2])
|
|
120
|
-
|
|
121
|
-
m3 .set (new Vector3 (1, 2, 3), new Rotation4 (1,2,3,4))
|
|
122
|
-
|
|
123
|
-
v1 = m3 .multVecMatrix (new Vector3 (2,3,4))
|
|
124
|
-
|
|
125
|
-
m3 .get (t, r)
|
|
126
|
-
m4 .set (t, r)
|
|
127
|
-
|
|
128
|
-
v2 = m4 .multVecMatrix (new Vector3 (2,3,4))
|
|
129
|
-
|
|
130
|
-
expect (v1 [0]) .toBeCloseTo (v2 [0])
|
|
131
|
-
expect (v1 [1]) .toBeCloseTo (v2 [1])
|
|
132
|
-
expect (v1 [2]) .toBeCloseTo (v2 [2])
|
|
133
|
-
|
|
134
|
-
m3 .set (new Vector3 (1, 2, 3), new Rotation4 (1,2,3,4), new Vector3 (1,2,3))
|
|
135
|
-
|
|
136
|
-
v1 = m3 .multVecMatrix (new Vector3 (2,3,4))
|
|
137
|
-
|
|
138
|
-
m3 .get (t, r, s)
|
|
139
|
-
m4 .set (t, r, s)
|
|
140
|
-
|
|
141
|
-
v2 = m4 .multVecMatrix (new Vector3 (2,3,4))
|
|
142
|
-
|
|
143
|
-
expect (v1 [0]) .toBeCloseTo (v2 [0])
|
|
144
|
-
expect (v1 [1]) .toBeCloseTo (v2 [1])
|
|
145
|
-
expect (v1 [2]) .toBeCloseTo (v2 [2])
|
|
146
|
-
|
|
147
|
-
m3 .set (new Vector3 (1, 2, 3), new Rotation4 (1,2,3,4), new Vector3 (1,2,3), new Rotation4 (1,2,3,4))
|
|
148
|
-
|
|
149
|
-
v1 = m3 .multVecMatrix (new Vector3 (2,3,4))
|
|
150
|
-
|
|
151
|
-
m3 .get (t, r, s, so)
|
|
152
|
-
m4 .set (t, r, s, so)
|
|
153
|
-
|
|
154
|
-
v2 = m4 .multVecMatrix (new Vector3 (2,3,4))
|
|
155
|
-
|
|
156
|
-
expect (v1 [0]) .toBeCloseTo (v2 [0])
|
|
157
|
-
expect (v1 [1]) .toBeCloseTo (v2 [1])
|
|
158
|
-
expect (v1 [2]) .toBeCloseTo (v2 [2])
|
|
159
|
-
|
|
160
|
-
m3 .set (new Vector3 (1, 2, 3), new Rotation4 (1,2,3,4), new Vector3 (1,2,3), new Rotation4 (1,2,3,4), new Vector3 (1,2,3))
|
|
161
|
-
|
|
162
|
-
v1 = m3 .multVecMatrix (new Vector3 (2,3,4))
|
|
163
|
-
|
|
164
|
-
m3 .get (t, r, s, so, new Vector3 (1,2,3))
|
|
165
|
-
m4 .set (t, r, s, so, new Vector3 (1,2,3))
|
|
166
|
-
|
|
167
|
-
v2 = m4 .multVecMatrix (new Vector3 (2,3,4))
|
|
168
|
-
|
|
169
|
-
expect (v1 [0]) .toBeCloseTo (v2 [0])
|
|
170
|
-
expect (v1 [1]) .toBeCloseTo (v2 [1])
|
|
171
|
-
expect (v1 [2]) .toBeCloseTo (v2 [2])
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
test ("set1", () =>
|
|
175
|
-
{
|
|
176
|
-
const m1 = new Matrix4 (2,3,4,5, 6,7,8,9, 10,11,12,13, 14,15,16,17)
|
|
177
|
-
|
|
178
|
-
m1 .set ()
|
|
179
|
-
|
|
180
|
-
expect ([... m1]) .toEqual ([
|
|
181
|
-
1, 0, 0, 0,
|
|
182
|
-
0, 1, 0, 0,
|
|
183
|
-
0, 0, 1, 0,
|
|
184
|
-
0, 0, 0, 1,
|
|
185
|
-
])
|
|
186
|
-
|
|
187
|
-
m1 .set (2,3,4,5, 6,7,8,9, 10,11,12,13, 14,15,16,17)
|
|
188
|
-
|
|
189
|
-
expect ([... m1]) .toEqual ([
|
|
190
|
-
2,3,4,5, 6,7,8,9, 10,11,12,13, 14,15,16,17
|
|
191
|
-
])
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
test ("set2", () =>
|
|
195
|
-
{
|
|
196
|
-
const
|
|
197
|
-
m1 = new Matrix4 (),
|
|
198
|
-
t = new Vector3 (2, 3, 4),
|
|
199
|
-
r = new Rotation4 (2, 3, 4, 5),
|
|
200
|
-
s = new Vector3 (5, 6, 7)
|
|
201
|
-
|
|
202
|
-
m1 .set (t, null, s)
|
|
203
|
-
|
|
204
|
-
expect ([... m1]) .toEqual ([
|
|
205
|
-
5, 0, 0, 0,
|
|
206
|
-
0, 6, 0, 0,
|
|
207
|
-
0, 0, 7, 0,
|
|
208
|
-
2, 3, 4, 1,
|
|
209
|
-
])
|
|
210
|
-
|
|
211
|
-
m1 .set (t, r, s)
|
|
212
|
-
|
|
213
|
-
expect (m1 [ 0]) .toBeCloseTo (1.91233700630701)
|
|
214
|
-
expect (m1 [ 1]) .toBeCloseTo (-2.820316230908796)
|
|
215
|
-
expect (m1 [ 2]) .toBeCloseTo (3.6590686700280917)
|
|
216
|
-
expect (m1 [ 3]) .toBeCloseTo (0)
|
|
217
|
-
expect (m1 [ 4]) .toBeCloseTo (5.1628733614577165)
|
|
218
|
-
expect (m1 [ 5]) .toBeCloseTo (3.03584352605473)
|
|
219
|
-
expect (m1 [ 6]) .toBeCloseTo (-0.35831932526990584)
|
|
220
|
-
expect (m1 [ 7]) .toBeCloseTo (0)
|
|
221
|
-
expect (m1 [ 8]) .toBeCloseTo (-2.356150095690409)
|
|
222
|
-
expect (m1 [ 9]) .toBeCloseTo (4.567858276338269)
|
|
223
|
-
expect (m1 [10]) .toBeCloseTo (4.752181340591503)
|
|
224
|
-
expect (m1 [11]) .toBeCloseTo (0)
|
|
225
|
-
expect (m1 [12]) .toBeCloseTo (2)
|
|
226
|
-
expect (m1 [13]) .toBeCloseTo (3)
|
|
227
|
-
expect (m1 [14]) .toBeCloseTo (4)
|
|
228
|
-
expect (m1 [15]) .toBeCloseTo (1)
|
|
229
|
-
})
|
|
230
|
-
|
|
231
|
-
test ("inverse", () =>
|
|
232
|
-
{
|
|
233
|
-
// https://www.wolframalpha.com/calculators/matrix-inverse-calculator
|
|
234
|
-
|
|
235
|
-
const m = new Matrix4 (3,2,1,0.1, 2,3,1,0.2, 2,1,3,0.3, 1,2,3,4) .inverse ()
|
|
236
|
-
|
|
237
|
-
expect (m [ 0]) .toBeCloseTo (0.678241)
|
|
238
|
-
expect (m [ 1]) .toBeCloseTo (-0.428241)
|
|
239
|
-
expect (m [ 2]) .toBeCloseTo (-0.0949074)
|
|
240
|
-
expect (m [ 3]) .toBeCloseTo (0.0115741)
|
|
241
|
-
expect (m [ 4]) .toBeCloseTo (-0.349537)
|
|
242
|
-
expect (m [ 5]) .toBeCloseTo (0.599537)
|
|
243
|
-
expect (m [ 6]) .toBeCloseTo (-0.0671296)
|
|
244
|
-
expect (m [ 7]) .toBeCloseTo (-0.0162037)
|
|
245
|
-
expect (m [ 8]) .toBeCloseTo (-0.363426)
|
|
246
|
-
expect (m [ 9]) .toBeCloseTo (0.113426)
|
|
247
|
-
expect (m [10]) .toBeCloseTo (0.446759)
|
|
248
|
-
expect (m [11]) .toBeCloseTo (-0.0300926)
|
|
249
|
-
expect (m [12]) .toBeCloseTo (0.277778)
|
|
250
|
-
expect (m [13]) .toBeCloseTo (-0.277778)
|
|
251
|
-
expect (m [14]) .toBeCloseTo (-0.277778)
|
|
252
|
-
expect (m [15]) .toBeCloseTo (0.277778)
|
|
253
|
-
|
|
254
|
-
const m2 = new Matrix4 (1,2,4,0.4, 5,6,8,0.8, 9,10,12,0.12, 14,15,16,17) .inverse ()
|
|
255
|
-
|
|
256
|
-
expect (m2 [ 0]) .toBeCloseTo (-932/27)
|
|
257
|
-
expect (m2 [ 1]) .toBeCloseTo (1729/27)
|
|
258
|
-
expect (m2 [ 2]) .toBeCloseTo (-770/27)
|
|
259
|
-
expect (m2 [ 3]) .toBeCloseTo (-2)
|
|
260
|
-
expect (m2 [ 4]) .toBeCloseTo (457/9)
|
|
261
|
-
expect (m2 [ 5]) .toBeCloseTo (-860/9)
|
|
262
|
-
expect (m2 [ 6]) .toBeCloseTo (385/9)
|
|
263
|
-
expect (m2 [ 7]) .toBeCloseTo (3)
|
|
264
|
-
expect (m2 [ 8]) .toBeCloseTo (-197/12)
|
|
265
|
-
expect (m2 [ 9]) .toBeCloseTo (379/12)
|
|
266
|
-
expect (m2 [10]) .toBeCloseTo (-85/6)
|
|
267
|
-
expect (m2 [11]) .toBeCloseTo (-1)
|
|
268
|
-
expect (m2 [12]) .toBeCloseTo (-25/27)
|
|
269
|
-
expect (m2 [13]) .toBeCloseTo (50/27)
|
|
270
|
-
expect (m2 [14]) .toBeCloseTo (-25/27)
|
|
271
|
-
expect (m2 [15]) .toBeCloseTo (0)
|
|
272
|
-
|
|
273
|
-
const m3 = new Matrix4 (3,2,1,0.1, 2,3,1,0.2, 2,1,3,0.3, 1,2,3,4) .inverse () .inverse ()
|
|
274
|
-
|
|
275
|
-
expect (m3 [ 0]) .toBeCloseTo (3)
|
|
276
|
-
expect (m3 [ 1]) .toBeCloseTo (2)
|
|
277
|
-
expect (m3 [ 2]) .toBeCloseTo (1,)
|
|
278
|
-
expect (m3 [ 3]) .toBeCloseTo (0.1)
|
|
279
|
-
expect (m3 [ 4]) .toBeCloseTo (2)
|
|
280
|
-
expect (m3 [ 5]) .toBeCloseTo (3)
|
|
281
|
-
expect (m3 [ 6]) .toBeCloseTo (1)
|
|
282
|
-
expect (m3 [ 7]) .toBeCloseTo (0.2)
|
|
283
|
-
expect (m3 [ 8]) .toBeCloseTo (2)
|
|
284
|
-
expect (m3 [ 9]) .toBeCloseTo (1)
|
|
285
|
-
expect (m3 [10]) .toBeCloseTo (3)
|
|
286
|
-
expect (m3 [11]) .toBeCloseTo (0.3)
|
|
287
|
-
expect (m3 [12]) .toBeCloseTo (1)
|
|
288
|
-
expect (m3 [13]) .toBeCloseTo (2)
|
|
289
|
-
expect (m3 [14]) .toBeCloseTo (3)
|
|
290
|
-
expect (m3 [15]) .toBeCloseTo (4)
|
|
291
|
-
|
|
292
|
-
const m4 = new Matrix4 (3,2,1,0.1, 2,3,1,0.2, 2,1,3,0.3, 1,2,3,4)
|
|
293
|
-
|
|
294
|
-
m4 .multRight (m4 .copy () .inverse ())
|
|
295
|
-
|
|
296
|
-
expect (m4 [ 0]) .toBeCloseTo (1)
|
|
297
|
-
expect (m4 [ 1]) .toBeCloseTo (0)
|
|
298
|
-
expect (m4 [ 2]) .toBeCloseTo (0)
|
|
299
|
-
expect (m4 [ 3]) .toBeCloseTo (0)
|
|
300
|
-
expect (m4 [ 4]) .toBeCloseTo (0)
|
|
301
|
-
expect (m4 [ 5]) .toBeCloseTo (1)
|
|
302
|
-
expect (m4 [ 6]) .toBeCloseTo (0)
|
|
303
|
-
expect (m4 [ 7]) .toBeCloseTo (0)
|
|
304
|
-
expect (m4 [ 8]) .toBeCloseTo (0)
|
|
305
|
-
expect (m4 [ 9]) .toBeCloseTo (0)
|
|
306
|
-
expect (m4 [10]) .toBeCloseTo (1)
|
|
307
|
-
expect (m4 [11]) .toBeCloseTo (0)
|
|
308
|
-
expect (m4 [12]) .toBeCloseTo (0)
|
|
309
|
-
expect (m4 [13]) .toBeCloseTo (0)
|
|
310
|
-
expect (m4 [14]) .toBeCloseTo (0)
|
|
311
|
-
expect (m4 [15]) .toBeCloseTo (1)
|
|
312
|
-
})
|
|
313
|
-
|
|
314
|
-
test ("multRight", () =>
|
|
315
|
-
{
|
|
316
|
-
// https://www.matopt.de/werkzeuge/grundlagen/matrixmultiplikation.html
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
m1 = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16),
|
|
320
|
-
m2 = new Matrix4 (17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32),
|
|
321
|
-
m = m1 .multRight (m2)
|
|
322
|
-
|
|
323
|
-
expect (m [ 0]) .toBe (250)
|
|
324
|
-
expect (m [ 1]) .toBe (260)
|
|
325
|
-
expect (m [ 2]) .toBe (270)
|
|
326
|
-
expect (m [ 3]) .toBe (280)
|
|
327
|
-
expect (m [ 4]) .toBe (618)
|
|
328
|
-
expect (m [ 5]) .toBe (644)
|
|
329
|
-
expect (m [ 6]) .toBe (670)
|
|
330
|
-
expect (m [ 7]) .toBe (696)
|
|
331
|
-
expect (m [ 8]) .toBe (986)
|
|
332
|
-
expect (m [ 9]) .toBe (1028)
|
|
333
|
-
expect (m [10]) .toBe (1070)
|
|
334
|
-
expect (m [11]) .toBe (1112)
|
|
335
|
-
expect (m [12]) .toBe (1354)
|
|
336
|
-
expect (m [13]) .toBe (1412)
|
|
337
|
-
expect (m [14]) .toBe (1470)
|
|
338
|
-
expect (m [15]) .toBe (1528)
|
|
339
|
-
})
|
|
340
|
-
|
|
341
|
-
test ("multLeft", () =>
|
|
342
|
-
{
|
|
343
|
-
// https://www.matopt.de/werkzeuge/grundlagen/matrixmultiplikation.html
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
m1 = new Matrix4 (17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32),
|
|
347
|
-
m2 = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16),
|
|
348
|
-
m = m1 .multLeft (m2)
|
|
349
|
-
|
|
350
|
-
expect (m [ 0]) .toBe (250)
|
|
351
|
-
expect (m [ 1]) .toBe (260)
|
|
352
|
-
expect (m [ 2]) .toBe (270)
|
|
353
|
-
expect (m [ 3]) .toBe (280)
|
|
354
|
-
expect (m [ 4]) .toBe (618)
|
|
355
|
-
expect (m [ 5]) .toBe (644)
|
|
356
|
-
expect (m [ 6]) .toBe (670)
|
|
357
|
-
expect (m [ 7]) .toBe (696)
|
|
358
|
-
expect (m [ 8]) .toBe (986)
|
|
359
|
-
expect (m [ 9]) .toBe (1028)
|
|
360
|
-
expect (m [10]) .toBe (1070)
|
|
361
|
-
expect (m [11]) .toBe (1112)
|
|
362
|
-
expect (m [12]) .toBe (1354)
|
|
363
|
-
expect (m [13]) .toBe (1412)
|
|
364
|
-
expect (m [14]) .toBe (1470)
|
|
365
|
-
expect (m [15]) .toBe (1528)
|
|
366
|
-
})
|
|
367
|
-
|
|
368
|
-
test ("transpose", () =>
|
|
369
|
-
{
|
|
370
|
-
const m = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) .transpose ()
|
|
371
|
-
|
|
372
|
-
expect (m [ 0]) .toBe (1)
|
|
373
|
-
expect (m [ 1]) .toBe (5)
|
|
374
|
-
expect (m [ 2]) .toBe (9)
|
|
375
|
-
expect (m [ 3]) .toBe (13)
|
|
376
|
-
expect (m [ 4]) .toBe (2)
|
|
377
|
-
expect (m [ 5]) .toBe (6)
|
|
378
|
-
expect (m [ 6]) .toBe (10)
|
|
379
|
-
expect (m [ 7]) .toBe (14)
|
|
380
|
-
expect (m [ 8]) .toBe (3)
|
|
381
|
-
expect (m [ 9]) .toBe (7)
|
|
382
|
-
expect (m [10]) .toBe (11)
|
|
383
|
-
expect (m [11]) .toBe (15)
|
|
384
|
-
expect (m [12]) .toBe (4)
|
|
385
|
-
expect (m [13]) .toBe (8)
|
|
386
|
-
expect (m [14]) .toBe (12)
|
|
387
|
-
expect (m [15]) .toBe (16)
|
|
388
|
-
|
|
389
|
-
const m1 = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) .transpose () .transpose ()
|
|
390
|
-
|
|
391
|
-
expect (m1 [ 0]) .toBe (1)
|
|
392
|
-
expect (m1 [ 1]) .toBe (2)
|
|
393
|
-
expect (m1 [ 2]) .toBe (3)
|
|
394
|
-
expect (m1 [ 3]) .toBe (4)
|
|
395
|
-
expect (m1 [ 4]) .toBe (5)
|
|
396
|
-
expect (m1 [ 5]) .toBe (6)
|
|
397
|
-
expect (m1 [ 6]) .toBe (7)
|
|
398
|
-
expect (m1 [ 7]) .toBe (8)
|
|
399
|
-
expect (m1 [ 8]) .toBe (9)
|
|
400
|
-
expect (m1 [ 9]) .toBe (10)
|
|
401
|
-
expect (m1 [10]) .toBe (11)
|
|
402
|
-
expect (m1 [11]) .toBe (12)
|
|
403
|
-
expect (m1 [12]) .toBe (13)
|
|
404
|
-
expect (m1 [13]) .toBe (14)
|
|
405
|
-
expect (m1 [14]) .toBe (15)
|
|
406
|
-
expect (m1 [15]) .toBe (16)
|
|
407
|
-
})
|
|
408
|
-
|
|
409
|
-
test ("determinant", () =>
|
|
410
|
-
{
|
|
411
|
-
// https://www.wolframalpha.com/calculators/determinant-calculator
|
|
412
|
-
|
|
413
|
-
const d = new Matrix4 (1,2,3,4, 4,3,2,1, 2,1,3,4, 3,4,1,2) .determinant ()
|
|
414
|
-
|
|
415
|
-
expect (d) .toBe (-40)
|
|
416
|
-
})
|
|
417
|
-
|
|
418
|
-
test ("determinant3", () =>
|
|
419
|
-
{
|
|
420
|
-
// https://www.wolframalpha.com/calculators/determinant-calculator
|
|
421
|
-
|
|
422
|
-
const d = new Matrix4 (1,2,3,4, 3,2,1,4, 2,1,3,4) .determinant3 ()
|
|
423
|
-
|
|
424
|
-
expect (d) .toBe (-12)
|
|
425
|
-
})
|
|
426
|
-
|
|
427
|
-
test ("multVecMatrix3", () =>
|
|
428
|
-
{
|
|
429
|
-
// https://www.wolframalpha.com/calculators/determinant-calculator
|
|
430
|
-
|
|
431
|
-
const v = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) .multVecMatrix (new Vector3 (17, 18, 19))
|
|
432
|
-
|
|
433
|
-
expect (v [0]) .toBeCloseTo (291 / 456)
|
|
434
|
-
expect (v [1]) .toBeCloseTo (346 / 456)
|
|
435
|
-
expect (v [2]) .toBeCloseTo (401 / 456)
|
|
436
|
-
|
|
437
|
-
const v1 = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) .transpose () .multVecMatrix (new Vector3 (17, 18, 19))
|
|
438
|
-
|
|
439
|
-
expect (v1 [0]) .toBeCloseTo (114 / 774)
|
|
440
|
-
expect (v1 [1]) .toBeCloseTo (334 / 774)
|
|
441
|
-
expect (v1 [2]) .toBeCloseTo (554 / 774)
|
|
442
|
-
})
|
|
443
|
-
|
|
444
|
-
test ("multVec4Matrix4", () =>
|
|
445
|
-
{
|
|
446
|
-
// https://www.wolframalpha.com/calculators/determinant-calculator
|
|
447
|
-
|
|
448
|
-
const v = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) .multVecMatrix (new Vector4 (17, 18, 19, 20))
|
|
449
|
-
|
|
450
|
-
expect (v [0]) .toBe (538)
|
|
451
|
-
expect (v [1]) .toBe (612)
|
|
452
|
-
expect (v [2]) .toBe (686)
|
|
453
|
-
expect (v [3]) .toBe (760)
|
|
454
|
-
|
|
455
|
-
const v1 = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) .transpose () .multVecMatrix (new Vector4 (17, 18, 19, 20))
|
|
456
|
-
|
|
457
|
-
expect (v1 [0]) .toBe (190)
|
|
458
|
-
expect (v1 [1]) .toBe (486)
|
|
459
|
-
expect (v1 [2]) .toBe (782)
|
|
460
|
-
expect (v1 [3]) .toBe (1078)
|
|
461
|
-
})
|
|
462
|
-
|
|
463
|
-
test ("multMatrixVec3", () =>
|
|
464
|
-
{
|
|
465
|
-
// https://www.wolframalpha.com/calculators/determinant-calculator
|
|
466
|
-
|
|
467
|
-
const v = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) .multMatrixVec (new Vector3 (17, 18, 19))
|
|
468
|
-
|
|
469
|
-
expect (v [0]) .toBeCloseTo (114 / 774)
|
|
470
|
-
expect (v [1]) .toBeCloseTo (334 / 774)
|
|
471
|
-
expect (v [2]) .toBeCloseTo (554 / 774)
|
|
472
|
-
|
|
473
|
-
const v1 = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) .transpose () .multMatrixVec (new Vector3 (17, 18, 19))
|
|
474
|
-
|
|
475
|
-
expect (v1 [0]) .toBeCloseTo (291 / 456)
|
|
476
|
-
expect (v1 [1]) .toBeCloseTo (346 / 456)
|
|
477
|
-
expect (v1 [2]) .toBeCloseTo (401 / 456)
|
|
478
|
-
})
|
|
479
|
-
|
|
480
|
-
test ("multMatrixVec4", () =>
|
|
481
|
-
{
|
|
482
|
-
// https://www.wolframalpha.com/calculators/determinant-calculator
|
|
483
|
-
|
|
484
|
-
const v = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) .multMatrixVec (new Vector4 (17, 18, 19, 20))
|
|
485
|
-
|
|
486
|
-
expect (v [0]) .toBe (190)
|
|
487
|
-
expect (v [1]) .toBe (486)
|
|
488
|
-
expect (v [2]) .toBe (782)
|
|
489
|
-
expect (v [3]) .toBe (1078)
|
|
490
|
-
|
|
491
|
-
const v1 = new Matrix4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) .transpose () .multMatrixVec (new Vector4 (17, 18, 19, 20))
|
|
492
|
-
|
|
493
|
-
expect (v1 [0]) .toBe (538)
|
|
494
|
-
expect (v1 [1]) .toBe (612)
|
|
495
|
-
expect (v1 [2]) .toBe (686)
|
|
496
|
-
expect (v1 [3]) .toBe (760)
|
|
497
|
-
})
|
|
498
|
-
|
|
499
|
-
test ("multDirMatrix", () =>
|
|
500
|
-
{
|
|
501
|
-
// https://www.wolframalpha.com/calculators/determinant-calculator
|
|
502
|
-
|
|
503
|
-
const v = new Matrix4 (1, 2, 3, 0, 4, 5, 6, 0, 7, 8, 9, 0, 0, 0, 0, 1) .multDirMatrix (new Vector3 (10, 11, 12))
|
|
504
|
-
|
|
505
|
-
expect (v [0]) .toBe (138)
|
|
506
|
-
expect (v [1]) .toBe (171)
|
|
507
|
-
expect (v [2]) .toBe (204)
|
|
508
|
-
|
|
509
|
-
const v1 = new Matrix4 (1, 2, 3, 0, 4, 5, 6, 0, 7, 8, 9, 0, 0, 0, 0, 1) .transpose () .multDirMatrix (new Vector3 (10, 11, 12))
|
|
510
|
-
|
|
511
|
-
expect (v1 [0]) .toBe (68)
|
|
512
|
-
expect (v1 [1]) .toBe (167)
|
|
513
|
-
expect (v1 [2]) .toBe (266)
|
|
514
|
-
})
|
|
515
|
-
|
|
516
|
-
test ("multMatrixDir", () =>
|
|
517
|
-
{
|
|
518
|
-
// https://www.wolframalpha.com/calculators/determinant-calculator
|
|
519
|
-
|
|
520
|
-
const v = new Matrix4 (1, 2, 3, 0, 4, 5, 6, 0, 7, 8, 9, 0, 0, 0, 0, 1) .multMatrixDir (new Vector3 (10, 11, 12))
|
|
521
|
-
|
|
522
|
-
expect (v [0]) .toBe (68)
|
|
523
|
-
expect (v [1]) .toBe (167)
|
|
524
|
-
expect (v [2]) .toBe (266)
|
|
525
|
-
|
|
526
|
-
const v1 = new Matrix4 (1, 2, 3, 0, 4, 5, 6, 0, 7, 8, 9, 0, 0, 0, 0, 1) .transpose () .multMatrixDir (new Vector3 (10, 11, 12))
|
|
527
|
-
|
|
528
|
-
expect (v1 [0]) .toBe (138)
|
|
529
|
-
expect (v1 [1]) .toBe (171)
|
|
530
|
-
expect (v1 [2]) .toBe (204)
|
|
531
|
-
})
|
|
532
|
-
|
|
533
|
-
test ("translate", () =>
|
|
534
|
-
{
|
|
535
|
-
// https://www.wolframalpha.com/calculators/determinant-calculator
|
|
536
|
-
|
|
537
|
-
const m = new Matrix4 (1, 2, 3, 0, 5, 6, 7, 0, 9, 10, 11, 0, 13, 14, 15, 1) .translate (new Vector3 (17, 18, 19))
|
|
538
|
-
|
|
539
|
-
expect (m [ 0]) .toBe (1)
|
|
540
|
-
expect (m [ 1]) .toBe (2)
|
|
541
|
-
expect (m [ 2]) .toBe (3)
|
|
542
|
-
expect (m [ 3]) .toBe (0)
|
|
543
|
-
expect (m [ 4]) .toBe (5)
|
|
544
|
-
expect (m [ 5]) .toBe (6)
|
|
545
|
-
expect (m [ 6]) .toBe (7)
|
|
546
|
-
expect (m [ 7]) .toBe (0)
|
|
547
|
-
expect (m [ 8]) .toBe (9)
|
|
548
|
-
expect (m [ 9]) .toBe (10)
|
|
549
|
-
expect (m [10]) .toBe (11)
|
|
550
|
-
expect (m [11]) .toBe (0)
|
|
551
|
-
expect (m [12]) .toBe (291)
|
|
552
|
-
expect (m [13]) .toBe (346)
|
|
553
|
-
expect (m [14]) .toBe (401)
|
|
554
|
-
expect (m [15]) .toBe (1)
|
|
555
|
-
})
|
|
556
|
-
|
|
557
|
-
test ("rotate", () =>
|
|
558
|
-
{
|
|
559
|
-
const m = new Matrix4 (1, 2, 3, 0, 5, 6, 7, 0, 9, 10, 11, 0, 13, 14, 15, 1) .rotate (new Rotation4 (2, 3, 4, 5))
|
|
560
|
-
|
|
561
|
-
expect (m [ 0]) .toBeCloseTo (4.14847477640317)
|
|
562
|
-
expect (m [ 1]) .toBeCloseTo (4.698692665488432)
|
|
563
|
-
expect (m [ 2]) .toBeCloseTo (5.248910554573694)
|
|
564
|
-
expect (m [ 3]) .toBeCloseTo (0)
|
|
565
|
-
expect (m [ 4]) .toBeCloseTo (2.852869510717036)
|
|
566
|
-
expect (m [ 5]) .toBeCloseTo (4.159602437757459)
|
|
567
|
-
expect (m [ 6]) .toBeCloseTo (5.4663353647978825)
|
|
568
|
-
expect (m [ 7]) .toBeCloseTo (0)
|
|
569
|
-
expect (m [ 8]) .toBeCloseTo (9.036110478760637)
|
|
570
|
-
expect (m [ 9]) .toBeCloseTo (10.030951838937689)
|
|
571
|
-
expect (m [10]) .toBeCloseTo (11.02579319911474)
|
|
572
|
-
expect (m [11]) .toBeCloseTo (0)
|
|
573
|
-
expect (m [12]) .toBeCloseTo (13)
|
|
574
|
-
expect (m [13]) .toBeCloseTo (14)
|
|
575
|
-
expect (m [14]) .toBeCloseTo (15)
|
|
576
|
-
expect (m [15]) .toBeCloseTo (1)
|
|
577
|
-
})
|
|
578
|
-
|
|
579
|
-
test ("scale", () =>
|
|
580
|
-
{
|
|
581
|
-
// https://www.wolframalpha.com/calculators/determinant-calculator
|
|
582
|
-
|
|
583
|
-
const m = new Matrix4 (1, 2, 3, 0, 5, 6, 7, 0, 9, 10, 11, 0, 13, 14, 15, 1) .scale (new Vector3 (17, 18, 19))
|
|
584
|
-
|
|
585
|
-
expect (m [ 0]) .toBe (17)
|
|
586
|
-
expect (m [ 1]) .toBe (34)
|
|
587
|
-
expect (m [ 2]) .toBe (51)
|
|
588
|
-
expect (m [ 3]) .toBe (0)
|
|
589
|
-
expect (m [ 4]) .toBe (90)
|
|
590
|
-
expect (m [ 5]) .toBe (108)
|
|
591
|
-
expect (m [ 6]) .toBe (126)
|
|
592
|
-
expect (m [ 7]) .toBe (0)
|
|
593
|
-
expect (m [ 8]) .toBe (171)
|
|
594
|
-
expect (m [ 9]) .toBe (190)
|
|
595
|
-
expect (m [10]) .toBe (209)
|
|
596
|
-
expect (m [11]) .toBe (0)
|
|
597
|
-
expect (m [12]) .toBe (13)
|
|
598
|
-
expect (m [13]) .toBe (14)
|
|
599
|
-
expect (m [14]) .toBe (15)
|
|
600
|
-
expect (m [15]) .toBe (1)
|
|
601
|
-
})
|
|
602
|
-
|
|
603
|
-
test ("copy", () =>
|
|
604
|
-
{
|
|
605
|
-
const m = new Matrix4 (2,3,4,5, 6,7,8,9, 10,11,12,13, 14,15,16,17) .copy ()
|
|
606
|
-
|
|
607
|
-
expect (m [ 0]) .toBe (2)
|
|
608
|
-
expect (m [ 1]) .toBe (3)
|
|
609
|
-
expect (m [ 2]) .toBe (4)
|
|
610
|
-
expect (m [ 3]) .toBe (5)
|
|
611
|
-
expect (m [ 4]) .toBe (6)
|
|
612
|
-
expect (m [ 5]) .toBe (7)
|
|
613
|
-
expect (m [ 6]) .toBe (8)
|
|
614
|
-
expect (m [ 7]) .toBe (9)
|
|
615
|
-
expect (m [ 8]) .toBe (10)
|
|
616
|
-
expect (m [ 9]) .toBe (11)
|
|
617
|
-
expect (m [10]) .toBe (12)
|
|
618
|
-
expect (m [11]) .toBe (13)
|
|
619
|
-
expect (m [12]) .toBe (14)
|
|
620
|
-
expect (m [13]) .toBe (15)
|
|
621
|
-
expect (m [14]) .toBe (16)
|
|
622
|
-
expect (m [15]) .toBe (17)
|
|
623
|
-
})
|
|
624
|
-
|
|
625
|
-
test ("assign", () =>
|
|
626
|
-
{
|
|
627
|
-
const m = new Matrix4 () .assign (new Matrix4 (2,3,4,5, 6,7,8,9, 10,11,12,13, 14,15,16,17))
|
|
628
|
-
|
|
629
|
-
expect (m [ 0]) .toBe (2)
|
|
630
|
-
expect (m [ 1]) .toBe (3)
|
|
631
|
-
expect (m [ 2]) .toBe (4)
|
|
632
|
-
expect (m [ 3]) .toBe (5)
|
|
633
|
-
expect (m [ 4]) .toBe (6)
|
|
634
|
-
expect (m [ 5]) .toBe (7)
|
|
635
|
-
expect (m [ 6]) .toBe (8)
|
|
636
|
-
expect (m [ 7]) .toBe (9)
|
|
637
|
-
expect (m [ 8]) .toBe (10)
|
|
638
|
-
expect (m [ 9]) .toBe (11)
|
|
639
|
-
expect (m [10]) .toBe (12)
|
|
640
|
-
expect (m [11]) .toBe (13)
|
|
641
|
-
expect (m [12]) .toBe (14)
|
|
642
|
-
expect (m [13]) .toBe (15)
|
|
643
|
-
expect (m [14]) .toBe (16)
|
|
644
|
-
expect (m [15]) .toBe (17)
|
|
645
|
-
})
|
|
646
|
-
|
|
647
|
-
test ("equals", () =>
|
|
648
|
-
{
|
|
649
|
-
const
|
|
650
|
-
a = new Matrix4 (2,3,4,5, 6,7,8,9, 10,11,12,13, 14,15,16,17),
|
|
651
|
-
b = new Matrix4 (2,3,4,5, 6,7,8,9, 10,11,12,13, 14,15,16,17)
|
|
652
|
-
|
|
653
|
-
expect (a .equals (b)) .toBe (true)
|
|
654
|
-
|
|
655
|
-
for (let i = 0; i < a .length; ++ i)
|
|
656
|
-
{
|
|
657
|
-
const c = a .copy ()
|
|
658
|
-
|
|
659
|
-
c [i] = 0
|
|
660
|
-
|
|
661
|
-
expect (a .equals (c)) .toBe (false)
|
|
662
|
-
}
|
|
663
|
-
})
|