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.
Files changed (165) hide show
  1. package/README.md +1 -0
  2. package/docs/_posts/getting-started.md +3 -2
  3. package/package.json +2 -2
  4. package/.gitmodules +0 -6
  5. package/docs/assets/lib/.editorconfig +0 -11
  6. package/docs/assets/lib/.gitignore +0 -4
  7. package/docs/assets/lib/LICENSE +0 -21
  8. package/docs/assets/lib/README.md +0 -50
  9. package/docs/assets/lib/bootstrap-4.6.1/bootstrap.bundle.min.js +0 -7
  10. package/docs/assets/lib/bootstrap-4.6.1/bootstrap.bundle.min.js.map +0 -1
  11. package/docs/assets/lib/bootstrap-4.6.1/bootstrap.min.css +0 -7
  12. package/docs/assets/lib/bootstrap-4.6.1/bootstrap.min.css.map +0 -1
  13. package/docs/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css +0 -4
  14. package/docs/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js +0 -5
  15. package/docs/assets/lib/clipboard-2.0.9/clipboard.min.js +0 -7
  16. package/docs/assets/lib/countup.js-1.9.3/countUp.min.js +0 -1
  17. package/docs/assets/lib/dayjs-1.10.7/dayjs.min.js +0 -1
  18. package/docs/assets/lib/dayjs-1.10.7/locale/en.min.js +0 -7
  19. package/docs/assets/lib/dayjs-1.10.7/plugin/localizedFormat.min.js +0 -5
  20. package/docs/assets/lib/dayjs-1.10.7/plugin/relativeTime.min.js +0 -5
  21. package/docs/assets/lib/fontawesome-free-6.2.1/LICENSE.txt +0 -165
  22. package/docs/assets/lib/fontawesome-free-6.2.1/css/all.min.css +0 -6
  23. package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-brands-400.ttf +0 -0
  24. package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-brands-400.woff2 +0 -0
  25. package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-regular-400.ttf +0 -0
  26. package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-regular-400.woff2 +0 -0
  27. package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-solid-900.ttf +0 -0
  28. package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-solid-900.woff2 +0 -0
  29. package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-v4compatibility.ttf +0 -0
  30. package/docs/assets/lib/fontawesome-free-6.2.1/webfonts/fa-v4compatibility.woff2 +0 -0
  31. package/docs/assets/lib/fonts/Lato/Lato-Regular.ttf +0 -0
  32. package/docs/assets/lib/fonts/Lato/OFL.txt +0 -93
  33. package/docs/assets/lib/fonts/Source_Sans_Pro/OFL.txt +0 -93
  34. package/docs/assets/lib/fonts/Source_Sans_Pro/SourceSansPro-Black.ttf +0 -0
  35. package/docs/assets/lib/fonts/Source_Sans_Pro/SourceSansPro-Bold.ttf +0 -0
  36. package/docs/assets/lib/fonts/Source_Sans_Pro/SourceSansPro-Regular.ttf +0 -0
  37. package/docs/assets/lib/fonts/Source_Sans_Pro/SourceSansPro-SemiBold.ttf +0 -0
  38. package/docs/assets/lib/fonts/main.css +0 -1
  39. package/docs/assets/lib/jquery-3.6.0/jquery.min.js +0 -2
  40. package/docs/assets/lib/lozad-1.16.0/lozad.min.js +0 -10
  41. package/docs/assets/lib/magnific-popup-1.1.0/jquery.magnific-popup.min.js +0 -4
  42. package/docs/assets/lib/magnific-popup-1.1.0/magnific-popup.css +0 -2
  43. package/docs/assets/lib/mathjax-3.2.0/a11y/assistive-mml.js +0 -1
  44. package/docs/assets/lib/mathjax-3.2.0/a11y/complexity.js +0 -1
  45. package/docs/assets/lib/mathjax-3.2.0/a11y/explorer.js +0 -1
  46. package/docs/assets/lib/mathjax-3.2.0/a11y/semantic-enrich.js +0 -1
  47. package/docs/assets/lib/mathjax-3.2.0/adaptors/liteDOM.js +0 -1
  48. package/docs/assets/lib/mathjax-3.2.0/core.js +0 -1
  49. package/docs/assets/lib/mathjax-3.2.0/input/asciimath.js +0 -1
  50. package/docs/assets/lib/mathjax-3.2.0/input/mml/entities.js +0 -1
  51. package/docs/assets/lib/mathjax-3.2.0/input/mml/extensions/mml3.js +0 -1
  52. package/docs/assets/lib/mathjax-3.2.0/input/mml/extensions/mml3.sef.json +0 -1
  53. package/docs/assets/lib/mathjax-3.2.0/input/mml.js +0 -1
  54. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/action.js +0 -1
  55. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/all-packages.js +0 -34
  56. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/ams.js +0 -1
  57. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/amscd.js +0 -1
  58. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/autoload.js +0 -1
  59. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/bbox.js +0 -1
  60. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/boldsymbol.js +0 -1
  61. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/braket.js +0 -1
  62. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/bussproofs.js +0 -1
  63. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/cancel.js +0 -1
  64. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/centernot.js +0 -1
  65. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/color.js +0 -1
  66. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/colortbl.js +0 -1
  67. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/colorv2.js +0 -1
  68. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/configmacros.js +0 -1
  69. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/enclose.js +0 -1
  70. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/extpfeil.js +0 -1
  71. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/gensymb.js +0 -1
  72. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/html.js +0 -1
  73. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/mathtools.js +0 -1
  74. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/mhchem.js +0 -34
  75. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/newcommand.js +0 -1
  76. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/noerrors.js +0 -1
  77. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/noundefined.js +0 -1
  78. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/physics.js +0 -1
  79. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/require.js +0 -1
  80. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/setoptions.js +0 -1
  81. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/tagformat.js +0 -1
  82. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/textcomp.js +0 -1
  83. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/textmacros.js +0 -1
  84. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/unicode.js +0 -1
  85. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/upgreek.js +0 -1
  86. package/docs/assets/lib/mathjax-3.2.0/input/tex/extensions/verb.js +0 -1
  87. package/docs/assets/lib/mathjax-3.2.0/input/tex-base.js +0 -1
  88. package/docs/assets/lib/mathjax-3.2.0/input/tex-full.js +0 -34
  89. package/docs/assets/lib/mathjax-3.2.0/input/tex.js +0 -1
  90. package/docs/assets/lib/mathjax-3.2.0/latest.js +0 -1
  91. package/docs/assets/lib/mathjax-3.2.0/loader.js +0 -1
  92. package/docs/assets/lib/mathjax-3.2.0/mml-chtml.js +0 -1
  93. package/docs/assets/lib/mathjax-3.2.0/mml-svg.js +0 -1
  94. package/docs/assets/lib/mathjax-3.2.0/node-main.js +0 -1
  95. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/tex.js +0 -1
  96. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
  97. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
  98. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
  99. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
  100. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
  101. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
  102. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
  103. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
  104. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
  105. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
  106. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
  107. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
  108. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
  109. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
  110. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
  111. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
  112. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
  113. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
  114. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
  115. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
  116. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
  117. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
  118. package/docs/assets/lib/mathjax-3.2.0/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
  119. package/docs/assets/lib/mathjax-3.2.0/output/chtml.js +0 -1
  120. package/docs/assets/lib/mathjax-3.2.0/output/svg/fonts/tex.js +0 -1
  121. package/docs/assets/lib/mathjax-3.2.0/output/svg.js +0 -1
  122. package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/de.js +0 -125
  123. package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/en.js +0 -131
  124. package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/es.js +0 -122
  125. package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/fr.js +0 -125
  126. package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/hi.js +0 -125
  127. package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/it.js +0 -125
  128. package/docs/assets/lib/mathjax-3.2.0/sre/mathmaps/nemeth.js +0 -113
  129. package/docs/assets/lib/mathjax-3.2.0/sre/sre-node.js +0 -11
  130. package/docs/assets/lib/mathjax-3.2.0/sre/sre_browser.js +0 -999
  131. package/docs/assets/lib/mathjax-3.2.0/startup.js +0 -1
  132. package/docs/assets/lib/mathjax-3.2.0/tex-chtml-full.js +0 -34
  133. package/docs/assets/lib/mathjax-3.2.0/tex-chtml.js +0 -1
  134. package/docs/assets/lib/mathjax-3.2.0/tex-mml-chtml.js +0 -1
  135. package/docs/assets/lib/mathjax-3.2.0/tex-mml-svg.js +0 -1
  136. package/docs/assets/lib/mathjax-3.2.0/tex-svg-full.js +0 -34
  137. package/docs/assets/lib/mathjax-3.2.0/tex-svg.js +0 -1
  138. package/docs/assets/lib/mathjax-3.2.0/ui/lazy.js +0 -1
  139. package/docs/assets/lib/mathjax-3.2.0/ui/menu.js +0 -1
  140. package/docs/assets/lib/mathjax-3.2.0/ui/safe.js +0 -1
  141. package/docs/assets/lib/mermaid-9.1.7/mermaid.min.js +0 -3
  142. package/docs/assets/lib/mermaid-9.1.7/mermaid.min.js.map +0 -1
  143. package/docs/assets/lib/polyfill-v3-es6/polyfill.min.js +0 -100
  144. package/docs/assets/lib/simple-jekyll-search-1.10.0/simple-jekyll-search.min.js +0 -6
  145. package/tests/.vscode/settings.json +0 -7
  146. package/tests/README.md +0 -2
  147. package/tests/package.json +0 -25
  148. package/tests/tests/X3D.js +0 -16
  149. package/tests/tests/X_ITE.test.js +0 -6
  150. package/tests/tests/standard/Math/Algorithm.test.js +0 -85
  151. package/tests/tests/standard/Math/Numbers/Color3.test.js +0 -162
  152. package/tests/tests/standard/Math/Numbers/Color4.test.js +0 -186
  153. package/tests/tests/standard/Math/Numbers/Complex.test.js +0 -199
  154. package/tests/tests/standard/Math/Numbers/Matrix2.test.js +0 -248
  155. package/tests/tests/standard/Math/Numbers/Matrix3.test.js +0 -585
  156. package/tests/tests/standard/Math/Numbers/Matrix4.test.js +0 -663
  157. package/tests/tests/standard/Math/Numbers/Rotation4.test.js +0 -197
  158. package/tests/tests/standard/Math/Numbers/Vector2.test.js +0 -259
  159. package/tests/tests/standard/Math/Numbers/Vector3.test.js +0 -291
  160. package/tests/tests/standard/Math/Numbers/Vector4.test.js +0 -309
  161. package/tests/tests/x_ite/Fields/SFDouble.test.js +0 -47
  162. package/tests/tests/x_ite/Fields/SFFloat.test.js +0 -47
  163. package/tests/tests/x_ite/Fields/SFInt32.test.js +0 -47
  164. package/tests/tests/x_ite/Fields/SFString.test.js +0 -47
  165. package/tests/tests/x_ite/Fields/SFTime.test.js +0 -47
@@ -1,197 +0,0 @@
1
- const
2
- X3D = require ("../../../X3D"),
3
- Rotation4 = X3D .require ("standard/Math/Numbers/Rotation4"),
4
- Matrix4 = X3D .require ("standard/Math/Numbers/Matrix4"),
5
- Vector3 = X3D .require ("standard/Math/Numbers/Vector3")
6
-
7
- test ("constructor", () =>
8
- {
9
- const r1 = new Rotation4 (1,2,3,4)
10
-
11
- expect (r1 .x) .toBe (1)
12
- expect (r1 .y) .toBe (2)
13
- expect (r1 .z) .toBe (3)
14
- expect (r1 .angle) .toBe (4)
15
- expect (r1 .length) .toBe (4)
16
- expect ([... r1]) .toEqual ([1,2,3,4])
17
-
18
- r1 .x = 5
19
- r1 .y = 6
20
- r1 .z = 7
21
- r1 .angle = 8
22
-
23
- expect (r1 .x) .toBe (5)
24
- expect (r1 .y) .toBe (6)
25
- expect (r1 .z) .toBe (7)
26
- expect (r1 .angle) .toBe (8)
27
- expect (r1 .length) .toBe (4)
28
- expect ([... r1]) .toEqual ([5,6,7,8])
29
- })
30
-
31
- test ("copy", () =>
32
- {
33
- const v1 = new Rotation4 (1,2,3,4)
34
-
35
- expect ([... v1 .copy ()]) .toEqual ([1,2,3,4])
36
- })
37
-
38
- test ("assign", () =>
39
- {
40
- const
41
- v1 = new Rotation4 (0, 0, 0, 0),
42
- v2 = new Rotation4 (1,2,3,4)
43
-
44
- expect ([... v1 .assign (v2)]) .toEqual ([1,2,3,4])
45
- })
46
-
47
- test ("set", () =>
48
- {
49
- const v1 = new Rotation4 (0, 0, 0, 0)
50
-
51
- expect ([... v1 .set (1,2,3,4)]) .toEqual ([1,2,3,4])
52
- })
53
-
54
- test ("equals", () =>
55
- {
56
- const
57
- a = new Rotation4 (1,2,3,4),
58
- b = new Rotation4 (1,2,3,4)
59
-
60
- expect (a .equals (b)) .toBe (true)
61
-
62
- for (let i = 0; i < a .length; ++ i)
63
- {
64
- const c = a .copy ()
65
-
66
- c [i] = 0
67
-
68
- expect (a .equals (c)) .toBe (false)
69
- }
70
- })
71
-
72
- test ("inverse", () =>
73
- {
74
- const
75
- r1 = new Rotation4 (2,3,4,5) .inverse (),
76
- r2 = r1 .copy () .inverse (),
77
- r3 = r2 .copy () .inverse ()
78
-
79
- expect (r1 [0]) .toBe (-r2 [0])
80
- expect (r1 [1]) .toBe (-r2 [1])
81
- expect (r1 [2]) .toBe (-r2 [2])
82
- expect (r1 [3]) .toBe (r2 [3])
83
-
84
- expect (r1 [0]) .not .toBe (r2 [0])
85
- expect (r1 [1]) .not .toBe (r2 [1])
86
- expect (r1 [2]) .not .toBe (r2 [2])
87
- expect (r1 [3]) .toBe (r2 [3])
88
-
89
- expect (r1 [0]) .toBe (r3 [0])
90
- expect (r1 [1]) .toBe (r3 [1])
91
- expect (r1 [2]) .toBe (r3 [2])
92
- expect (r1 [3]) .toBe (r3 [3])
93
- })
94
-
95
- test ("multVecRot", () =>
96
- {
97
- const
98
- r1 = new Rotation4 (0,0,1, Math.PI / 4),
99
- v1 = r1 .multVecRot (new Vector3 (1, 0, 0)),
100
- m1 = new Matrix4 () .rotate (r1),
101
- w1 = m1 .multVecMatrix (new Vector3 (1, 0, 0))
102
-
103
- expect (v1 [0]) .toBeCloseTo (Math .SQRT1_2)
104
- expect (v1 [1]) .toBeCloseTo (Math .SQRT1_2)
105
- expect (v1 [2]) .toBeCloseTo (0)
106
- expect (v1 [0]) .toBeCloseTo (w1 [0])
107
- expect (v1 [1]) .toBeCloseTo (w1 [1])
108
- expect (v1 [2]) .toBeCloseTo (w1 [2])
109
-
110
- const
111
- r2 = new Rotation4 (0,1,0, Math.PI / 4),
112
- v2 = r2 .multVecRot (new Vector3 (1, 0, 0)),
113
- m2 = new Matrix4 () .rotate (r2),
114
- w2 = m2 .multVecMatrix (new Vector3 (1, 0, 0))
115
-
116
- expect (v2 [0]) .toBeCloseTo (Math .SQRT1_2)
117
- expect (v2 [1]) .toBeCloseTo (0)
118
- expect (v2 [2]) .toBeCloseTo (-Math .SQRT1_2)
119
- expect (v2 [0]) .toBeCloseTo (w2 [0])
120
- expect (v2 [1]) .toBeCloseTo (w2 [1])
121
- expect (v2 [2]) .toBeCloseTo (w2 [2])
122
-
123
- const
124
- r3 = new Rotation4 (1,0,0, Math.PI / 4),
125
- v3 = r3 .multVecRot (new Vector3 (0, 0, 1)),
126
- m3 = new Matrix4 () .rotate (r3),
127
- w3 = m3 .multVecMatrix (new Vector3 (0, 0, 1))
128
-
129
- expect (v3 [0]) .toBeCloseTo (0)
130
- expect (v3 [1]) .toBeCloseTo (-Math .SQRT1_2)
131
- expect (v3 [2]) .toBeCloseTo (Math .SQRT1_2)
132
- expect (v3 [0]) .toBeCloseTo (w3 [0])
133
- expect (v3 [1]) .toBeCloseTo (w3 [1])
134
- expect (v3 [2]) .toBeCloseTo (w3 [2])
135
-
136
- const
137
- r4 = new Rotation4 (1,2,3,4),
138
- v4 = r4 .multVecRot (new Vector3 (2,3,4)),
139
- m4 = new Matrix4 () .rotate (r4),
140
- w4 = m4 .multVecMatrix (new Vector3 (2,3,4))
141
-
142
- expect (v4 [0]) .toBeCloseTo (w4 [0])
143
- expect (v4 [1]) .toBeCloseTo (w4 [1])
144
- expect (v4 [2]) .toBeCloseTo (w4 [2])
145
- })
146
-
147
- test ("multRotVec", () =>
148
- {
149
- const
150
- r1 = new Rotation4 (0,0,1, Math.PI / 4),
151
- v1 = r1 .multRotVec (new Vector3 (1, 0, 0)),
152
- m1 = new Matrix4 () .rotate (r1),
153
- w1 = m1 .multMatrixVec (new Vector3 (1, 0, 0))
154
-
155
- expect (v1 [0]) .toBeCloseTo (Math .SQRT1_2)
156
- expect (v1 [1]) .toBeCloseTo (-Math .SQRT1_2)
157
- expect (v1 [2]) .toBeCloseTo (0)
158
- expect (v1 [0]) .toBeCloseTo (w1 [0])
159
- expect (v1 [1]) .toBeCloseTo (w1 [1])
160
- expect (v1 [2]) .toBeCloseTo (w1 [2])
161
-
162
- const
163
- r2 = new Rotation4 (0,1,0, Math.PI / 4),
164
- v2 = r2 .multRotVec (new Vector3 (1, 0, 0)),
165
- m2 = new Matrix4 () .rotate (r2),
166
- w2 = m2 .multMatrixVec (new Vector3 (1, 0, 0))
167
-
168
- expect (v2 [0]) .toBeCloseTo (Math .SQRT1_2)
169
- expect (v2 [1]) .toBeCloseTo (0)
170
- expect (v2 [2]) .toBeCloseTo (Math .SQRT1_2)
171
- expect (v2 [0]) .toBeCloseTo (w2 [0])
172
- expect (v2 [1]) .toBeCloseTo (w2 [1])
173
- expect (v2 [2]) .toBeCloseTo (w2 [2])
174
-
175
- const
176
- r3 = new Rotation4 (1,0,0, Math.PI / 4),
177
- v3 = r3 .multRotVec (new Vector3 (0, 0, 1)),
178
- m3 = new Matrix4 () .rotate (r3),
179
- w3 = m3 .multMatrixVec (new Vector3 (0, 0, 1))
180
-
181
- expect (v3 [0]) .toBeCloseTo (0)
182
- expect (v3 [1]) .toBeCloseTo (Math .SQRT1_2)
183
- expect (v3 [2]) .toBeCloseTo (Math .SQRT1_2)
184
- expect (v3 [0]) .toBeCloseTo (w3 [0])
185
- expect (v3 [1]) .toBeCloseTo (w3 [1])
186
- expect (v3 [2]) .toBeCloseTo (w3 [2])
187
-
188
- const
189
- r4 = new Rotation4 (1,2,3,4),
190
- v4 = r4 .multRotVec (new Vector3 (2,3,4)),
191
- m4 = new Matrix4 () .rotate (r4),
192
- w4 = m4 .multMatrixVec (new Vector3 (2,3,4))
193
-
194
- expect (v4 [0]) .toBeCloseTo (w4 [0])
195
- expect (v4 [1]) .toBeCloseTo (w4 [1])
196
- expect (v4 [2]) .toBeCloseTo (w4 [2])
197
- })
@@ -1,259 +0,0 @@
1
- const
2
- X3D = require ("../../../X3D"),
3
- Vector2 = X3D .require ("standard/Math/Numbers/Vector2")
4
-
5
- test ("constructor", () =>
6
- {
7
- const v1 = new Vector2 (0, 0)
8
-
9
- expect (v1) .toEqual ({ x:0, y:0 })
10
- expect (v1 [0]) .toBe (0)
11
- expect (v1 [1]) .toBe (0)
12
- expect (v1 .x) .toBe (0)
13
- expect (v1 .y) .toBe (0)
14
- expect ([... v1]) .toEqual ([ 0, 0 ])
15
- expect (v1 .length) .toBe (2)
16
-
17
- const v2 = new Vector2 (2, 3)
18
-
19
- expect (v2) .toEqual ({ x:2, y:3 })
20
- expect (v2 [0]) .toBe (2)
21
- expect (v2 [1]) .toBe (3)
22
- expect (v2 .x) .toBe (2)
23
- expect (v2 .y) .toBe (3)
24
- expect ([... v2]) .toEqual ([ 2, 3 ])
25
- expect (v2 .length) .toBe (2)
26
- })
27
-
28
- test ("copy", () =>
29
- {
30
- const v1 = new Vector2 (2, 3)
31
-
32
- expect (v1 .copy ()) .toEqual ({ x:2, y:3 })
33
- })
34
-
35
- test ("assign", () =>
36
- {
37
- const
38
- v1 = new Vector2 (0, 0),
39
- v2 = new Vector2 (2, 3)
40
-
41
- expect (v1 .assign (v2)) .toEqual ({ x:2, y:3 })
42
- })
43
-
44
- test ("set", () =>
45
- {
46
- const v1 = new Vector2 (0, 0)
47
-
48
- expect (v1 .set (2, 3, 4, 5)) .toEqual ({ x:2, y:3 })
49
- })
50
-
51
- test ("negate", () =>
52
- {
53
- const v1 = new Vector2 (2, 3)
54
-
55
- v1 .negate ()
56
-
57
- expect (v1 [0]) .toBe (-2)
58
- expect (v1 [1]) .toBe (-3)
59
-
60
- const v2 = new Vector2 (-2, -3)
61
-
62
- v2 .negate ()
63
-
64
- expect (v2 [0]) .toBe (2)
65
- expect (v2 [1]) .toBe (3)
66
- })
67
-
68
- test ("inverse", () =>
69
- {
70
- const v1 = new Vector2 (2, 3)
71
-
72
- v1 .inverse ()
73
-
74
- expect (v1 [0]) .toBeCloseTo (1 / 2)
75
- expect (v1 [1]) .toBeCloseTo (1 / 3)
76
- })
77
-
78
- test ("add", () =>
79
- {
80
- const
81
- v1 = new Vector2 (2, 3),
82
- v2 = new Vector2 (6, 7)
83
-
84
- v1 .add (v2)
85
-
86
- expect (v1 [0]) .toBe (2 + 6)
87
- expect (v1 [1]) .toBe (3 + 7)
88
- })
89
-
90
- test ("subtract", () =>
91
- {
92
- const
93
- v1 = new Vector2 (2, 3),
94
- v2 = new Vector2 (6, 7)
95
-
96
- v1 .subtract (v2)
97
-
98
- expect (v1 [0]) .toBe (2 - 6)
99
- expect (v1 [1]) .toBe (3 - 7)
100
- })
101
-
102
- test ("multiply", () =>
103
- {
104
- const v1 = new Vector2 (2, 3)
105
-
106
- v1 .multiply (6)
107
-
108
- expect (v1 [0]) .toBe (2 * 6)
109
- expect (v1 [1]) .toBe (3 * 6)
110
- })
111
-
112
- test ("multVec", () =>
113
- {
114
- const
115
- v1 = new Vector2 (2, 3),
116
- v2 = new Vector2 (6, 7)
117
-
118
- v1 .multVec (v2)
119
-
120
- expect (v1 [0]) .toBe (2 * 6)
121
- expect (v1 [1]) .toBe (3 * 7)
122
- })
123
-
124
- test ("divide", () =>
125
- {
126
- const v1 = new Vector2 (2, 3)
127
-
128
- v1 .divide (6)
129
-
130
- expect (v1 [0]) .toBeCloseTo (2 / 6)
131
- expect (v1 [1]) .toBeCloseTo (3 / 6)
132
- })
133
-
134
- test ("divVec", () =>
135
- {
136
- const
137
- v1 = new Vector2 (2, 3),
138
- v2 = new Vector2 (6, 7)
139
-
140
- v1 .divVec (v2)
141
-
142
- expect (v1 [0]) .toBeCloseTo (2 / 6)
143
- expect (v1 [1]) .toBeCloseTo (3 / 7)
144
- })
145
-
146
- test ("normalize", () =>
147
- {
148
- const
149
- v1 = new Vector2 (2, 3),
150
- l = Math .hypot (2, 3)
151
-
152
- v1 .normalize ()
153
-
154
- expect (v1 [0]) .toBeCloseTo (2 / l)
155
- expect (v1 [1]) .toBeCloseTo (3 / l)
156
- })
157
-
158
- test ("dot", () =>
159
- {
160
- const
161
- v1 = new Vector2 (2, 3),
162
- v2 = new Vector2 (6, 7)
163
-
164
- expect (v1 .dot (v2)) .toBe (2 * 6 + 3 * 7)
165
- })
166
-
167
- test ("norm", () =>
168
- {
169
- const v1 = new Vector2 (2, 3)
170
-
171
- expect (v1 .norm ()) .toBe (2 * 2 + 3 * 3)
172
- })
173
-
174
- test ("magnitude", () =>
175
- {
176
- const v1 = new Vector2 (2, 3)
177
-
178
- expect (v1 .magnitude ()) .toBeCloseTo (Math .hypot (2, 3))
179
- })
180
-
181
- test ("distance", () =>
182
- {
183
- const
184
- v1 = new Vector2 (2, 3),
185
- v2 = new Vector2 (6, 7)
186
-
187
- expect (v1 .distance (v2)) .toBeCloseTo (Math .hypot (2 - 6, 3 - 7))
188
- })
189
-
190
- test ("lerp", () =>
191
- {
192
- const
193
- v1 = new Vector2 (2, 3),
194
- v2 = new Vector2 (6, 7)
195
-
196
- v1 .lerp (v2, 0.5)
197
-
198
- expect (v1 [0]) .toBeCloseTo ((2 + 6) / 2)
199
- expect (v1 [1]) .toBeCloseTo ((3 + 7) / 2)
200
- })
201
-
202
- test ("abs", () =>
203
- {
204
- const v1 = new Vector2 (2, 3)
205
-
206
- v1 .abs ()
207
-
208
- expect (v1 [0]) .toBe (2)
209
- expect (v1 [1]) .toBe (3)
210
-
211
- const v2 = new Vector2 (-2, -3)
212
-
213
- v2 .abs ()
214
-
215
- expect (v2 [0]) .toBe (2)
216
- expect (v2 [1]) .toBe (3)
217
- })
218
-
219
- test ("min", () =>
220
- {
221
- const
222
- v1 = new Vector2 (2, 3),
223
- v2 = new Vector2 (6, 7)
224
-
225
- v1 .min (v2)
226
-
227
- expect (v1 [0]) .toBe (2)
228
- expect (v1 [1]) .toBe (3)
229
- })
230
-
231
- test ("max", () =>
232
- {
233
- const
234
- v1 = new Vector2 (2, 3),
235
- v2 = new Vector2 (6, 7)
236
-
237
- v1 .max (v2)
238
-
239
- expect (v1 [0]) .toBe (6)
240
- expect (v1 [1]) .toBe (7)
241
- })
242
-
243
- test ("equals", () =>
244
- {
245
- const
246
- a = new Vector2 (2,3),
247
- b = new Vector2 (2,3)
248
-
249
- expect (a .equals (b)) .toBe (true)
250
-
251
- for (let i = 0; i < a .length; ++ i)
252
- {
253
- const c = a .copy ()
254
-
255
- c [i] = 0
256
-
257
- expect (a .equals (c)) .toBe (false)
258
- }
259
- })