@kitware/vtk.js 28.10.2 → 28.11.1

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 (566) hide show
  1. package/Common/Core/Base64.js +53 -82
  2. package/Common/Core/CellArray.js +52 -60
  3. package/Common/Core/ClassHierarchy.js +8 -36
  4. package/Common/Core/DataArray/Constants.js +6 -6
  5. package/Common/Core/DataArray.js +193 -277
  6. package/Common/Core/Endian.js +14 -17
  7. package/Common/Core/HalfFloat.js +17 -34
  8. package/Common/Core/ImageHelper.js +17 -25
  9. package/Common/Core/LookupTable.js +131 -144
  10. package/Common/Core/Math/Constants.js +8 -8
  11. package/Common/Core/Math/index.js +754 -942
  12. package/Common/Core/Math.js +2 -4
  13. package/Common/Core/MatrixBuilder.js +99 -151
  14. package/Common/Core/Points.js +43 -43
  15. package/Common/Core/PriorityQueue.js +30 -28
  16. package/Common/Core/ProgressHandler.js +31 -32
  17. package/Common/Core/ScalarsToColors/Constants.js +4 -4
  18. package/Common/Core/ScalarsToColors.js +196 -253
  19. package/Common/Core/StringArray.js +48 -73
  20. package/Common/Core/URLExtract.js +10 -29
  21. package/Common/Core/VariantArray.js +48 -73
  22. package/Common/Core.js +11 -11
  23. package/Common/DataModel/AbstractPointLocator.js +19 -17
  24. package/Common/DataModel/BoundingBox.js +322 -490
  25. package/Common/DataModel/Box.js +46 -63
  26. package/Common/DataModel/CardinalSpline1D.js +92 -102
  27. package/Common/DataModel/Cell.js +41 -61
  28. package/Common/DataModel/CellLinks.js +91 -127
  29. package/Common/DataModel/CellTypes/Constants.js +7 -6
  30. package/Common/DataModel/CellTypes.js +55 -74
  31. package/Common/DataModel/Collection.js +45 -61
  32. package/Common/DataModel/Cone.js +28 -20
  33. package/Common/DataModel/Cylinder.js +41 -35
  34. package/Common/DataModel/DataSet/Constants.js +11 -5
  35. package/Common/DataModel/DataSet.js +37 -25
  36. package/Common/DataModel/DataSetAttributes/Constants.js +18 -18
  37. package/Common/DataModel/DataSetAttributes/FieldData.js +103 -194
  38. package/Common/DataModel/DataSetAttributes.js +96 -138
  39. package/Common/DataModel/EdgeLocator.js +45 -70
  40. package/Common/DataModel/ITKHelper.js +67 -137
  41. package/Common/DataModel/ImageData.js +115 -172
  42. package/Common/DataModel/ImplicitBoolean/Constants.js +2 -2
  43. package/Common/DataModel/ImplicitBoolean.js +66 -96
  44. package/Common/DataModel/IncrementalOctreeNode.js +201 -231
  45. package/Common/DataModel/IncrementalOctreePointLocator.js +160 -198
  46. package/Common/DataModel/KochanekSpline1D.js +78 -81
  47. package/Common/DataModel/Line/Constants.js +2 -2
  48. package/Common/DataModel/Line.js +82 -105
  49. package/Common/DataModel/Locator.js +17 -10
  50. package/Common/DataModel/Molecule.js +26 -17
  51. package/Common/DataModel/PiecewiseFunction.js +218 -239
  52. package/Common/DataModel/Plane.js +90 -113
  53. package/Common/DataModel/PointSet.js +30 -26
  54. package/Common/DataModel/PolyData/Constants.js +2 -2
  55. package/Common/DataModel/PolyData.js +95 -120
  56. package/Common/DataModel/PolyLine.js +44 -61
  57. package/Common/DataModel/Polygon/Constants.js +4 -4
  58. package/Common/DataModel/Polygon.js +128 -169
  59. package/Common/DataModel/Quad/Constants.js +2 -2
  60. package/Common/DataModel/Quad.js +61 -100
  61. package/Common/DataModel/SelectionNode/Constants.js +5 -4
  62. package/Common/DataModel/SelectionNode.js +25 -21
  63. package/Common/DataModel/Sphere.js +40 -35
  64. package/Common/DataModel/Spline1D/Constants.js +3 -2
  65. package/Common/DataModel/Spline1D.js +34 -18
  66. package/Common/DataModel/Spline3D/Constants.js +2 -2
  67. package/Common/DataModel/Spline3D.js +46 -41
  68. package/Common/DataModel/StructuredData/Constants.js +2 -2
  69. package/Common/DataModel/StructuredData.js +9 -20
  70. package/Common/DataModel/Triangle.js +207 -250
  71. package/Common/DataModel.js +19 -19
  72. package/Common/System/MobileVR.js +56 -61
  73. package/Common/System/TimerLog.js +1 -1
  74. package/Common/System.js +2 -2
  75. package/Common/Transform/LandmarkTransform/Constants.js +2 -2
  76. package/Common/Transform/LandmarkTransform.js +133 -117
  77. package/Common/Transform/Transform.js +42 -57
  78. package/Common/Transform.js +2 -2
  79. package/Common/index.js +4 -4
  80. package/Filters/Core/Cutter.js +134 -146
  81. package/Filters/Core/PolyDataNormals.js +44 -50
  82. package/Filters/Core.js +2 -2
  83. package/Filters/Cornerstone/ImageDataToCornerstoneImage.js +45 -33
  84. package/Filters/Cornerstone.js +1 -1
  85. package/Filters/General/AppendPolyData.js +84 -100
  86. package/Filters/General/Calculator.js +95 -163
  87. package/Filters/General/ClipClosedSurface/Constants.js +2 -2
  88. package/Filters/General/ClipClosedSurface.js +341 -416
  89. package/Filters/General/ClosedPolyLineToSurfaceFilter.js +141 -156
  90. package/Filters/General/ContourTriangulator/Constants.js +2 -2
  91. package/Filters/General/ContourTriangulator/helper.js +684 -812
  92. package/Filters/General/ContourTriangulator.js +92 -89
  93. package/Filters/General/ImageCropFilter.js +77 -78
  94. package/Filters/General/ImageDataOutlineFilter.js +42 -36
  95. package/Filters/General/ImageMarchingCubes/caseTable.js +9 -521
  96. package/Filters/General/ImageMarchingCubes.js +99 -112
  97. package/Filters/General/ImageMarchingSquares/caseTable.js +9 -41
  98. package/Filters/General/ImageMarchingSquares.js +93 -118
  99. package/Filters/General/ImageOutlineFilter.js +53 -54
  100. package/Filters/General/ImageSliceFilter.js +39 -30
  101. package/Filters/General/ImageStreamline.js +107 -124
  102. package/Filters/General/LineFilter.js +26 -15
  103. package/Filters/General/MoleculeToRepresentation.js +136 -149
  104. package/Filters/General/OBBTree/OBBNode.js +36 -34
  105. package/Filters/General/OBBTree/helper.js +19 -24
  106. package/Filters/General/OBBTree.js +396 -488
  107. package/Filters/General/OutlineFilter.js +52 -34
  108. package/Filters/General/PaintFilter/PaintFilter.worker.js +93 -130
  109. package/Filters/General/PaintFilter.js +150 -162
  110. package/Filters/General/ScalarToRGBA.js +38 -33
  111. package/Filters/General/TriangleFilter.js +65 -62
  112. package/Filters/General/TubeFilter/Constants.js +4 -4
  113. package/Filters/General/TubeFilter.js +376 -496
  114. package/Filters/General/WarpScalar.js +58 -60
  115. package/Filters/General/WindowedSincPolyDataFilter.js +258 -330
  116. package/Filters/General.js +21 -21
  117. package/Filters/Sources/Arrow2DSource/Constants.js +2 -2
  118. package/Filters/Sources/Arrow2DSource.js +56 -56
  119. package/Filters/Sources/ArrowSource.js +39 -29
  120. package/Filters/Sources/CircleSource.js +43 -43
  121. package/Filters/Sources/ConcentricCylinderSource.js +151 -174
  122. package/Filters/Sources/ConeSource.js +51 -42
  123. package/Filters/Sources/CubeSource.js +75 -96
  124. package/Filters/Sources/Cursor3D.js +94 -109
  125. package/Filters/Sources/CylinderSource.js +90 -90
  126. package/Filters/Sources/ImageGridSource.js +43 -43
  127. package/Filters/Sources/LineSource.js +49 -39
  128. package/Filters/Sources/PlaneSource.js +97 -104
  129. package/Filters/Sources/PointSource.js +46 -37
  130. package/Filters/Sources/RTAnalyticSource.js +50 -48
  131. package/Filters/Sources/SLICSource.js +63 -73
  132. package/Filters/Sources/SphereSource.js +88 -78
  133. package/Filters/Sources/ViewFinderSource.js +26 -23
  134. package/Filters/Sources.js +14 -14
  135. package/Filters/Texture/TextureMapToPlane.js +95 -97
  136. package/Filters/Texture/TextureMapToSphere.js +46 -54
  137. package/Filters/Texture.js +2 -2
  138. package/Filters/index.js +5 -5
  139. package/IO/Core/BinaryHelper.js +12 -18
  140. package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +43 -59
  141. package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +76 -113
  142. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +62 -112
  143. package/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.js +76 -113
  144. package/IO/Core/DataAccessHelper.js +6 -6
  145. package/IO/Core/HttpDataSetReader.js +136 -139
  146. package/IO/Core/HttpDataSetSeriesReader.js +64 -75
  147. package/IO/Core/HttpSceneLoader.js +130 -179
  148. package/IO/Core/ImageStream/DefaultProtocol.js +29 -43
  149. package/IO/Core/ImageStream/ViewStream.js +100 -103
  150. package/IO/Core/ImageStream.js +62 -54
  151. package/IO/Core/ResourceLoader.js +10 -9
  152. package/IO/Core/Serializer/ArraySerializer.js +40 -40
  153. package/IO/Core/Serializer/FieldDataSerializer.js +18 -28
  154. package/IO/Core/Serializer/ImageDataSerializer.js +22 -23
  155. package/IO/Core/Serializer/PolyDataSerializer.js +17 -21
  156. package/IO/Core/Serializer.js +6 -13
  157. package/IO/Core/WSLinkClient.js +90 -76
  158. package/IO/Core/ZipMultiDataSetReader.js +46 -44
  159. package/IO/Core/ZipMultiDataSetWriter.js +43 -34
  160. package/IO/Core.js +7 -7
  161. package/IO/Geometry/DracoReader.js +118 -121
  162. package/IO/Geometry/PLYReader.js +163 -223
  163. package/IO/Geometry/PLYWriter/Constants.js +5 -5
  164. package/IO/Geometry/PLYWriter.js +139 -154
  165. package/IO/Geometry/STLReader.js +123 -146
  166. package/IO/Geometry/STLWriter/Constants.js +2 -2
  167. package/IO/Geometry/STLWriter.js +83 -82
  168. package/IO/Geometry.js +5 -5
  169. package/IO/Legacy/LegacyAsciiParser.js +78 -139
  170. package/IO/Legacy/PolyDataReader.js +48 -36
  171. package/IO/Legacy.js +2 -2
  172. package/IO/Misc/ElevationReader.js +67 -60
  173. package/IO/Misc/HttpDataSetLODsLoader.js +41 -38
  174. package/IO/Misc/ITKImageReader.js +58 -45
  175. package/IO/Misc/ITKPolyDataReader.js +50 -38
  176. package/IO/Misc/JSONNucleoReader.js +49 -42
  177. package/IO/Misc/JSONReader.js +38 -33
  178. package/IO/Misc/MTLReader.js +74 -119
  179. package/IO/Misc/OBJReader.js +153 -206
  180. package/IO/Misc/PDBReader.js +70 -68
  181. package/IO/Misc/SkyboxReader.js +77 -82
  182. package/IO/Misc.js +9 -9
  183. package/IO/XML/XMLImageDataReader.js +36 -38
  184. package/IO/XML/XMLImageDataWriter.js +28 -21
  185. package/IO/XML/XMLPolyDataReader.js +49 -46
  186. package/IO/XML/XMLPolyDataWriter.js +43 -42
  187. package/IO/XML/XMLReader.js +262 -304
  188. package/IO/XML/XMLWriter/Constants.js +3 -3
  189. package/IO/XML/XMLWriter.js +70 -84
  190. package/IO/XML.js +6 -6
  191. package/IO/index.js +5 -5
  192. package/Imaging/Core/AbstractImageInterpolator/Constants.js +4 -4
  193. package/Imaging/Core/AbstractImageInterpolator/InterpolationInfo.js +30 -27
  194. package/Imaging/Core/AbstractImageInterpolator.js +74 -87
  195. package/Imaging/Core/ImageInterpolator.js +201 -252
  196. package/Imaging/Core/ImagePointDataIterator.js +96 -122
  197. package/Imaging/Core/ImageReslice/Constants.js +2 -2
  198. package/Imaging/Core/ImageReslice.js +327 -464
  199. package/Imaging/Core.js +4 -4
  200. package/Imaging/Hybrid/SampleFunction.js +58 -51
  201. package/Imaging/Hybrid.js +1 -1
  202. package/Imaging/index.js +2 -2
  203. package/Interaction/Animations/TimeStepBasedAnimationHandler.js +39 -54
  204. package/Interaction/Manipulators/CompositeCameraManipulator.js +22 -13
  205. package/Interaction/Manipulators/CompositeGestureManipulator.js +31 -43
  206. package/Interaction/Manipulators/CompositeKeyboardManipulator.js +15 -11
  207. package/Interaction/Manipulators/CompositeMouseManipulator.js +27 -33
  208. package/Interaction/Manipulators/CompositeVRManipulator.js +22 -15
  209. package/Interaction/Manipulators/GestureCameraManipulator.js +54 -36
  210. package/Interaction/Manipulators/KeyboardCameraManipulator.js +95 -97
  211. package/Interaction/Manipulators/MouseBoxSelectorManipulator.js +70 -89
  212. package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +67 -54
  213. package/Interaction/Manipulators/MouseCameraSliceManipulator.js +40 -38
  214. package/Interaction/Manipulators/MouseCameraTrackballFirstPersonManipulator.js +83 -68
  215. package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.js +32 -28
  216. package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +47 -40
  217. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +55 -43
  218. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +56 -46
  219. package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.js +41 -46
  220. package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.js +29 -27
  221. package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +123 -146
  222. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +144 -166
  223. package/Interaction/Manipulators/MouseRangeManipulator.js +127 -132
  224. package/Interaction/Manipulators/VRButtonPanManipulator.js +33 -23
  225. package/Interaction/Manipulators.js +21 -21
  226. package/Interaction/Misc/DeviceOrientationToCamera.js +25 -47
  227. package/Interaction/Misc.js +1 -1
  228. package/Interaction/Style/InteractorStyleImage.js +101 -121
  229. package/Interaction/Style/InteractorStyleMPRSlice.js +111 -128
  230. package/Interaction/Style/InteractorStyleManipulator/Presets.js +9 -17
  231. package/Interaction/Style/InteractorStyleManipulator.js +254 -329
  232. package/Interaction/Style/InteractorStyleRemoteMouse.js +195 -180
  233. package/Interaction/Style/InteractorStyleTrackballCamera.js +154 -157
  234. package/Interaction/Style/InteractorStyleUnicam.js +30 -38
  235. package/Interaction/Style.js +5 -5
  236. package/Interaction/UI/CornerAnnotation/CornerAnnotation.module.css.js +1 -1
  237. package/Interaction/UI/CornerAnnotation.js +65 -48
  238. package/Interaction/UI/FPSMonitor.js +104 -105
  239. package/Interaction/UI/Icons.js +1 -1
  240. package/Interaction/UI/Slider/Constants.js +2 -2
  241. package/Interaction/UI/Slider.js +78 -95
  242. package/Interaction/UI/VolumeController.js +104 -97
  243. package/Interaction/UI.js +5 -5
  244. package/Interaction/Widgets/OrientationMarkerWidget/Constants.js +2 -2
  245. package/Interaction/Widgets/OrientationMarkerWidget.js +90 -135
  246. package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +0 -3
  247. package/Interaction/Widgets/PiecewiseGaussianWidget.js +381 -498
  248. package/Interaction/Widgets.js +2 -2
  249. package/Interaction/index.js +5 -5
  250. package/Proxy/Animation/AbstractAnimationProxy.js +22 -15
  251. package/Proxy/Animation/AnimationProxyManager.js +43 -51
  252. package/Proxy/Animation/TimeStepBasedAnimationHandlerProxy.js +26 -19
  253. package/Proxy/Core/AbstractRepresentationProxy.js +97 -151
  254. package/Proxy/Core/LookupTableProxy/Constants.js +4 -4
  255. package/Proxy/Core/LookupTableProxy.js +49 -52
  256. package/Proxy/Core/PiecewiseFunctionProxy/Constants.js +4 -4
  257. package/Proxy/Core/PiecewiseFunctionProxy.js +63 -72
  258. package/Proxy/Core/ProxyManager/core.js +83 -106
  259. package/Proxy/Core/ProxyManager/properties.js +53 -76
  260. package/Proxy/Core/ProxyManager/state.js +100 -110
  261. package/Proxy/Core/ProxyManager/view.js +45 -55
  262. package/Proxy/Core/ProxyManager.js +16 -8
  263. package/Proxy/Core/SourceProxy.js +41 -38
  264. package/Proxy/Core/View2DProxy.js +143 -199
  265. package/Proxy/Core/ViewProxy.js +223 -269
  266. package/Proxy/Core.js +7 -7
  267. package/Proxy/Representations/GeometryRepresentationProxy.js +34 -20
  268. package/Proxy/Representations/GlyphRepresentationProxy.js +42 -41
  269. package/Proxy/Representations/MoleculeRepresentationProxy.js +32 -22
  270. package/Proxy/Representations/ResliceRepresentationProxy.js +48 -32
  271. package/Proxy/Representations/SkyboxRepresentationProxy.js +30 -29
  272. package/Proxy/Representations/SliceRepresentationProxy.js +93 -112
  273. package/Proxy/Representations/SlicedGeometryRepresentationProxy.js +46 -42
  274. package/Proxy/Representations/VolumeRepresentationProxy.js +108 -133
  275. package/Proxy/Representations.js +7 -7
  276. package/Proxy/index.js +2 -2
  277. package/README.md +1 -1
  278. package/Rendering/Core/AbstractImageMapper/helper.js +44 -49
  279. package/Rendering/Core/AbstractImageMapper.js +18 -19
  280. package/Rendering/Core/AbstractMapper.js +39 -55
  281. package/Rendering/Core/AbstractMapper3D.js +26 -31
  282. package/Rendering/Core/AbstractPicker.js +25 -21
  283. package/Rendering/Core/Actor.js +71 -93
  284. package/Rendering/Core/Actor2D.js +64 -78
  285. package/Rendering/Core/AnnotatedCubeActor/Presets.js +5 -11
  286. package/Rendering/Core/AnnotatedCubeActor.js +94 -79
  287. package/Rendering/Core/AxesActor.js +65 -87
  288. package/Rendering/Core/Camera.js +246 -271
  289. package/Rendering/Core/CellPicker.js +125 -148
  290. package/Rendering/Core/ColorTransferFunction/ColorMaps.js +20 -21
  291. package/Rendering/Core/ColorTransferFunction/ColorMapsLite.js +20 -21
  292. package/Rendering/Core/ColorTransferFunction/Constants.js +4 -4
  293. package/Rendering/Core/ColorTransferFunction.js +460 -546
  294. package/Rendering/Core/Coordinate/Constants.js +2 -2
  295. package/Rendering/Core/Coordinate.js +119 -198
  296. package/Rendering/Core/CubeAxesActor.js +294 -320
  297. package/Rendering/Core/Follower.js +46 -45
  298. package/Rendering/Core/Glyph3DMapper/Constants.js +4 -4
  299. package/Rendering/Core/Glyph3DMapper.js +96 -148
  300. package/Rendering/Core/HardwareSelector.js +36 -69
  301. package/Rendering/Core/ImageArrayMapper.js +87 -126
  302. package/Rendering/Core/ImageCPRMapper.js +134 -209
  303. package/Rendering/Core/ImageMapper/Constants.js +2 -2
  304. package/Rendering/Core/ImageMapper.js +85 -144
  305. package/Rendering/Core/ImageProperty/Constants.js +2 -2
  306. package/Rendering/Core/ImageProperty.js +66 -81
  307. package/Rendering/Core/ImageResliceMapper/Constants.js +2 -2
  308. package/Rendering/Core/ImageResliceMapper.js +36 -29
  309. package/Rendering/Core/ImageSlice.js +85 -127
  310. package/Rendering/Core/InteractorObserver.js +82 -73
  311. package/Rendering/Core/InteractorStyle/Constants.js +2 -2
  312. package/Rendering/Core/InteractorStyle.js +56 -58
  313. package/Rendering/Core/Light.js +43 -49
  314. package/Rendering/Core/Mapper/CoincidentTopologyHelper.js +37 -48
  315. package/Rendering/Core/Mapper/Constants.js +6 -6
  316. package/Rendering/Core/Mapper/Static.js +15 -12
  317. package/Rendering/Core/Mapper.js +194 -259
  318. package/Rendering/Core/Mapper2D.js +61 -100
  319. package/Rendering/Core/Picker.js +124 -143
  320. package/Rendering/Core/PixelSpaceCallbackMapper.js +40 -37
  321. package/Rendering/Core/PointPicker.js +68 -79
  322. package/Rendering/Core/Prop/Constants.js +2 -2
  323. package/Rendering/Core/Prop.js +58 -106
  324. package/Rendering/Core/Prop3D.js +54 -83
  325. package/Rendering/Core/Property/Constants.js +6 -6
  326. package/Rendering/Core/Property.js +45 -74
  327. package/Rendering/Core/Property2D/Constants.js +2 -2
  328. package/Rendering/Core/Property2D.js +33 -42
  329. package/Rendering/Core/RenderWindow.js +70 -82
  330. package/Rendering/Core/RenderWindowInteractor/Constants.js +7 -7
  331. package/Rendering/Core/RenderWindowInteractor.js +324 -439
  332. package/Rendering/Core/Renderer.js +192 -256
  333. package/Rendering/Core/ScalarBarActor.js +267 -272
  334. package/Rendering/Core/Skybox.js +26 -24
  335. package/Rendering/Core/SphereMapper.js +22 -12
  336. package/Rendering/Core/StickMapper.js +22 -12
  337. package/Rendering/Core/SurfaceLICInterface/Constants.js +6 -6
  338. package/Rendering/Core/SurfaceLICInterface.js +13 -9
  339. package/Rendering/Core/SurfaceLICMapper.js +23 -15
  340. package/Rendering/Core/Texture.js +99 -141
  341. package/Rendering/Core/Viewport.js +60 -88
  342. package/Rendering/Core/Volume.js +55 -77
  343. package/Rendering/Core/VolumeMapper/Constants.js +4 -4
  344. package/Rendering/Core/VolumeMapper.js +59 -91
  345. package/Rendering/Core/VolumeProperty/Constants.js +4 -4
  346. package/Rendering/Core/VolumeProperty.js +78 -115
  347. package/Rendering/Core.js +47 -49
  348. package/Rendering/Misc/CanvasView.js +62 -61
  349. package/Rendering/Misc/FullScreenRenderWindow.js +60 -62
  350. package/Rendering/Misc/GenericRenderWindow.js +48 -37
  351. package/Rendering/Misc/RemoteView.js +86 -80
  352. package/Rendering/Misc/RenderWindowWithControlBar.js +54 -48
  353. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +43 -51
  354. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +52 -82
  355. package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +258 -308
  356. package/Rendering/Misc/SynchronizableRenderWindow.js +133 -163
  357. package/Rendering/Misc/TextureLODsDownloader.js +72 -74
  358. package/Rendering/Misc.js +7 -7
  359. package/Rendering/OpenGL/Actor.js +57 -68
  360. package/Rendering/OpenGL/Actor2D.js +56 -56
  361. package/Rendering/OpenGL/BufferObject/Constants.js +2 -2
  362. package/Rendering/OpenGL/BufferObject.js +50 -65
  363. package/Rendering/OpenGL/Camera.js +35 -29
  364. package/Rendering/OpenGL/CellArrayBufferObject.js +119 -149
  365. package/Rendering/OpenGL/Convolution2DPass.js +87 -81
  366. package/Rendering/OpenGL/CubeAxesActor.js +28 -21
  367. package/Rendering/OpenGL/ForwardPass.js +53 -64
  368. package/Rendering/OpenGL/Framebuffer.js +61 -101
  369. package/Rendering/OpenGL/Glyph3DMapper.js +165 -196
  370. package/Rendering/OpenGL/HardwareSelector/Constants.js +2 -2
  371. package/Rendering/OpenGL/HardwareSelector.js +272 -397
  372. package/Rendering/OpenGL/Helper.js +58 -73
  373. package/Rendering/OpenGL/ImageCPRMapper.js +339 -421
  374. package/Rendering/OpenGL/ImageMapper.js +268 -361
  375. package/Rendering/OpenGL/ImageResliceMapper.js +306 -438
  376. package/Rendering/OpenGL/ImageSlice.js +48 -54
  377. package/Rendering/OpenGL/OrderIndependentTranslucentPass.js +102 -84
  378. package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +43 -42
  379. package/Rendering/OpenGL/PolyDataMapper.js +358 -492
  380. package/Rendering/OpenGL/PolyDataMapper2D.js +153 -205
  381. package/Rendering/OpenGL/RadialDistortionPass.js +86 -89
  382. package/Rendering/OpenGL/RenderWindow/Constants.js +2 -2
  383. package/Rendering/OpenGL/RenderWindow/ContextProxy.js +20 -29
  384. package/Rendering/OpenGL/RenderWindow.js +356 -510
  385. package/Rendering/OpenGL/Renderer.js +77 -89
  386. package/Rendering/OpenGL/ReplacementShaderMapper.js +28 -46
  387. package/Rendering/OpenGL/ScalarBarActor.js +28 -21
  388. package/Rendering/OpenGL/Shader.js +37 -31
  389. package/Rendering/OpenGL/ShaderCache.js +67 -74
  390. package/Rendering/OpenGL/ShaderProgram.js +136 -248
  391. package/Rendering/OpenGL/Skybox.js +99 -60
  392. package/Rendering/OpenGL/SphereMapper.js +94 -108
  393. package/Rendering/OpenGL/StickMapper.js +110 -114
  394. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +91 -157
  395. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +142 -151
  396. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +142 -216
  397. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +79 -100
  398. package/Rendering/OpenGL/SurfaceLIC.js +2 -2
  399. package/Rendering/OpenGL/Texture/Constants.js +4 -4
  400. package/Rendering/OpenGL/Texture.js +443 -608
  401. package/Rendering/OpenGL/TextureUnitManager.js +47 -43
  402. package/Rendering/OpenGL/VertexArrayObject.js +92 -131
  403. package/Rendering/OpenGL/ViewNodeFactory.js +25 -13
  404. package/Rendering/OpenGL/Volume.js +38 -34
  405. package/Rendering/OpenGL/VolumeMapper.js +437 -547
  406. package/Rendering/OpenGL.js +28 -28
  407. package/Rendering/SceneGraph/RenderPass.js +34 -31
  408. package/Rendering/SceneGraph/RenderWindowViewNode.js +68 -94
  409. package/Rendering/SceneGraph/ViewNode.js +82 -111
  410. package/Rendering/SceneGraph/ViewNodeFactory.js +31 -26
  411. package/Rendering/SceneGraph.js +4 -4
  412. package/Rendering/WebGPU/Actor.js +49 -49
  413. package/Rendering/WebGPU/Actor2D.js +45 -44
  414. package/Rendering/WebGPU/BindGroup.js +43 -50
  415. package/Rendering/WebGPU/Buffer.js +41 -50
  416. package/Rendering/WebGPU/BufferManager/Constants.js +4 -4
  417. package/Rendering/WebGPU/BufferManager.js +111 -141
  418. package/Rendering/WebGPU/Camera.js +65 -67
  419. package/Rendering/WebGPU/CellArrayMapper.js +621 -388
  420. package/Rendering/WebGPU/CubeAxesActor.js +28 -19
  421. package/Rendering/WebGPU/Device.js +78 -133
  422. package/Rendering/WebGPU/ForwardPass.js +75 -72
  423. package/Rendering/WebGPU/FullScreenQuad.js +25 -18
  424. package/Rendering/WebGPU/Glyph3DMapper.js +62 -74
  425. package/Rendering/WebGPU/HardwareSelectionPass.js +45 -38
  426. package/Rendering/WebGPU/HardwareSelector.js +200 -276
  427. package/Rendering/WebGPU/ImageMapper.js +180 -171
  428. package/Rendering/WebGPU/ImageSlice.js +45 -44
  429. package/Rendering/WebGPU/IndexBuffer.js +166 -200
  430. package/Rendering/WebGPU/OpaquePass.js +37 -36
  431. package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +72 -45
  432. package/Rendering/WebGPU/Pipeline.js +37 -51
  433. package/Rendering/WebGPU/PixelSpaceCallbackMapper.js +27 -19
  434. package/Rendering/WebGPU/PolyDataMapper.js +50 -53
  435. package/Rendering/WebGPU/PolyDataMapper2D.js +39 -39
  436. package/Rendering/WebGPU/RenderEncoder.js +68 -88
  437. package/Rendering/WebGPU/RenderWindow.js +262 -376
  438. package/Rendering/WebGPU/Renderer.js +224 -208
  439. package/Rendering/WebGPU/Sampler.js +27 -21
  440. package/Rendering/WebGPU/ScalarBarActor.js +28 -19
  441. package/Rendering/WebGPU/ShaderCache.js +43 -41
  442. package/Rendering/WebGPU/ShaderDescription.js +52 -59
  443. package/Rendering/WebGPU/ShaderModule.js +26 -17
  444. package/Rendering/WebGPU/SimpleMapper.js +185 -121
  445. package/Rendering/WebGPU/SphereMapper.js +200 -130
  446. package/Rendering/WebGPU/StickMapper.js +289 -152
  447. package/Rendering/WebGPU/StorageBuffer.js +100 -115
  448. package/Rendering/WebGPU/Texture.js +79 -99
  449. package/Rendering/WebGPU/TextureManager.js +52 -54
  450. package/Rendering/WebGPU/TextureView.js +40 -43
  451. package/Rendering/WebGPU/Types.js +53 -70
  452. package/Rendering/WebGPU/UniformBuffer.js +158 -184
  453. package/Rendering/WebGPU/VertexInput.js +64 -90
  454. package/Rendering/WebGPU/ViewNodeFactory.js +25 -13
  455. package/Rendering/WebGPU/Volume.js +52 -51
  456. package/Rendering/WebGPU/VolumePass.js +218 -239
  457. package/Rendering/WebGPU/VolumePassFSQ.js +625 -306
  458. package/Rendering/WebGPU.js +1 -1
  459. package/Rendering/index.js +5 -5
  460. package/Widgets/Core/AbstractWidget/Constants.js +2 -2
  461. package/Widgets/Core/AbstractWidget.js +49 -58
  462. package/Widgets/Core/AbstractWidgetFactory.js +101 -122
  463. package/Widgets/Core/StateBuilder/boundsMixin.js +23 -28
  464. package/Widgets/Core/StateBuilder/color3Mixin.js +10 -7
  465. package/Widgets/Core/StateBuilder/colorMixin.js +10 -6
  466. package/Widgets/Core/StateBuilder/cornerMixin.js +16 -15
  467. package/Widgets/Core/StateBuilder/directionMixin.js +20 -18
  468. package/Widgets/Core/StateBuilder/manipulatorMixin.js +26 -18
  469. package/Widgets/Core/StateBuilder/nameMixin.js +10 -6
  470. package/Widgets/Core/StateBuilder/orientationMixin.js +19 -16
  471. package/Widgets/Core/StateBuilder/originMixin.js +25 -32
  472. package/Widgets/Core/StateBuilder/scale1Mixin.js +10 -6
  473. package/Widgets/Core/StateBuilder/scale3Mixin.js +10 -6
  474. package/Widgets/Core/StateBuilder/shapeMixin.js +12 -6
  475. package/Widgets/Core/StateBuilder/textMixin.js +10 -6
  476. package/Widgets/Core/StateBuilder/visibleMixin.js +10 -6
  477. package/Widgets/Core/StateBuilder.js +120 -149
  478. package/Widgets/Core/WidgetManager/Constants.js +7 -7
  479. package/Widgets/Core/WidgetManager.js +249 -421
  480. package/Widgets/Core/WidgetState.js +48 -57
  481. package/Widgets/Core.js +5 -5
  482. package/Widgets/Manipulators/AbstractManipulator.js +20 -14
  483. package/Widgets/Manipulators/CPRManipulator.js +55 -71
  484. package/Widgets/Manipulators/LineManipulator.js +31 -28
  485. package/Widgets/Manipulators/PickerManipulator.d.ts +48 -0
  486. package/Widgets/Manipulators/PickerManipulator.js +65 -0
  487. package/Widgets/Manipulators/PlaneManipulator.js +26 -23
  488. package/Widgets/Manipulators/TrackballManipulator.js +39 -35
  489. package/Widgets/Manipulators.js +4 -2
  490. package/Widgets/Representations/ArrowHandleRepresentation.js +148 -162
  491. package/Widgets/Representations/CircleContextRepresentation.js +44 -38
  492. package/Widgets/Representations/ContextRepresentation.js +17 -14
  493. package/Widgets/Representations/ConvexFaceContextRepresentation.js +50 -47
  494. package/Widgets/Representations/CroppingOutlineRepresentation.js +38 -27
  495. package/Widgets/Representations/CubeHandleRepresentation.js +21 -18
  496. package/Widgets/Representations/GlyphRepresentation.js +107 -152
  497. package/Widgets/Representations/HandleRepresentation.js +17 -14
  498. package/Widgets/Representations/ImplicitPlaneRepresentation.js +97 -91
  499. package/Widgets/Representations/LineHandleRepresentation.js +44 -41
  500. package/Widgets/Representations/OutlineContextRepresentation.js +42 -36
  501. package/Widgets/Representations/PolyLineRepresentation.js +60 -75
  502. package/Widgets/Representations/RectangleContextRepresentation.js +42 -37
  503. package/Widgets/Representations/SphereContextRepresentation.js +19 -27
  504. package/Widgets/Representations/SphereHandleRepresentation.js +31 -27
  505. package/Widgets/Representations/SplineContextRepresentation.js +46 -70
  506. package/Widgets/Representations/WidgetRepresentation/Constants.js +2 -2
  507. package/Widgets/Representations/WidgetRepresentation.js +99 -134
  508. package/Widgets/Representations.js +13 -13
  509. package/Widgets/Widgets3D/AngleWidget/behavior.js +41 -63
  510. package/Widgets/Widgets3D/AngleWidget.js +40 -38
  511. package/Widgets/Widgets3D/DistanceWidget/behavior.js +40 -61
  512. package/Widgets/Widgets3D/DistanceWidget.js +38 -36
  513. package/Widgets/Widgets3D/EllipseWidget/behavior.js +14 -19
  514. package/Widgets/Widgets3D/EllipseWidget/state.js +4 -2
  515. package/Widgets/Widgets3D/EllipseWidget.js +37 -26
  516. package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +26 -56
  517. package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +14 -17
  518. package/Widgets/Widgets3D/ImageCroppingWidget/state.js +20 -16
  519. package/Widgets/Widgets3D/ImageCroppingWidget.js +80 -98
  520. package/Widgets/Widgets3D/ImplicitPlaneWidget.js +55 -77
  521. package/Widgets/Widgets3D/InteractiveOrientationWidget/behavior.js +17 -18
  522. package/Widgets/Widgets3D/InteractiveOrientationWidget/state.js +15 -7
  523. package/Widgets/Widgets3D/InteractiveOrientationWidget.js +30 -29
  524. package/Widgets/Widgets3D/LabelWidget/behavior.js +37 -62
  525. package/Widgets/Widgets3D/LabelWidget.js +31 -25
  526. package/Widgets/Widgets3D/LineWidget/Constants.js +8 -8
  527. package/Widgets/Widgets3D/LineWidget/behavior.js +77 -114
  528. package/Widgets/Widgets3D/LineWidget/helpers.js +13 -20
  529. package/Widgets/Widgets3D/LineWidget/state.js +2 -1
  530. package/Widgets/Widgets3D/LineWidget.js +39 -35
  531. package/Widgets/Widgets3D/PaintWidget/behavior.js +24 -59
  532. package/Widgets/Widgets3D/PaintWidget.js +39 -37
  533. package/Widgets/Widgets3D/PolyLineWidget/behavior.js +44 -68
  534. package/Widgets/Widgets3D/PolyLineWidget.js +36 -31
  535. package/Widgets/Widgets3D/RectangleWidget/behavior.js +6 -11
  536. package/Widgets/Widgets3D/RectangleWidget/state.js +4 -2
  537. package/Widgets/Widgets3D/RectangleWidget.js +37 -25
  538. package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +35 -21
  539. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +133 -209
  540. package/Widgets/Widgets3D/ResliceCursorWidget/cprBehavior.js +26 -41
  541. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +89 -116
  542. package/Widgets/Widgets3D/ResliceCursorWidget/state.js +33 -40
  543. package/Widgets/Widgets3D/ResliceCursorWidget.js +186 -227
  544. package/Widgets/Widgets3D/SeedWidget/behavior.js +82 -0
  545. package/Widgets/Widgets3D/SeedWidget/state.js +18 -0
  546. package/Widgets/Widgets3D/SeedWidget.d.ts +44 -0
  547. package/Widgets/Widgets3D/SeedWidget.js +43 -0
  548. package/Widgets/Widgets3D/ShapeWidget/Constants.js +19 -19
  549. package/Widgets/Widgets3D/ShapeWidget/behavior.js +150 -252
  550. package/Widgets/Widgets3D/ShapeWidget.js +24 -27
  551. package/Widgets/Widgets3D/SphereWidget/behavior.js +35 -69
  552. package/Widgets/Widgets3D/SphereWidget/state.js +9 -5
  553. package/Widgets/Widgets3D/SphereWidget.js +34 -44
  554. package/Widgets/Widgets3D/SplineWidget/behavior.js +85 -120
  555. package/Widgets/Widgets3D/SplineWidget.js +43 -39
  556. package/Widgets/Widgets3D.js +15 -15
  557. package/Widgets/index.js +4 -4
  558. package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +95 -207
  559. package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +0 -3
  560. package/favicon.js +5 -6
  561. package/index.d.ts +4 -2
  562. package/index.js +4 -3
  563. package/macros.js +4 -1931
  564. package/macros2.js +1684 -0
  565. package/package.json +6 -6
  566. package/vtk.js +18 -31
@@ -1,180 +1,153 @@
1
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
- import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
3
1
  import seedrandom from 'seedrandom';
4
- import macro from '../../../macros.js';
2
+ import { m as macro } from '../../../macros2.js';
5
3
  import { IDENTITY, IDENTITY_3X3, VTK_SMALL_NUMBER, EPSILON } from './Constants.js';
6
4
 
7
- var vtkErrorMacro = macro.vtkErrorMacro,
8
- vtkWarningMacro = macro.vtkWarningMacro; // ----------------------------------------------------------------------------
5
+ const {
6
+ vtkErrorMacro,
7
+ vtkWarningMacro
8
+ } = macro;
9
9
 
10
+ // ----------------------------------------------------------------------------
10
11
  /* eslint-disable camelcase */
11
-
12
12
  /* eslint-disable no-cond-assign */
13
-
14
13
  /* eslint-disable no-bitwise */
15
-
16
14
  /* eslint-disable no-multi-assign */
17
15
  // ----------------------------------------------------------------------------
18
-
19
- var randomSeedValue = 0;
20
- var VTK_MAX_ROTATIONS = 20;
21
-
16
+ let randomSeedValue = 0;
17
+ const VTK_MAX_ROTATIONS = 20;
22
18
  function notImplemented(method) {
23
- return function () {
24
- return vtkErrorMacro("vtkMath::".concat(method, " - NOT IMPLEMENTED"));
25
- };
26
- } // Swap rows for n by n matrix
27
-
19
+ return () => vtkErrorMacro(`vtkMath::${method} - NOT IMPLEMENTED`);
20
+ }
28
21
 
22
+ // Swap rows for n by n matrix
29
23
  function swapRowsMatrix_nxn(matrix, n, row1, row2) {
30
- var tmp;
31
-
32
- for (var i = 0; i < n; i++) {
24
+ let tmp;
25
+ for (let i = 0; i < n; i++) {
33
26
  tmp = matrix[row1 * n + i];
34
27
  matrix[row1 * n + i] = matrix[row2 * n + i];
35
28
  matrix[row2 * n + i] = tmp;
36
29
  }
37
- } // Swap columns for n by n matrix
38
-
30
+ }
39
31
 
32
+ // Swap columns for n by n matrix
40
33
  function swapColumnsMatrix_nxn(matrix, n, column1, column2) {
41
- var tmp;
42
-
43
- for (var i = 0; i < n; i++) {
34
+ let tmp;
35
+ for (let i = 0; i < n; i++) {
44
36
  tmp = matrix[i * n + column1];
45
37
  matrix[i * n + column1] = matrix[i * n + column2];
46
38
  matrix[i * n + column2] = tmp;
47
39
  }
48
- } // ----------------------------------------------------------------------------
40
+ }
41
+
42
+ // ----------------------------------------------------------------------------
49
43
  // Global methods
50
44
  // ----------------------------------------------------------------------------
51
45
 
52
-
53
46
  function createArray() {
54
- var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;
47
+ let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;
55
48
  // faster than Array.from and/or while loop
56
- var res = Array(size);
57
-
58
- for (var i = 0; i < size; ++i) {
49
+ const res = Array(size);
50
+ for (let i = 0; i < size; ++i) {
59
51
  res[i] = 0;
60
52
  }
61
-
62
53
  return res;
63
54
  }
64
- var Pi = function Pi() {
65
- return Math.PI;
66
- };
55
+ const Pi = () => Math.PI;
67
56
  function radiansFromDegrees(deg) {
68
57
  return deg / 180 * Math.PI;
69
58
  }
70
59
  function degreesFromRadians(rad) {
71
60
  return rad * 180 / Math.PI;
72
61
  }
73
- var round = Math.round,
74
- floor = Math.floor,
75
- ceil = Math.ceil,
76
- min = Math.min,
77
- max = Math.max;
62
+ const {
63
+ round,
64
+ floor,
65
+ ceil,
66
+ min,
67
+ max
68
+ } = Math;
78
69
  function arrayMin(arr) {
79
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
80
- var stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
81
- var minValue = Infinity;
82
-
83
- for (var i = offset, len = arr.length; i < len; i += stride) {
70
+ let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
71
+ let stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
72
+ let minValue = Infinity;
73
+ for (let i = offset, len = arr.length; i < len; i += stride) {
84
74
  if (arr[i] < minValue) {
85
75
  minValue = arr[i];
86
76
  }
87
77
  }
88
-
89
78
  return minValue;
90
79
  }
91
80
  function arrayMax(arr) {
92
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
93
- var stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
94
- var maxValue = -Infinity;
95
-
96
- for (var i = offset, len = arr.length; i < len; i += stride) {
81
+ let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
82
+ let stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
83
+ let maxValue = -Infinity;
84
+ for (let i = offset, len = arr.length; i < len; i += stride) {
97
85
  if (maxValue < arr[i]) {
98
86
  maxValue = arr[i];
99
87
  }
100
88
  }
101
-
102
89
  return maxValue;
103
90
  }
104
91
  function arrayRange(arr) {
105
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
106
- var stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
107
- var minValue = Infinity;
108
- var maxValue = -Infinity;
109
-
110
- for (var i = offset, len = arr.length; i < len; i += stride) {
92
+ let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
93
+ let stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
94
+ let minValue = Infinity;
95
+ let maxValue = -Infinity;
96
+ for (let i = offset, len = arr.length; i < len; i += stride) {
111
97
  if (arr[i] < minValue) {
112
98
  minValue = arr[i];
113
99
  }
114
-
115
100
  if (maxValue < arr[i]) {
116
101
  maxValue = arr[i];
117
102
  }
118
103
  }
119
-
120
104
  return [minValue, maxValue];
121
105
  }
122
- var ceilLog2 = notImplemented('ceilLog2');
123
- var factorial = notImplemented('factorial');
106
+ const ceilLog2 = notImplemented('ceilLog2');
107
+ const factorial = notImplemented('factorial');
124
108
  function nearestPowerOfTwo(xi) {
125
- var v = 1;
126
-
109
+ let v = 1;
127
110
  while (v < xi) {
128
111
  v *= 2;
129
112
  }
130
-
131
113
  return v;
132
114
  }
133
115
  function isPowerOfTwo(x) {
134
116
  return x === nearestPowerOfTwo(x);
135
117
  }
136
118
  function binomial(m, n) {
137
- var r = 1;
138
-
139
- for (var i = 1; i <= n; ++i) {
119
+ let r = 1;
120
+ for (let i = 1; i <= n; ++i) {
140
121
  r *= (m - i + 1) / i;
141
122
  }
142
-
143
123
  return Math.floor(r);
144
124
  }
145
125
  function beginCombination(m, n) {
146
126
  if (m < n) {
147
127
  return 0;
148
128
  }
149
-
150
- var r = createArray(n);
151
-
152
- for (var i = 0; i < n; ++i) {
129
+ const r = createArray(n);
130
+ for (let i = 0; i < n; ++i) {
153
131
  r[i] = i;
154
132
  }
155
-
156
133
  return r;
157
134
  }
158
135
  function nextCombination(m, n, r) {
159
- var status = 0;
160
-
161
- for (var i = n - 1; i >= 0; --i) {
136
+ let status = 0;
137
+ for (let i = n - 1; i >= 0; --i) {
162
138
  if (r[i] < m - n + i) {
163
- var j = r[i] + 1;
164
-
139
+ let j = r[i] + 1;
165
140
  while (i < n) {
166
141
  r[i++] = j++;
167
142
  }
168
-
169
143
  status = 1;
170
144
  break;
171
145
  }
172
146
  }
173
-
174
147
  return status;
175
148
  }
176
149
  function randomSeed(seed) {
177
- seedrandom("".concat(seed), {
150
+ seedrandom(`${seed}`, {
178
151
  global: true
179
152
  });
180
153
  randomSeedValue = seed;
@@ -183,13 +156,14 @@ function getSeed() {
183
156
  return randomSeedValue;
184
157
  }
185
158
  function random() {
186
- var minValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
187
- var maxValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
188
- var delta = maxValue - minValue;
159
+ let minValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
160
+ let maxValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
161
+ const delta = maxValue - minValue;
189
162
  return minValue + delta * Math.random();
190
163
  }
191
- var gaussian = notImplemented('gaussian'); // Vect3 operations
164
+ const gaussian = notImplemented('gaussian');
192
165
 
166
+ // Vect3 operations
193
167
  function add(a, b, out) {
194
168
  out[0] = a[0] + b[0];
195
169
  out[1] = a[1] + b[1];
@@ -239,59 +213,52 @@ function outer(x, y, out_3x3) {
239
213
  out_3x3[8] = x[2] * y[2];
240
214
  }
241
215
  function cross(x, y, out) {
242
- var Zx = x[1] * y[2] - x[2] * y[1];
243
- var Zy = x[2] * y[0] - x[0] * y[2];
244
- var Zz = x[0] * y[1] - x[1] * y[0];
216
+ const Zx = x[1] * y[2] - x[2] * y[1];
217
+ const Zy = x[2] * y[0] - x[0] * y[2];
218
+ const Zz = x[0] * y[1] - x[1] * y[0];
245
219
  out[0] = Zx;
246
220
  out[1] = Zy;
247
221
  out[2] = Zz;
248
222
  return out;
249
223
  }
250
224
  function norm(x) {
251
- var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
252
-
225
+ let n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
253
226
  switch (n) {
254
227
  case 1:
255
228
  return Math.abs(x);
256
-
257
229
  case 2:
258
230
  return Math.sqrt(x[0] * x[0] + x[1] * x[1]);
259
-
260
231
  case 3:
261
232
  return Math.sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
262
-
263
233
  default:
264
234
  {
265
- var sum = 0;
266
-
267
- for (var i = 0; i < n; i++) {
235
+ let sum = 0;
236
+ for (let i = 0; i < n; i++) {
268
237
  sum += x[i] * x[i];
269
238
  }
270
-
271
239
  return Math.sqrt(sum);
272
240
  }
273
241
  }
274
242
  }
275
243
  function normalize(x) {
276
- var den = norm(x);
277
-
244
+ const den = norm(x);
278
245
  if (den !== 0.0) {
279
246
  x[0] /= den;
280
247
  x[1] /= den;
281
248
  x[2] /= den;
282
249
  }
283
-
284
250
  return den;
285
251
  }
286
252
  function perpendiculars(x, y, z, theta) {
287
- var x2 = x[0] * x[0];
288
- var y2 = x[1] * x[1];
289
- var z2 = x[2] * x[2];
290
- var r = Math.sqrt(x2 + y2 + z2);
291
- var dx;
292
- var dy;
293
- var dz; // transpose the vector to avoid divide-by-zero error
294
-
253
+ const x2 = x[0] * x[0];
254
+ const y2 = x[1] * x[1];
255
+ const z2 = x[2] * x[2];
256
+ const r = Math.sqrt(x2 + y2 + z2);
257
+ let dx;
258
+ let dy;
259
+ let dz;
260
+
261
+ // transpose the vector to avoid divide-by-zero error
295
262
  if (x2 > y2 && x2 > z2) {
296
263
  dx = 0;
297
264
  dy = 1;
@@ -305,22 +272,18 @@ function perpendiculars(x, y, z, theta) {
305
272
  dy = 0;
306
273
  dz = 1;
307
274
  }
308
-
309
- var a = x[dx] / r;
310
- var b = x[dy] / r;
311
- var c = x[dz] / r;
312
- var tmp = Math.sqrt(a * a + c * c);
313
-
275
+ const a = x[dx] / r;
276
+ const b = x[dy] / r;
277
+ const c = x[dz] / r;
278
+ const tmp = Math.sqrt(a * a + c * c);
314
279
  if (theta !== 0) {
315
- var sintheta = Math.sin(theta);
316
- var costheta = Math.cos(theta);
317
-
280
+ const sintheta = Math.sin(theta);
281
+ const costheta = Math.cos(theta);
318
282
  if (y) {
319
283
  y[dx] = (c * costheta - a * b * sintheta) / tmp;
320
284
  y[dy] = sintheta * tmp;
321
285
  y[dz] = (-(a * costheta) - b * c * sintheta) / tmp;
322
286
  }
323
-
324
287
  if (z) {
325
288
  z[dx] = (-(c * sintheta) - a * b * costheta) / tmp;
326
289
  z[dy] = costheta * tmp;
@@ -332,7 +295,6 @@ function perpendiculars(x, y, z, theta) {
332
295
  y[dy] = 0;
333
296
  y[dz] = -a / tmp;
334
297
  }
335
-
336
298
  if (z) {
337
299
  z[dx] = -a * b / tmp;
338
300
  z[dy] = tmp;
@@ -341,21 +303,17 @@ function perpendiculars(x, y, z, theta) {
341
303
  }
342
304
  }
343
305
  function projectVector(a, b, projection) {
344
- var bSquared = dot(b, b);
345
-
306
+ const bSquared = dot(b, b);
346
307
  if (bSquared === 0) {
347
308
  projection[0] = 0;
348
309
  projection[1] = 0;
349
310
  projection[2] = 0;
350
311
  return false;
351
312
  }
352
-
353
- var scale = dot(a, b) / bSquared;
354
-
355
- for (var i = 0; i < 3; i++) {
313
+ const scale = dot(a, b) / bSquared;
314
+ for (let i = 0; i < 3; i++) {
356
315
  projection[i] = b[i];
357
316
  }
358
-
359
317
  multiplyScalar(projection, scale);
360
318
  return true;
361
319
  }
@@ -363,20 +321,16 @@ function dot2D(x, y) {
363
321
  return x[0] * y[0] + x[1] * y[1];
364
322
  }
365
323
  function projectVector2D(a, b, projection) {
366
- var bSquared = dot2D(b, b);
367
-
324
+ const bSquared = dot2D(b, b);
368
325
  if (bSquared === 0) {
369
326
  projection[0] = 0;
370
327
  projection[1] = 0;
371
328
  return false;
372
329
  }
373
-
374
- var scale = dot2D(a, b) / bSquared;
375
-
376
- for (var i = 0; i < 2; i++) {
330
+ const scale = dot2D(a, b) / bSquared;
331
+ for (let i = 0; i < 2; i++) {
377
332
  projection[i] = b[i];
378
333
  }
379
-
380
334
  multiplyScalar2D(projection, scale);
381
335
  return true;
382
336
  }
@@ -384,23 +338,23 @@ function distance2BetweenPoints(x, y) {
384
338
  return (x[0] - y[0]) * (x[0] - y[0]) + (x[1] - y[1]) * (x[1] - y[1]) + (x[2] - y[2]) * (x[2] - y[2]);
385
339
  }
386
340
  function angleBetweenVectors(v1, v2) {
387
- var crossVect = [0, 0, 0];
341
+ const crossVect = [0, 0, 0];
388
342
  cross(v1, v2, crossVect);
389
343
  return Math.atan2(norm(crossVect), dot(v1, v2));
390
344
  }
391
345
  function signedAngleBetweenVectors(v1, v2, vN) {
392
- var crossVect = [0, 0, 0];
346
+ const crossVect = [0, 0, 0];
393
347
  cross(v1, v2, crossVect);
394
- var angle = Math.atan2(norm(crossVect), dot(v1, v2));
348
+ const angle = Math.atan2(norm(crossVect), dot(v1, v2));
395
349
  return dot(crossVect, vN) >= 0 ? angle : -angle;
396
350
  }
397
351
  function gaussianAmplitude(mean, variance, position) {
398
- var distanceFromMean = Math.abs(mean - position);
399
- return 1 / Math.sqrt(2 * Math.PI * variance) * Math.exp(-Math.pow(distanceFromMean, 2) / (2 * variance));
352
+ const distanceFromMean = Math.abs(mean - position);
353
+ return 1 / Math.sqrt(2 * Math.PI * variance) * Math.exp(-(distanceFromMean ** 2) / (2 * variance));
400
354
  }
401
355
  function gaussianWeight(mean, variance, position) {
402
- var distanceFromMean = Math.abs(mean - position);
403
- return Math.exp(-Math.pow(distanceFromMean, 2) / (2 * variance));
356
+ const distanceFromMean = Math.abs(mean - position);
357
+ return Math.exp(-(distanceFromMean ** 2) / (2 * variance));
404
358
  }
405
359
  function outer2D(x, y, out_2x2) {
406
360
  out_2x2[0] = x[0] * y[0];
@@ -412,132 +366,118 @@ function norm2D(x2D) {
412
366
  return Math.sqrt(x2D[0] * x2D[0] + x2D[1] * x2D[1]);
413
367
  }
414
368
  function normalize2D(x) {
415
- var den = norm2D(x);
416
-
369
+ const den = norm2D(x);
417
370
  if (den !== 0.0) {
418
371
  x[0] /= den;
419
372
  x[1] /= den;
420
373
  }
421
-
422
374
  return den;
423
375
  }
424
376
  function rowsToMat4(row0, row1, row2, row3, mat) {
425
- for (var i = 0; i < 4; i++) {
377
+ for (let i = 0; i < 4; i++) {
426
378
  mat[i] = row0[i];
427
379
  mat[4 + i] = row1[i];
428
380
  mat[8 + i] = row2[i];
429
381
  mat[12 + i] = row3[i];
430
382
  }
431
-
432
383
  return mat;
433
384
  }
434
385
  function columnsToMat4(column0, column1, column2, column3, mat) {
435
- for (var i = 0; i < 4; i++) {
386
+ for (let i = 0; i < 4; i++) {
436
387
  mat[4 * i] = column0[i];
437
388
  mat[4 * i + 1] = column1[i];
438
389
  mat[4 * i + 2] = column2[i];
439
390
  mat[4 * i + 3] = column3[i];
440
391
  }
441
-
442
392
  return mat;
443
393
  }
444
394
  function rowsToMat3(row0, row1, row2, mat) {
445
- for (var i = 0; i < 3; i++) {
395
+ for (let i = 0; i < 3; i++) {
446
396
  mat[i] = row0[i];
447
397
  mat[3 + i] = row1[i];
448
398
  mat[6 + i] = row2[i];
449
399
  }
450
-
451
400
  return mat;
452
401
  }
453
402
  function columnsToMat3(column0, column1, column2, mat) {
454
- for (var i = 0; i < 3; i++) {
403
+ for (let i = 0; i < 3; i++) {
455
404
  mat[3 * i] = column0[i];
456
405
  mat[3 * i + 1] = column1[i];
457
406
  mat[3 * i + 2] = column2[i];
458
407
  }
459
-
460
408
  return mat;
461
409
  }
462
410
  function determinant2x2() {
463
411
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
464
412
  args[_key] = arguments[_key];
465
413
  }
466
-
467
414
  if (args.length === 2) {
468
415
  return args[0][0] * args[1][1] - args[1][0] * args[0][1];
469
416
  }
470
-
471
417
  if (args.length === 4) {
472
418
  return args[0] * args[3] - args[1] * args[2];
473
419
  }
474
-
475
420
  return Number.NaN;
476
421
  }
477
422
  function LUFactor3x3(mat_3x3, index_3) {
478
- var maxI;
479
- var tmp;
480
- var largest;
481
- var scale = [0, 0, 0]; // Loop over rows to get implicit scaling information
423
+ let maxI;
424
+ let tmp;
425
+ let largest;
426
+ const scale = [0, 0, 0];
482
427
 
483
- for (var i = 0; i < 3; i++) {
428
+ // Loop over rows to get implicit scaling information
429
+ for (let i = 0; i < 3; i++) {
484
430
  largest = Math.abs(mat_3x3[i * 3]);
485
-
486
431
  if ((tmp = Math.abs(mat_3x3[i * 3 + 1])) > largest) {
487
432
  largest = tmp;
488
433
  }
489
-
490
434
  if ((tmp = Math.abs(mat_3x3[i * 3 + 2])) > largest) {
491
435
  largest = tmp;
492
436
  }
493
-
494
437
  scale[i] = 1 / largest;
495
- } // Loop over all columns using Crout's method
496
- // first column
438
+ }
497
439
 
440
+ // Loop over all columns using Crout's method
498
441
 
442
+ // first column
499
443
  largest = scale[0] * Math.abs(mat_3x3[0]);
500
444
  maxI = 0;
501
-
502
445
  if ((tmp = scale[1] * Math.abs(mat_3x3[3])) >= largest) {
503
446
  largest = tmp;
504
447
  maxI = 1;
505
448
  }
506
-
507
449
  if ((tmp = scale[2] * Math.abs(mat_3x3[6])) >= largest) {
508
450
  maxI = 2;
509
451
  }
510
-
511
452
  if (maxI !== 0) {
512
453
  swapRowsMatrix_nxn(mat_3x3, 3, maxI, 0);
513
454
  scale[maxI] = scale[0];
514
455
  }
515
-
516
456
  index_3[0] = maxI;
517
457
  mat_3x3[3] /= mat_3x3[0];
518
- mat_3x3[6] /= mat_3x3[0]; // second column
458
+ mat_3x3[6] /= mat_3x3[0];
519
459
 
460
+ // second column
520
461
  mat_3x3[4] -= mat_3x3[3] * mat_3x3[1];
521
462
  mat_3x3[7] -= mat_3x3[6] * mat_3x3[1];
522
463
  largest = scale[1] * Math.abs(mat_3x3[4]);
523
464
  maxI = 1;
524
-
525
465
  if ((tmp = scale[2] * Math.abs(mat_3x3[7])) >= largest) {
526
466
  maxI = 2;
527
467
  swapRowsMatrix_nxn(mat_3x3, 3, 1, 2);
528
468
  scale[2] = scale[1];
529
469
  }
530
-
531
470
  index_3[1] = maxI;
532
- mat_3x3[7] /= mat_3x3[4]; // third column
471
+ mat_3x3[7] /= mat_3x3[4];
533
472
 
473
+ // third column
534
474
  mat_3x3[5] -= mat_3x3[3] * mat_3x3[2];
535
475
  mat_3x3[8] -= mat_3x3[6] * mat_3x3[2] + mat_3x3[7] * mat_3x3[5];
536
476
  index_3[2] = 2;
537
477
  }
538
478
  function LUSolve3x3(mat_3x3, index_3, x_3) {
539
479
  // forward substitution
540
- var sum = x_3[index_3[0]];
480
+ let sum = x_3[index_3[0]];
541
481
  x_3[index_3[0]] = x_3[0];
542
482
  x_3[0] = sum;
543
483
  sum = x_3[index_3[1]];
@@ -545,57 +485,60 @@ function LUSolve3x3(mat_3x3, index_3, x_3) {
545
485
  x_3[1] = sum - mat_3x3[3] * x_3[0];
546
486
  sum = x_3[index_3[2]];
547
487
  x_3[index_3[2]] = x_3[2];
548
- x_3[2] = sum - mat_3x3[6] * x_3[0] - mat_3x3[7] * x_3[1]; // back substitution
488
+ x_3[2] = sum - mat_3x3[6] * x_3[0] - mat_3x3[7] * x_3[1];
549
489
 
490
+ // back substitution
550
491
  x_3[2] /= mat_3x3[8];
551
492
  x_3[1] = (x_3[1] - mat_3x3[5] * x_3[2]) / mat_3x3[4];
552
493
  x_3[0] = (x_3[0] - mat_3x3[1] * x_3[1] - mat_3x3[2] * x_3[2]) / mat_3x3[0];
553
494
  }
554
495
  function linearSolve3x3(mat_3x3, x_3, y_3) {
555
- var a1 = mat_3x3[0];
556
- var b1 = mat_3x3[1];
557
- var c1 = mat_3x3[2];
558
- var a2 = mat_3x3[3];
559
- var b2 = mat_3x3[4];
560
- var c2 = mat_3x3[5];
561
- var a3 = mat_3x3[6];
562
- var b3 = mat_3x3[7];
563
- var c3 = mat_3x3[8]; // Compute the adjoint
564
-
565
- var d1 = +determinant2x2(b2, b3, c2, c3);
566
- var d2 = -determinant2x2(a2, a3, c2, c3);
567
- var d3 = +determinant2x2(a2, a3, b2, b3);
568
- var e1 = -determinant2x2(b1, b3, c1, c3);
569
- var e2 = +determinant2x2(a1, a3, c1, c3);
570
- var e3 = -determinant2x2(a1, a3, b1, b3);
571
- var f1 = +determinant2x2(b1, b2, c1, c2);
572
- var f2 = -determinant2x2(a1, a2, c1, c2);
573
- var f3 = +determinant2x2(a1, a2, b1, b2); // Compute the determinant
574
-
575
- var det = a1 * d1 + b1 * d2 + c1 * d3; // Multiply by the adjoint
576
-
577
- var v1 = d1 * x_3[0] + e1 * x_3[1] + f1 * x_3[2];
578
- var v2 = d2 * x_3[0] + e2 * x_3[1] + f2 * x_3[2];
579
- var v3 = d3 * x_3[0] + e3 * x_3[1] + f3 * x_3[2]; // Divide by the determinant
580
-
496
+ const a1 = mat_3x3[0];
497
+ const b1 = mat_3x3[1];
498
+ const c1 = mat_3x3[2];
499
+ const a2 = mat_3x3[3];
500
+ const b2 = mat_3x3[4];
501
+ const c2 = mat_3x3[5];
502
+ const a3 = mat_3x3[6];
503
+ const b3 = mat_3x3[7];
504
+ const c3 = mat_3x3[8];
505
+
506
+ // Compute the adjoint
507
+ const d1 = +determinant2x2(b2, b3, c2, c3);
508
+ const d2 = -determinant2x2(a2, a3, c2, c3);
509
+ const d3 = +determinant2x2(a2, a3, b2, b3);
510
+ const e1 = -determinant2x2(b1, b3, c1, c3);
511
+ const e2 = +determinant2x2(a1, a3, c1, c3);
512
+ const e3 = -determinant2x2(a1, a3, b1, b3);
513
+ const f1 = +determinant2x2(b1, b2, c1, c2);
514
+ const f2 = -determinant2x2(a1, a2, c1, c2);
515
+ const f3 = +determinant2x2(a1, a2, b1, b2);
516
+
517
+ // Compute the determinant
518
+ const det = a1 * d1 + b1 * d2 + c1 * d3;
519
+
520
+ // Multiply by the adjoint
521
+ const v1 = d1 * x_3[0] + e1 * x_3[1] + f1 * x_3[2];
522
+ const v2 = d2 * x_3[0] + e2 * x_3[1] + f2 * x_3[2];
523
+ const v3 = d3 * x_3[0] + e3 * x_3[1] + f3 * x_3[2];
524
+
525
+ // Divide by the determinant
581
526
  y_3[0] = v1 / det;
582
527
  y_3[1] = v2 / det;
583
528
  y_3[2] = v3 / det;
584
529
  }
585
530
  function multiply3x3_vect3(mat_3x3, in_3, out_3) {
586
- var x = mat_3x3[0] * in_3[0] + mat_3x3[1] * in_3[1] + mat_3x3[2] * in_3[2];
587
- var y = mat_3x3[3] * in_3[0] + mat_3x3[4] * in_3[1] + mat_3x3[5] * in_3[2];
588
- var z = mat_3x3[6] * in_3[0] + mat_3x3[7] * in_3[1] + mat_3x3[8] * in_3[2];
531
+ const x = mat_3x3[0] * in_3[0] + mat_3x3[1] * in_3[1] + mat_3x3[2] * in_3[2];
532
+ const y = mat_3x3[3] * in_3[0] + mat_3x3[4] * in_3[1] + mat_3x3[5] * in_3[2];
533
+ const z = mat_3x3[6] * in_3[0] + mat_3x3[7] * in_3[1] + mat_3x3[8] * in_3[2];
589
534
  out_3[0] = x;
590
535
  out_3[1] = y;
591
536
  out_3[2] = z;
592
537
  }
593
538
  function multiply3x3_mat3(a_3x3, b_3x3, out_3x3) {
594
- var copyA = _toConsumableArray(a_3x3);
595
-
596
- var copyB = _toConsumableArray(b_3x3);
597
-
598
- for (var i = 0; i < 3; i++) {
539
+ const copyA = [...a_3x3];
540
+ const copyB = [...b_3x3];
541
+ for (let i = 0; i < 3; i++) {
599
542
  out_3x3[i] = copyA[0] * copyB[i] + copyA[1] * copyB[i + 3] + copyA[2] * copyB[i + 6];
600
543
  out_3x3[i + 3] = copyA[3] * copyB[i] + copyA[4] * copyB[i + 3] + copyA[5] * copyB[i + 6];
601
544
  out_3x3[i + 6] = copyA[6] * copyB[i] + copyA[7] * copyB[i + 3] + copyA[8] * copyB[i + 6];
@@ -605,29 +548,28 @@ function multiplyMatrix(a, b, rowA, colA, rowB, colB, out_rowXcol) {
605
548
  // we need colA == rowB
606
549
  if (colA !== rowB) {
607
550
  vtkErrorMacro('Number of columns of A must match number of rows of B.');
608
- } // If a or b is used to store the result, copying them is required
609
-
610
-
611
- var copyA = _toConsumableArray(a);
551
+ }
612
552
 
613
- var copyB = _toConsumableArray(b); // output matrix is rowA*colB
553
+ // If a or b is used to store the result, copying them is required
554
+ const copyA = [...a];
555
+ const copyB = [...b];
556
+ // output matrix is rowA*colB
614
557
  // output row
615
-
616
-
617
- for (var i = 0; i < rowA; i++) {
558
+ for (let i = 0; i < rowA; i++) {
618
559
  // output col
619
- for (var j = 0; j < colB; j++) {
620
- out_rowXcol[i * colB + j] = 0; // sum for this point
621
-
622
- for (var k = 0; k < colA; k++) {
560
+ for (let j = 0; j < colB; j++) {
561
+ out_rowXcol[i * colB + j] = 0;
562
+ // sum for this point
563
+ for (let k = 0; k < colA; k++) {
623
564
  out_rowXcol[i * colB + j] += copyA[i * colA + k] * copyB[j + colB * k];
624
565
  }
625
566
  }
626
567
  }
627
568
  }
628
569
  function transpose3x3(in_3x3, outT_3x3) {
629
- var tmp; // off-diagonal elements
570
+ let tmp;
630
571
 
572
+ // off-diagonal elements
631
573
  tmp = in_3x3[3];
632
574
  outT_3x3[3] = in_3x3[1];
633
575
  outT_3x3[1] = tmp;
@@ -636,39 +578,40 @@ function transpose3x3(in_3x3, outT_3x3) {
636
578
  outT_3x3[2] = tmp;
637
579
  tmp = in_3x3[7];
638
580
  outT_3x3[7] = in_3x3[5];
639
- outT_3x3[5] = tmp; // on-diagonal elements
581
+ outT_3x3[5] = tmp;
640
582
 
583
+ // on-diagonal elements
641
584
  outT_3x3[0] = in_3x3[0];
642
585
  outT_3x3[4] = in_3x3[4];
643
586
  outT_3x3[8] = in_3x3[8];
644
587
  }
645
588
  function invert3x3(in_3x3, outI_3x3) {
646
- var a1 = in_3x3[0];
647
- var b1 = in_3x3[1];
648
- var c1 = in_3x3[2];
649
- var a2 = in_3x3[3];
650
- var b2 = in_3x3[4];
651
- var c2 = in_3x3[5];
652
- var a3 = in_3x3[6];
653
- var b3 = in_3x3[7];
654
- var c3 = in_3x3[8]; // Compute the adjoint
655
-
656
- var d1 = +determinant2x2(b2, b3, c2, c3);
657
- var d2 = -determinant2x2(a2, a3, c2, c3);
658
- var d3 = +determinant2x2(a2, a3, b2, b3);
659
- var e1 = -determinant2x2(b1, b3, c1, c3);
660
- var e2 = +determinant2x2(a1, a3, c1, c3);
661
- var e3 = -determinant2x2(a1, a3, b1, b3);
662
- var f1 = +determinant2x2(b1, b2, c1, c2);
663
- var f2 = -determinant2x2(a1, a2, c1, c2);
664
- var f3 = +determinant2x2(a1, a2, b1, b2); // Divide by the determinant
665
-
666
- var det = a1 * d1 + b1 * d2 + c1 * d3;
667
-
589
+ const a1 = in_3x3[0];
590
+ const b1 = in_3x3[1];
591
+ const c1 = in_3x3[2];
592
+ const a2 = in_3x3[3];
593
+ const b2 = in_3x3[4];
594
+ const c2 = in_3x3[5];
595
+ const a3 = in_3x3[6];
596
+ const b3 = in_3x3[7];
597
+ const c3 = in_3x3[8];
598
+
599
+ // Compute the adjoint
600
+ const d1 = +determinant2x2(b2, b3, c2, c3);
601
+ const d2 = -determinant2x2(a2, a3, c2, c3);
602
+ const d3 = +determinant2x2(a2, a3, b2, b3);
603
+ const e1 = -determinant2x2(b1, b3, c1, c3);
604
+ const e2 = +determinant2x2(a1, a3, c1, c3);
605
+ const e3 = -determinant2x2(a1, a3, b1, b3);
606
+ const f1 = +determinant2x2(b1, b2, c1, c2);
607
+ const f2 = -determinant2x2(a1, a2, c1, c2);
608
+ const f3 = +determinant2x2(a1, a2, b1, b2);
609
+
610
+ // Divide by the determinant
611
+ const det = a1 * d1 + b1 * d2 + c1 * d3;
668
612
  if (det === 0) {
669
613
  vtkWarningMacro('Matrix has 0 determinant');
670
614
  }
671
-
672
615
  outI_3x3[0] = d1 / det;
673
616
  outI_3x3[3] = d2 / det;
674
617
  outI_3x3[6] = d3 / det;
@@ -682,68 +625,63 @@ function invert3x3(in_3x3, outI_3x3) {
682
625
  function determinant3x3(mat_3x3) {
683
626
  return mat_3x3[0] * mat_3x3[4] * mat_3x3[8] + mat_3x3[3] * mat_3x3[7] * mat_3x3[2] + mat_3x3[6] * mat_3x3[1] * mat_3x3[5] - mat_3x3[0] * mat_3x3[7] * mat_3x3[5] - mat_3x3[3] * mat_3x3[1] * mat_3x3[8] - mat_3x3[6] * mat_3x3[4] * mat_3x3[2];
684
627
  }
628
+
685
629
  /**
686
630
  * Returns true if elements of both arrays are equals.
687
631
  * @param {Array} a an array of numbers (vector, point, matrix...)
688
632
  * @param {Array} b an array of numbers (vector, point, matrix...)
689
633
  * @param {Number} eps tolerance
690
634
  */
691
-
692
635
  function areEquals(a, b) {
693
- var eps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EPSILON;
694
-
636
+ let eps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EPSILON;
695
637
  if (a.length !== b.length) {
696
638
  return false;
697
639
  }
698
-
699
640
  function isEqual(element, index) {
700
641
  return Math.abs(element - b[index]) <= eps;
701
642
  }
702
-
703
643
  return a.every(isEqual);
704
644
  }
705
- var areMatricesEqual = areEquals;
645
+ const areMatricesEqual = areEquals;
706
646
  function identity3x3(mat_3x3) {
707
- for (var i = 0; i < 3; i++) {
647
+ for (let i = 0; i < 3; i++) {
708
648
  /* eslint-disable-next-line no-multi-assign */
709
649
  mat_3x3[i * 3] = mat_3x3[i * 3 + 1] = mat_3x3[i * 3 + 2] = 0;
710
650
  mat_3x3[i * 3 + i] = 1;
711
651
  }
712
652
  }
713
653
  function identity(n, mat) {
714
- for (var i = 0; i < n; i++) {
715
- for (var j = 0; j < n; j++) {
654
+ for (let i = 0; i < n; i++) {
655
+ for (let j = 0; j < n; j++) {
716
656
  mat[i * n + j] = 0;
717
657
  }
718
-
719
658
  mat[i * n + i] = 1;
720
659
  }
721
-
722
660
  return mat;
723
661
  }
724
662
  function isIdentity(mat) {
725
- var eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EPSILON;
663
+ let eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EPSILON;
726
664
  return areMatricesEqual(mat, IDENTITY, eps);
727
665
  }
728
666
  function isIdentity3x3(mat) {
729
- var eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EPSILON;
667
+ let eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EPSILON;
730
668
  return areMatricesEqual(mat, IDENTITY_3X3, eps);
731
669
  }
732
670
  function quaternionToMatrix3x3(quat_4, mat_3x3) {
733
- var ww = quat_4[0] * quat_4[0];
734
- var wx = quat_4[0] * quat_4[1];
735
- var wy = quat_4[0] * quat_4[2];
736
- var wz = quat_4[0] * quat_4[3];
737
- var xx = quat_4[1] * quat_4[1];
738
- var yy = quat_4[2] * quat_4[2];
739
- var zz = quat_4[3] * quat_4[3];
740
- var xy = quat_4[1] * quat_4[2];
741
- var xz = quat_4[1] * quat_4[3];
742
- var yz = quat_4[2] * quat_4[3];
743
- var rr = xx + yy + zz; // normalization factor, just in case quaternion was not normalized
744
-
745
- var f = 1 / (ww + rr);
746
- var s = (ww - rr) * f;
671
+ const ww = quat_4[0] * quat_4[0];
672
+ const wx = quat_4[0] * quat_4[1];
673
+ const wy = quat_4[0] * quat_4[2];
674
+ const wz = quat_4[0] * quat_4[3];
675
+ const xx = quat_4[1] * quat_4[1];
676
+ const yy = quat_4[2] * quat_4[2];
677
+ const zz = quat_4[3] * quat_4[3];
678
+ const xy = quat_4[1] * quat_4[2];
679
+ const xz = quat_4[1] * quat_4[3];
680
+ const yz = quat_4[2] * quat_4[3];
681
+ const rr = xx + yy + zz;
682
+ // normalization factor, just in case quaternion was not normalized
683
+ let f = 1 / (ww + rr);
684
+ const s = (ww - rr) * f;
747
685
  f *= 2;
748
686
  mat_3x3[0] = xx * f + s;
749
687
  mat_3x3[3] = (xy + wz) * f;
@@ -756,105 +694,94 @@ function quaternionToMatrix3x3(quat_4, mat_3x3) {
756
694
  mat_3x3[8] = zz * f + s;
757
695
  }
758
696
  function roundNumber(num) {
759
- var digits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
760
-
761
- if (!"".concat(num).includes('e')) {
762
- return +"".concat(Math.round("".concat(num, "e+").concat(digits)), "e-").concat(digits);
697
+ let digits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
698
+ if (!`${num}`.includes('e')) {
699
+ return +`${Math.round(`${num}e+${digits}`)}e-${digits}`;
763
700
  }
764
-
765
- var arr = "".concat(num).split('e');
766
- var sig = '';
767
-
701
+ const arr = `${num}`.split('e');
702
+ let sig = '';
768
703
  if (+arr[1] + digits > 0) {
769
704
  sig = '+';
770
705
  }
771
-
772
- return +"".concat(Math.round("".concat(+arr[0], "e").concat(sig).concat(+arr[1] + digits)), "e-").concat(digits);
706
+ return +`${Math.round(`${+arr[0]}e${sig}${+arr[1] + digits}`)}e-${digits}`;
773
707
  }
774
708
  function roundVector(vector) {
775
- var out = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
776
- var digits = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
709
+ let out = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
710
+ let digits = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
777
711
  out[0] = roundNumber(vector[0], digits);
778
712
  out[1] = roundNumber(vector[1], digits);
779
713
  out[2] = roundNumber(vector[2], digits);
780
714
  return out;
781
715
  }
782
716
  function jacobiN(a, n, w, v) {
783
- var i;
784
- var j;
785
- var k;
786
- var iq;
787
- var ip;
788
- var numPos;
789
- var tresh;
790
- var theta;
791
- var t;
792
- var tau;
793
- var sm;
794
- var s;
795
- var h;
796
- var g;
797
- var c;
798
- var tmp;
799
- var b = createArray(n);
800
- var z = createArray(n);
801
-
802
- var vtkROTATE = function vtkROTATE(aa, ii, jj) {
717
+ let i;
718
+ let j;
719
+ let k;
720
+ let iq;
721
+ let ip;
722
+ let numPos;
723
+ let tresh;
724
+ let theta;
725
+ let t;
726
+ let tau;
727
+ let sm;
728
+ let s;
729
+ let h;
730
+ let g;
731
+ let c;
732
+ let tmp;
733
+ const b = createArray(n);
734
+ const z = createArray(n);
735
+ const vtkROTATE = (aa, ii, jj) => {
803
736
  g = aa[ii];
804
737
  h = aa[jj];
805
738
  aa[ii] = g - s * (h + g * tau);
806
739
  aa[jj] = h + s * (g - h * tau);
807
- }; // initialize
808
-
740
+ };
809
741
 
742
+ // initialize
810
743
  identity(n, v);
811
-
812
744
  for (ip = 0; ip < n; ip++) {
813
745
  b[ip] = w[ip] = a[ip + ip * n];
814
746
  z[ip] = 0.0;
815
- } // begin rotation sequence
816
-
747
+ }
817
748
 
749
+ // begin rotation sequence
818
750
  for (i = 0; i < VTK_MAX_ROTATIONS; i++) {
819
751
  sm = 0.0;
820
-
821
752
  for (ip = 0; ip < n - 1; ip++) {
822
753
  for (iq = ip + 1; iq < n; iq++) {
823
754
  sm += Math.abs(a[ip * n + iq]);
824
755
  }
825
756
  }
826
-
827
757
  if (sm === 0.0) {
828
758
  break;
829
- } // first 3 sweeps
830
-
759
+ }
831
760
 
761
+ // first 3 sweeps
832
762
  if (i < 3) {
833
763
  tresh = 0.2 * sm / (n * n);
834
764
  } else {
835
765
  tresh = 0.0;
836
766
  }
837
-
838
767
  for (ip = 0; ip < n - 1; ip++) {
839
768
  for (iq = ip + 1; iq < n; iq++) {
840
- g = 100.0 * Math.abs(a[ip * n + iq]); // after 4 sweeps
769
+ g = 100.0 * Math.abs(a[ip * n + iq]);
841
770
 
771
+ // after 4 sweeps
842
772
  if (i > 3 && Math.abs(w[ip]) + g === Math.abs(w[ip]) && Math.abs(w[iq]) + g === Math.abs(w[iq])) {
843
773
  a[ip * n + iq] = 0.0;
844
774
  } else if (Math.abs(a[ip * n + iq]) > tresh) {
845
775
  h = w[iq] - w[ip];
846
-
847
776
  if (Math.abs(h) + g === Math.abs(h)) {
848
777
  t = a[ip * n + iq] / h;
849
778
  } else {
850
779
  theta = 0.5 * h / a[ip * n + iq];
851
780
  t = 1.0 / (Math.abs(theta) + Math.sqrt(1.0 + theta * theta));
852
-
853
781
  if (theta < 0.0) {
854
782
  t = -t;
855
783
  }
856
784
  }
857
-
858
785
  c = 1.0 / Math.sqrt(1 + t * t);
859
786
  s = t * c;
860
787
  tau = s / (1.0 + c);
@@ -863,48 +790,44 @@ function jacobiN(a, n, w, v) {
863
790
  z[iq] += h;
864
791
  w[ip] -= h;
865
792
  w[iq] += h;
866
- a[ip * n + iq] = 0.0; // ip already shifted left by 1 unit
793
+ a[ip * n + iq] = 0.0;
867
794
 
795
+ // ip already shifted left by 1 unit
868
796
  for (j = 0; j <= ip - 1; j++) {
869
797
  vtkROTATE(a, j * n + ip, j * n + iq);
870
- } // ip and iq already shifted left by 1 unit
871
-
872
-
798
+ }
799
+ // ip and iq already shifted left by 1 unit
873
800
  for (j = ip + 1; j <= iq - 1; j++) {
874
801
  vtkROTATE(a, ip * n + j, j * n + iq);
875
- } // iq already shifted left by 1 unit
876
-
877
-
802
+ }
803
+ // iq already shifted left by 1 unit
878
804
  for (j = iq + 1; j < n; j++) {
879
805
  vtkROTATE(a, ip * n + j, iq * n + j);
880
806
  }
881
-
882
807
  for (j = 0; j < n; j++) {
883
808
  vtkROTATE(v, j * n + ip, j * n + iq);
884
809
  }
885
810
  }
886
811
  }
887
812
  }
888
-
889
813
  for (ip = 0; ip < n; ip++) {
890
814
  b[ip] += z[ip];
891
815
  w[ip] = b[ip];
892
816
  z[ip] = 0.0;
893
817
  }
894
- } // this is NEVER called
895
-
818
+ }
896
819
 
820
+ // this is NEVER called
897
821
  if (i >= VTK_MAX_ROTATIONS) {
898
822
  vtkWarningMacro('vtkMath::Jacobi: Error extracting eigenfunctions');
899
823
  return 0;
900
- } // sort eigenfunctions: these changes do not affect accuracy
901
-
824
+ }
902
825
 
826
+ // sort eigenfunctions: these changes do not affect accuracy
903
827
  for (j = 0; j < n - 1; j++) {
904
828
  // boundary incorrect
905
829
  k = j;
906
830
  tmp = w[k];
907
-
908
831
  for (i = j + 1; i < n; i++) {
909
832
  // boundary incorrect, shifted already
910
833
  if (w[i] >= tmp || Math.abs(w[i] - tmp) < VTK_SMALL_NUMBER) {
@@ -913,79 +836,78 @@ function jacobiN(a, n, w, v) {
913
836
  tmp = w[k];
914
837
  }
915
838
  }
916
-
917
839
  if (k !== j) {
918
840
  w[k] = w[j];
919
841
  w[j] = tmp;
920
842
  swapColumnsMatrix_nxn(v, n, j, k);
921
843
  }
922
- } // ensure eigenvector consistency (i.e., Jacobi can compute vectors that
844
+ }
845
+ // ensure eigenvector consistency (i.e., Jacobi can compute vectors that
923
846
  // are negative of one another (.707,.707,0) and (-.707,-.707,0). This can
924
847
  // reek havoc in hyperstreamline/other stuff. We will select the most
925
848
  // positive eigenvector.
926
-
927
-
928
- var ceil_half_n = (n >> 1) + (n & 1);
929
-
849
+ const ceil_half_n = (n >> 1) + (n & 1);
930
850
  for (numPos = 0, i = 0; i < n * n; i++) {
931
851
  if (v[i] >= 0.0) {
932
852
  numPos++;
933
853
  }
934
- } // if ( numPos < ceil(double(n)/double(2.0)) )
935
-
936
-
854
+ }
855
+ // if ( numPos < ceil(double(n)/double(2.0)) )
937
856
  if (numPos < ceil_half_n) {
938
857
  for (i = 0; i < n; i++) {
939
858
  v[i * n + j] *= -1.0;
940
859
  }
941
860
  }
942
-
943
861
  return 1;
944
862
  }
945
863
  function matrix3x3ToQuaternion(mat_3x3, quat_4) {
946
- var tmp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; // on-diagonal elements
864
+ const tmp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
947
865
 
866
+ // on-diagonal elements
948
867
  tmp[0] = mat_3x3[0] + mat_3x3[4] + mat_3x3[8];
949
868
  tmp[5] = mat_3x3[0] - mat_3x3[4] - mat_3x3[8];
950
869
  tmp[10] = -mat_3x3[0] + mat_3x3[4] - mat_3x3[8];
951
- tmp[15] = -mat_3x3[0] - mat_3x3[4] + mat_3x3[8]; // off-diagonal elements
870
+ tmp[15] = -mat_3x3[0] - mat_3x3[4] + mat_3x3[8];
952
871
 
872
+ // off-diagonal elements
953
873
  tmp[1] = tmp[4] = mat_3x3[7] - mat_3x3[5];
954
874
  tmp[2] = tmp[8] = mat_3x3[2] - mat_3x3[6];
955
875
  tmp[3] = tmp[12] = mat_3x3[3] - mat_3x3[1];
956
876
  tmp[6] = tmp[9] = mat_3x3[3] + mat_3x3[1];
957
877
  tmp[7] = tmp[13] = mat_3x3[2] + mat_3x3[6];
958
878
  tmp[11] = tmp[14] = mat_3x3[7] + mat_3x3[5];
959
- var eigenvectors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
960
- var eigenvalues = [0, 0, 0, 0]; // convert into format that JacobiN can use,
879
+ const eigenvectors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
880
+ const eigenvalues = [0, 0, 0, 0];
881
+
882
+ // convert into format that JacobiN can use,
961
883
  // then use Jacobi to find eigenvalues and eigenvectors
962
884
  // tmp is copied because jacobiN may modify it
885
+ const NTemp = [...tmp];
886
+ jacobiN(NTemp, 4, eigenvalues, eigenvectors);
963
887
 
964
- var NTemp = [].concat(tmp);
965
- jacobiN(NTemp, 4, eigenvalues, eigenvectors); // the first eigenvector is the one we want
966
-
888
+ // the first eigenvector is the one we want
967
889
  quat_4[0] = eigenvectors[0];
968
890
  quat_4[1] = eigenvectors[4];
969
891
  quat_4[2] = eigenvectors[8];
970
892
  quat_4[3] = eigenvectors[12];
971
893
  }
972
894
  function multiplyQuaternion(quat_1, quat_2, quat_out) {
973
- var ww = quat_1[0] * quat_2[0];
974
- var wx = quat_1[0] * quat_2[1];
975
- var wy = quat_1[0] * quat_2[2];
976
- var wz = quat_1[0] * quat_2[3];
977
- var xw = quat_1[1] * quat_2[0];
978
- var xx = quat_1[1] * quat_2[1];
979
- var xy = quat_1[1] * quat_2[2];
980
- var xz = quat_1[1] * quat_2[3];
981
- var yw = quat_1[2] * quat_2[0];
982
- var yx = quat_1[2] * quat_2[1];
983
- var yy = quat_1[2] * quat_2[2];
984
- var yz = quat_1[2] * quat_2[3];
985
- var zw = quat_1[3] * quat_2[0];
986
- var zx = quat_1[3] * quat_2[1];
987
- var zy = quat_1[3] * quat_2[2];
988
- var zz = quat_1[3] * quat_2[3];
895
+ const ww = quat_1[0] * quat_2[0];
896
+ const wx = quat_1[0] * quat_2[1];
897
+ const wy = quat_1[0] * quat_2[2];
898
+ const wz = quat_1[0] * quat_2[3];
899
+ const xw = quat_1[1] * quat_2[0];
900
+ const xx = quat_1[1] * quat_2[1];
901
+ const xy = quat_1[1] * quat_2[2];
902
+ const xz = quat_1[1] * quat_2[3];
903
+ const yw = quat_1[2] * quat_2[0];
904
+ const yx = quat_1[2] * quat_2[1];
905
+ const yy = quat_1[2] * quat_2[2];
906
+ const yz = quat_1[2] * quat_2[3];
907
+ const zw = quat_1[3] * quat_2[0];
908
+ const zx = quat_1[3] * quat_2[1];
909
+ const zy = quat_1[3] * quat_2[2];
910
+ const zz = quat_1[3] * quat_2[3];
989
911
  quat_out[0] = ww - xx - yy - zz;
990
912
  quat_out[1] = wx + xw + yz - zy;
991
913
  quat_out[2] = wy - xz + yw + zx;
@@ -993,369 +915,341 @@ function multiplyQuaternion(quat_1, quat_2, quat_out) {
993
915
  }
994
916
  function orthogonalize3x3(a_3x3, out_3x3) {
995
917
  // copy the matrix
996
- for (var i = 0; i < 9; i++) {
918
+ for (let i = 0; i < 9; i++) {
997
919
  out_3x3[i] = a_3x3[i];
998
- } // Pivot the matrix to improve accuracy
999
-
1000
-
1001
- var scale = createArray(3);
1002
- var index = createArray(3);
1003
- var largest; // Loop over rows to get implicit scaling information
1004
-
1005
- for (var _i = 0; _i < 3; _i++) {
1006
- var _x = Math.abs(out_3x3[_i * 3]);
1007
-
1008
- var _x2 = Math.abs(out_3x3[_i * 3 + 1]);
1009
-
1010
- var _x3 = Math.abs(out_3x3[_i * 3 + 2]);
920
+ }
1011
921
 
1012
- largest = _x2 > _x ? _x2 : _x;
1013
- largest = _x3 > largest ? _x3 : largest;
1014
- scale[_i] = 1;
922
+ // Pivot the matrix to improve accuracy
923
+ const scale = createArray(3);
924
+ const index = createArray(3);
925
+ let largest;
1015
926
 
927
+ // Loop over rows to get implicit scaling information
928
+ for (let i = 0; i < 3; i++) {
929
+ const x1 = Math.abs(out_3x3[i * 3]);
930
+ const x2 = Math.abs(out_3x3[i * 3 + 1]);
931
+ const x3 = Math.abs(out_3x3[i * 3 + 2]);
932
+ largest = x2 > x1 ? x2 : x1;
933
+ largest = x3 > largest ? x3 : largest;
934
+ scale[i] = 1;
1016
935
  if (largest !== 0) {
1017
- scale[_i] /= largest;
936
+ scale[i] /= largest;
1018
937
  }
1019
- } // first column
1020
-
938
+ }
1021
939
 
1022
- var x1 = Math.abs(out_3x3[0]) * scale[0];
1023
- var x2 = Math.abs(out_3x3[3]) * scale[1];
1024
- var x3 = Math.abs(out_3x3[6]) * scale[2];
940
+ // first column
941
+ const x1 = Math.abs(out_3x3[0]) * scale[0];
942
+ const x2 = Math.abs(out_3x3[3]) * scale[1];
943
+ const x3 = Math.abs(out_3x3[6]) * scale[2];
1025
944
  index[0] = 0;
1026
945
  largest = x1;
1027
-
1028
946
  if (x2 >= largest) {
1029
947
  largest = x2;
1030
948
  index[0] = 1;
1031
949
  }
1032
-
1033
950
  if (x3 >= largest) {
1034
951
  index[0] = 2;
1035
952
  }
1036
-
1037
953
  if (index[0] !== 0) {
1038
954
  // swap vectors
1039
955
  swapColumnsMatrix_nxn(out_3x3, 3, index[0], 0);
1040
956
  scale[index[0]] = scale[0];
1041
- } // second column
1042
-
957
+ }
1043
958
 
1044
- var y2 = Math.abs(out_3x3[4]) * scale[1];
1045
- var y3 = Math.abs(out_3x3[7]) * scale[2];
959
+ // second column
960
+ const y2 = Math.abs(out_3x3[4]) * scale[1];
961
+ const y3 = Math.abs(out_3x3[7]) * scale[2];
1046
962
  index[1] = 1;
1047
963
  largest = y2;
1048
-
1049
964
  if (y3 >= largest) {
1050
- index[1] = 2; // swap vectors
1051
-
965
+ index[1] = 2;
966
+ // swap vectors
1052
967
  swapColumnsMatrix_nxn(out_3x3, 3, 1, 2);
1053
- } // third column
968
+ }
1054
969
 
970
+ // third column
971
+ index[2] = 2;
1055
972
 
1056
- index[2] = 2; // A quaternion can only describe a pure rotation, not
973
+ // A quaternion can only describe a pure rotation, not
1057
974
  // a rotation with a flip, therefore the flip must be
1058
975
  // removed before the matrix is converted to a quaternion.
1059
-
1060
- var flip = 0;
1061
-
976
+ let flip = 0;
1062
977
  if (determinant3x3(out_3x3) < 0) {
1063
978
  flip = 1;
1064
-
1065
- for (var _i2 = 0; _i2 < 9; _i2++) {
1066
- out_3x3[_i2] = -out_3x3[_i2];
979
+ for (let i = 0; i < 9; i++) {
980
+ out_3x3[i] = -out_3x3[i];
1067
981
  }
1068
- } // Do orthogonalization using a quaternion intermediate
982
+ }
983
+
984
+ // Do orthogonalization using a quaternion intermediate
1069
985
  // (this, essentially, does the orthogonalization via
1070
986
  // diagonalization of an appropriately constructed symmetric
1071
987
  // 4x4 matrix rather than by doing SVD of the 3x3 matrix)
1072
-
1073
-
1074
- var quat = createArray(4);
988
+ const quat = createArray(4);
1075
989
  matrix3x3ToQuaternion(out_3x3, quat);
1076
- quaternionToMatrix3x3(quat, out_3x3); // Put the flip back into the orthogonalized matrix.
990
+ quaternionToMatrix3x3(quat, out_3x3);
1077
991
 
992
+ // Put the flip back into the orthogonalized matrix.
1078
993
  if (flip) {
1079
- for (var _i3 = 0; _i3 < 9; _i3++) {
1080
- out_3x3[_i3] = -out_3x3[_i3];
994
+ for (let i = 0; i < 9; i++) {
995
+ out_3x3[i] = -out_3x3[i];
1081
996
  }
1082
- } // Undo the pivoting
1083
-
997
+ }
1084
998
 
999
+ // Undo the pivoting
1085
1000
  if (index[1] !== 1) {
1086
1001
  swapColumnsMatrix_nxn(out_3x3, 3, index[1], 1);
1087
1002
  }
1088
-
1089
1003
  if (index[0] !== 0) {
1090
1004
  swapColumnsMatrix_nxn(out_3x3, 3, index[0], 0);
1091
1005
  }
1092
1006
  }
1093
1007
  function diagonalize3x3(a_3x3, w_3, v_3x3) {
1094
- var i;
1095
- var j;
1096
- var k;
1097
- var maxI;
1098
- var tmp;
1099
- var maxVal; // a is copied because jacobiN may modify it
1008
+ let i;
1009
+ let j;
1010
+ let k;
1011
+ let maxI;
1012
+ let tmp;
1013
+ let maxVal;
1100
1014
 
1101
- var copyA = _toConsumableArray(a_3x3); // diagonalize using Jacobi
1015
+ // a is copied because jacobiN may modify it
1016
+ const copyA = [...a_3x3];
1102
1017
 
1018
+ // diagonalize using Jacobi
1019
+ jacobiN(copyA, 3, w_3, v_3x3);
1103
1020
 
1104
- jacobiN(copyA, 3, w_3, v_3x3); // if all the eigenvalues are the same, return identity matrix
1105
-
1021
+ // if all the eigenvalues are the same, return identity matrix
1106
1022
  if (w_3[0] === w_3[1] && w_3[0] === w_3[2]) {
1107
1023
  identity3x3(v_3x3);
1108
1024
  return;
1109
- } // transpose temporarily, it makes it easier to sort the eigenvectors
1025
+ }
1110
1026
 
1027
+ // transpose temporarily, it makes it easier to sort the eigenvectors
1028
+ transpose3x3(v_3x3, v_3x3);
1111
1029
 
1112
- transpose3x3(v_3x3, v_3x3); // if two eigenvalues are the same, re-orthogonalize to optimally line
1030
+ // if two eigenvalues are the same, re-orthogonalize to optimally line
1113
1031
  // up the eigenvectors with the x, y, and z axes
1114
-
1115
1032
  for (i = 0; i < 3; i++) {
1116
1033
  // two eigenvalues are the same
1117
1034
  if (w_3[(i + 1) % 3] === w_3[(i + 2) % 3]) {
1118
1035
  // find maximum element of the independent eigenvector
1119
1036
  maxVal = Math.abs(v_3x3[i * 3]);
1120
1037
  maxI = 0;
1121
-
1122
1038
  for (j = 1; j < 3; j++) {
1123
1039
  if (maxVal < (tmp = Math.abs(v_3x3[i * 3 + j]))) {
1124
1040
  maxVal = tmp;
1125
1041
  maxI = j;
1126
1042
  }
1127
- } // swap the eigenvector into its proper position
1128
-
1129
-
1043
+ }
1044
+ // swap the eigenvector into its proper position
1130
1045
  if (maxI !== i) {
1131
1046
  tmp = w_3[maxI];
1132
1047
  w_3[maxI] = w_3[i];
1133
1048
  w_3[i] = tmp;
1134
1049
  swapRowsMatrix_nxn(v_3x3, 3, i, maxI);
1135
- } // maximum element of eigenvector should be positive
1136
-
1137
-
1050
+ }
1051
+ // maximum element of eigenvector should be positive
1138
1052
  if (v_3x3[maxI * 3 + maxI] < 0) {
1139
1053
  v_3x3[maxI * 3] = -v_3x3[maxI * 3];
1140
1054
  v_3x3[maxI * 3 + 1] = -v_3x3[maxI * 3 + 1];
1141
1055
  v_3x3[maxI * 3 + 2] = -v_3x3[maxI * 3 + 2];
1142
- } // re-orthogonalize the other two eigenvectors
1143
-
1056
+ }
1144
1057
 
1058
+ // re-orthogonalize the other two eigenvectors
1145
1059
  j = (maxI + 1) % 3;
1146
1060
  k = (maxI + 2) % 3;
1147
1061
  v_3x3[j * 3] = 0.0;
1148
1062
  v_3x3[j * 3 + 1] = 0.0;
1149
1063
  v_3x3[j * 3 + 2] = 0.0;
1150
1064
  v_3x3[j * 3 + j] = 1.0;
1151
- var vectTmp1 = cross([v_3x3[maxI * 3], v_3x3[maxI * 3 + 1], v_3x3[maxI * 3 + 2]], [v_3x3[j * 3], v_3x3[j * 3 + 1], v_3x3[j * 3 + 2]], []);
1065
+ const vectTmp1 = cross([v_3x3[maxI * 3], v_3x3[maxI * 3 + 1], v_3x3[maxI * 3 + 2]], [v_3x3[j * 3], v_3x3[j * 3 + 1], v_3x3[j * 3 + 2]], []);
1152
1066
  normalize(vectTmp1);
1153
- var vectTmp2 = cross(vectTmp1, [v_3x3[maxI * 3], v_3x3[maxI * 3 + 1], v_3x3[maxI * 3 + 2]], []);
1154
-
1155
- for (var t = 0; t < 3; t++) {
1067
+ const vectTmp2 = cross(vectTmp1, [v_3x3[maxI * 3], v_3x3[maxI * 3 + 1], v_3x3[maxI * 3 + 2]], []);
1068
+ for (let t = 0; t < 3; t++) {
1156
1069
  v_3x3[k * 3 + t] = vectTmp1[t];
1157
1070
  v_3x3[j * 3 + t] = vectTmp2[t];
1158
- } // transpose vectors back to columns
1159
-
1071
+ }
1160
1072
 
1073
+ // transpose vectors back to columns
1161
1074
  transpose3x3(v_3x3, v_3x3);
1162
1075
  return;
1163
1076
  }
1164
- } // the three eigenvalues are different, just sort the eigenvectors
1077
+ }
1078
+
1079
+ // the three eigenvalues are different, just sort the eigenvectors
1165
1080
  // to align them with the x, y, and z axes
1081
+
1166
1082
  // find the vector with the largest x element, make that vector
1167
1083
  // the first vector
1168
-
1169
-
1170
1084
  maxVal = Math.abs(v_3x3[0]);
1171
1085
  maxI = 0;
1172
-
1173
1086
  for (i = 1; i < 3; i++) {
1174
1087
  if (maxVal < (tmp = Math.abs(v_3x3[i * 3]))) {
1175
1088
  maxVal = tmp;
1176
1089
  maxI = i;
1177
1090
  }
1178
- } // swap eigenvalue and eigenvector
1179
-
1180
-
1091
+ }
1092
+ // swap eigenvalue and eigenvector
1181
1093
  if (maxI !== 0) {
1182
- var eigenValTmp = w_3[maxI];
1094
+ const eigenValTmp = w_3[maxI];
1183
1095
  w_3[maxI] = w_3[0];
1184
1096
  w_3[0] = eigenValTmp;
1185
1097
  swapRowsMatrix_nxn(v_3x3, 3, maxI, 0);
1186
- } // do the same for the y element
1187
-
1188
-
1098
+ }
1099
+ // do the same for the y element
1189
1100
  if (Math.abs(v_3x3[4]) < Math.abs(v_3x3[7])) {
1190
- var _eigenValTmp = w_3[2];
1101
+ const eigenValTmp = w_3[2];
1191
1102
  w_3[2] = w_3[1];
1192
- w_3[1] = _eigenValTmp;
1103
+ w_3[1] = eigenValTmp;
1193
1104
  swapRowsMatrix_nxn(v_3x3, 3, 1, 2);
1194
- } // ensure that the sign of the eigenvectors is correct
1195
-
1105
+ }
1196
1106
 
1107
+ // ensure that the sign of the eigenvectors is correct
1197
1108
  for (i = 0; i < 2; i++) {
1198
1109
  if (v_3x3[i * 3 + i] < 0) {
1199
1110
  v_3x3[i * 3] = -v_3x3[i * 3];
1200
1111
  v_3x3[i * 3 + 1] = -v_3x3[i * 3 + 1];
1201
1112
  v_3x3[i * 3 + 2] = -v_3x3[i * 3 + 2];
1202
1113
  }
1203
- } // set sign of final eigenvector to ensure that determinant is positive
1204
-
1205
-
1114
+ }
1115
+ // set sign of final eigenvector to ensure that determinant is positive
1206
1116
  if (determinant3x3(v_3x3) < 0) {
1207
1117
  v_3x3[6] = -v_3x3[6];
1208
1118
  v_3x3[7] = -v_3x3[7];
1209
1119
  v_3x3[8] = -v_3x3[8];
1210
- } // transpose the eigenvectors back again
1211
-
1120
+ }
1212
1121
 
1122
+ // transpose the eigenvectors back again
1213
1123
  transpose3x3(v_3x3, v_3x3);
1214
1124
  }
1215
1125
  function singularValueDecomposition3x3(a_3x3, u_3x3, w_3, vT_3x3) {
1216
- var i; // copy so that A can be used for U or VT without risk
1217
-
1218
- var B = _toConsumableArray(a_3x3); // temporarily flip if determinant is negative
1219
-
1220
-
1221
- var d = determinant3x3(B);
1126
+ let i;
1127
+ // copy so that A can be used for U or VT without risk
1128
+ const B = [...a_3x3];
1222
1129
 
1130
+ // temporarily flip if determinant is negative
1131
+ const d = determinant3x3(B);
1223
1132
  if (d < 0) {
1224
1133
  for (i = 0; i < 9; i++) {
1225
1134
  B[i] = -B[i];
1226
1135
  }
1227
- } // orthogonalize, diagonalize, etc.
1228
-
1136
+ }
1229
1137
 
1138
+ // orthogonalize, diagonalize, etc.
1230
1139
  orthogonalize3x3(B, u_3x3);
1231
1140
  transpose3x3(B, B);
1232
1141
  multiply3x3_mat3(B, u_3x3, vT_3x3);
1233
1142
  diagonalize3x3(vT_3x3, w_3, vT_3x3);
1234
1143
  multiply3x3_mat3(u_3x3, vT_3x3, u_3x3);
1235
- transpose3x3(vT_3x3, vT_3x3); // re-create the flip
1144
+ transpose3x3(vT_3x3, vT_3x3);
1236
1145
 
1146
+ // re-create the flip
1237
1147
  if (d < 0) {
1238
1148
  w_3[0] = -w_3[0];
1239
1149
  w_3[1] = -w_3[1];
1240
1150
  w_3[2] = -w_3[2];
1241
1151
  }
1242
1152
  }
1153
+
1243
1154
  /**
1244
1155
  * Factor linear equations Ax = b using LU decomposition A = LU. Output factorization LU is in matrix A.
1245
1156
  * @param {Matrix} A square matrix
1246
1157
  * @param {Number} index integer array of pivot indices index[0->n-1]
1247
1158
  * @param {Number} size matrix size
1248
1159
  */
1249
-
1250
1160
  function luFactorLinearSystem(A, index, size) {
1251
- var i;
1252
- var j;
1253
- var k;
1254
- var largest;
1255
- var maxI = 0;
1256
- var sum;
1257
- var temp1;
1258
- var temp2;
1259
- var scale = createArray(size); //
1161
+ let i;
1162
+ let j;
1163
+ let k;
1164
+ let largest;
1165
+ let maxI = 0;
1166
+ let sum;
1167
+ let temp1;
1168
+ let temp2;
1169
+ const scale = createArray(size);
1170
+
1171
+ //
1260
1172
  // Loop over rows to get implicit scaling information
1261
1173
  //
1262
-
1263
1174
  for (i = 0; i < size; i++) {
1264
1175
  for (largest = 0.0, j = 0; j < size; j++) {
1265
1176
  if ((temp2 = Math.abs(A[i * size + j])) > largest) {
1266
1177
  largest = temp2;
1267
1178
  }
1268
1179
  }
1269
-
1270
1180
  if (largest === 0.0) {
1271
1181
  vtkWarningMacro('Unable to factor linear system');
1272
1182
  return 0;
1273
1183
  }
1274
-
1275
1184
  scale[i] = 1.0 / largest;
1276
- } //
1185
+ }
1186
+ //
1277
1187
  // Loop over all columns using Crout's method
1278
1188
  //
1279
-
1280
-
1281
1189
  for (j = 0; j < size; j++) {
1282
1190
  for (i = 0; i < j; i++) {
1283
1191
  sum = A[i * size + j];
1284
-
1285
1192
  for (k = 0; k < i; k++) {
1286
1193
  sum -= A[i * size + k] * A[k * size + j];
1287
1194
  }
1288
-
1289
1195
  A[i * size + j] = sum;
1290
- } //
1196
+ }
1197
+ //
1291
1198
  // Begin search for largest pivot element
1292
1199
  //
1293
-
1294
-
1295
1200
  for (largest = 0.0, i = j; i < size; i++) {
1296
1201
  sum = A[i * size + j];
1297
-
1298
1202
  for (k = 0; k < j; k++) {
1299
1203
  sum -= A[i * size + k] * A[k * size + j];
1300
1204
  }
1301
-
1302
1205
  A[i * size + j] = sum;
1303
-
1304
1206
  if ((temp1 = scale[i] * Math.abs(sum)) >= largest) {
1305
1207
  largest = temp1;
1306
1208
  maxI = i;
1307
1209
  }
1308
- } //
1210
+ }
1211
+ //
1309
1212
  // Check for row interchange
1310
1213
  //
1311
-
1312
-
1313
1214
  if (j !== maxI) {
1314
1215
  for (k = 0; k < size; k++) {
1315
1216
  temp1 = A[maxI * size + k];
1316
1217
  A[maxI * size + k] = A[j * size + k];
1317
1218
  A[j * size + k] = temp1;
1318
1219
  }
1319
-
1320
1220
  scale[maxI] = scale[j];
1321
- } //
1221
+ }
1222
+ //
1322
1223
  // Divide by pivot element and perform elimination
1323
1224
  //
1324
-
1325
-
1326
1225
  index[j] = maxI;
1327
-
1328
1226
  if (Math.abs(A[j * size + j]) <= VTK_SMALL_NUMBER) {
1329
1227
  vtkWarningMacro('Unable to factor linear system');
1330
1228
  return 0;
1331
1229
  }
1332
-
1333
1230
  if (j !== size - 1) {
1334
1231
  temp1 = 1.0 / A[j * size + j];
1335
-
1336
1232
  for (i = j + 1; i < size; i++) {
1337
1233
  A[i * size + j] *= temp1;
1338
1234
  }
1339
1235
  }
1340
1236
  }
1341
-
1342
1237
  return 1;
1343
1238
  }
1344
1239
  function luSolveLinearSystem(A, index, x, size) {
1345
- var i;
1346
- var j;
1347
- var ii;
1348
- var idx;
1349
- var sum; //
1240
+ let i;
1241
+ let j;
1242
+ let ii;
1243
+ let idx;
1244
+ let sum;
1245
+ //
1350
1246
  // Proceed with forward and backsubstitution for L and U
1351
1247
  // matrices. First, forward substitution.
1352
1248
  //
1353
-
1354
1249
  for (ii = -1, i = 0; i < size; i++) {
1355
1250
  idx = index[i];
1356
1251
  sum = x[idx];
1357
1252
  x[idx] = x[i];
1358
-
1359
1253
  if (ii >= 0) {
1360
1254
  for (j = ii; j <= i - 1; j++) {
1361
1255
  sum -= A[i * size + j] * x[j];
@@ -1363,115 +1257,105 @@ function luSolveLinearSystem(A, index, x, size) {
1363
1257
  } else if (sum !== 0.0) {
1364
1258
  ii = i;
1365
1259
  }
1366
-
1367
1260
  x[i] = sum;
1368
- } //
1261
+ }
1262
+ //
1369
1263
  // Now, back substitution
1370
1264
  //
1371
-
1372
-
1373
1265
  for (i = size - 1; i >= 0; i--) {
1374
1266
  sum = x[i];
1375
-
1376
1267
  for (j = i + 1; j < size; j++) {
1377
1268
  sum -= A[i * size + j] * x[j];
1378
1269
  }
1379
-
1380
1270
  x[i] = sum / A[i * size + i];
1381
1271
  }
1382
1272
  }
1383
1273
  function solveLinearSystem(A, x, size) {
1384
1274
  // if we solving something simple, just solve it
1385
1275
  if (size === 2) {
1386
- var y = createArray(2);
1387
- var det = determinant2x2(A[0], A[1], A[2], A[3]);
1388
-
1276
+ const y = createArray(2);
1277
+ const det = determinant2x2(A[0], A[1], A[2], A[3]);
1389
1278
  if (det === 0.0) {
1390
1279
  // Unable to solve linear system
1391
1280
  return 0;
1392
1281
  }
1393
-
1394
1282
  y[0] = (A[3] * x[0] - A[1] * x[1]) / det;
1395
1283
  y[1] = (-(A[2] * x[0]) + A[0] * x[1]) / det;
1396
1284
  x[0] = y[0];
1397
1285
  x[1] = y[1];
1398
1286
  return 1;
1399
1287
  }
1400
-
1401
1288
  if (size === 1) {
1402
1289
  if (A[0] === 0.0) {
1403
1290
  // Unable to solve linear system
1404
1291
  return 0;
1405
1292
  }
1406
-
1407
1293
  x[0] /= A[0];
1408
1294
  return 1;
1409
- } //
1295
+ }
1296
+
1297
+ //
1410
1298
  // System of equations is not trivial, use Crout's method
1411
1299
  //
1412
- // Check on allocation of working vectors
1413
-
1414
1300
 
1415
- var index = createArray(size); // Factor and solve matrix
1301
+ // Check on allocation of working vectors
1302
+ const index = createArray(size);
1416
1303
 
1304
+ // Factor and solve matrix
1417
1305
  if (luFactorLinearSystem(A, index, size) === 0) {
1418
1306
  return 0;
1419
1307
  }
1420
-
1421
1308
  luSolveLinearSystem(A, index, x, size);
1422
1309
  return 1;
1423
- } // Note that A is modified during the inversion !
1310
+ }
1424
1311
 
1312
+ // Note that A is modified during the inversion !
1425
1313
  function invertMatrix(A, AI, size) {
1426
- var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1427
- var column = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
1428
- var tmp1Size = index || createArray(size);
1429
- var tmp2Size = column || createArray(size); // Factor matrix; then begin solving for inverse one column at a time.
1314
+ let index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1315
+ let column = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
1316
+ const tmp1Size = index || createArray(size);
1317
+ const tmp2Size = column || createArray(size);
1318
+
1319
+ // Factor matrix; then begin solving for inverse one column at a time.
1430
1320
  // Note: tmp1Size returned value is used later, tmp2Size is just working
1431
1321
  // memory whose values are not used in LUSolveLinearSystem
1432
-
1433
1322
  if (luFactorLinearSystem(A, tmp1Size, size) === 0) {
1434
1323
  return null;
1435
1324
  }
1436
-
1437
- for (var j = 0; j < size; j++) {
1438
- for (var i = 0; i < size; i++) {
1325
+ for (let j = 0; j < size; j++) {
1326
+ for (let i = 0; i < size; i++) {
1439
1327
  tmp2Size[i] = 0.0;
1440
1328
  }
1441
-
1442
1329
  tmp2Size[j] = 1.0;
1443
1330
  luSolveLinearSystem(A, tmp1Size, tmp2Size, size);
1444
-
1445
- for (var _i4 = 0; _i4 < size; _i4++) {
1446
- AI[_i4 * size + j] = tmp2Size[_i4];
1331
+ for (let i = 0; i < size; i++) {
1332
+ AI[i * size + j] = tmp2Size[i];
1447
1333
  }
1448
1334
  }
1449
-
1450
1335
  return AI;
1451
1336
  }
1452
1337
  function estimateMatrixCondition(A, size) {
1453
- var minValue = +Number.MAX_VALUE;
1454
- var maxValue = -Number.MAX_VALUE; // find the maximum value
1338
+ let minValue = +Number.MAX_VALUE;
1339
+ let maxValue = -Number.MAX_VALUE;
1455
1340
 
1456
- for (var i = 0; i < size; i++) {
1457
- for (var j = i; j < size; j++) {
1341
+ // find the maximum value
1342
+ for (let i = 0; i < size; i++) {
1343
+ for (let j = i; j < size; j++) {
1458
1344
  if (Math.abs(A[i * size + j]) > maxValue) {
1459
1345
  maxValue = Math.abs(A[i * size + j]);
1460
1346
  }
1461
1347
  }
1462
- } // find the minimum diagonal value
1463
-
1348
+ }
1464
1349
 
1465
- for (var _i5 = 0; _i5 < size; _i5++) {
1466
- if (Math.abs(A[_i5 * size + _i5]) < minValue) {
1467
- minValue = Math.abs(A[_i5 * size + _i5]);
1350
+ // find the minimum diagonal value
1351
+ for (let i = 0; i < size; i++) {
1352
+ if (Math.abs(A[i * size + i]) < minValue) {
1353
+ minValue = Math.abs(A[i * size + i]);
1468
1354
  }
1469
1355
  }
1470
-
1471
1356
  if (minValue === 0.0) {
1472
1357
  return Number.MAX_VALUE;
1473
1358
  }
1474
-
1475
1359
  return maxValue / minValue;
1476
1360
  }
1477
1361
  function jacobi(a_3x3, w, v) {
@@ -1483,61 +1367,60 @@ function solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, mt) {
1483
1367
  vtkWarningMacro('Insufficient number of samples. Underdetermined.');
1484
1368
  return 0;
1485
1369
  }
1370
+ let i;
1371
+ let j;
1372
+ let k;
1486
1373
 
1487
- var i;
1488
- var j;
1489
- var k; // set up intermediate variables
1374
+ // set up intermediate variables
1490
1375
  // Allocate matrix to hold X times transpose of X
1491
-
1492
- var XXt = createArray(xOrder * xOrder); // size x by x
1376
+ const XXt = createArray(xOrder * xOrder); // size x by x
1493
1377
  // Allocate the array of eigenvalues and eigenvectors
1378
+ const eigenvals = createArray(xOrder);
1379
+ const eigenvecs = createArray(xOrder * xOrder);
1494
1380
 
1495
- var eigenvals = createArray(xOrder);
1496
- var eigenvecs = createArray(xOrder * xOrder); // Calculate XXt upper half only, due to symmetry
1497
-
1381
+ // Calculate XXt upper half only, due to symmetry
1498
1382
  for (k = 0; k < numberOfSamples; k++) {
1499
1383
  for (i = 0; i < xOrder; i++) {
1500
1384
  for (j = i; j < xOrder; j++) {
1501
1385
  XXt[i * xOrder + j] += xt[k * xOrder + i] * xt[k * xOrder + j];
1502
1386
  }
1503
1387
  }
1504
- } // now fill in the lower half of the XXt matrix
1505
-
1388
+ }
1506
1389
 
1390
+ // now fill in the lower half of the XXt matrix
1507
1391
  for (i = 0; i < xOrder; i++) {
1508
1392
  for (j = 0; j < i; j++) {
1509
1393
  XXt[i * xOrder + j] = XXt[j * xOrder + i];
1510
1394
  }
1511
- } // Compute the eigenvectors and eigenvalues
1395
+ }
1512
1396
 
1397
+ // Compute the eigenvectors and eigenvalues
1398
+ jacobiN(XXt, xOrder, eigenvals, eigenvecs);
1513
1399
 
1514
- jacobiN(XXt, xOrder, eigenvals, eigenvecs); // Smallest eigenval is at the end of the list (xOrder-1), and solution is
1400
+ // Smallest eigenval is at the end of the list (xOrder-1), and solution is
1515
1401
  // corresponding eigenvec.
1516
-
1517
1402
  for (i = 0; i < xOrder; i++) {
1518
1403
  mt[i] = eigenvecs[i * xOrder + xOrder - 1];
1519
1404
  }
1520
-
1521
1405
  return 1;
1522
1406
  }
1523
1407
  function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1524
- var checkHomogeneous = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
1525
-
1408
+ let checkHomogeneous = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
1526
1409
  // check dimensional consistency
1527
1410
  if (numberOfSamples < xOrder || numberOfSamples < yOrder) {
1528
1411
  vtkWarningMacro('Insufficient number of samples. Underdetermined.');
1529
1412
  return 0;
1530
1413
  }
1414
+ const homogenFlags = createArray(yOrder);
1415
+ let allHomogeneous = 1;
1416
+ let hmt;
1417
+ let homogRC = 0;
1418
+ let i;
1419
+ let j;
1420
+ let k;
1421
+ let someHomogeneous = 0;
1531
1422
 
1532
- var homogenFlags = createArray(yOrder);
1533
- var allHomogeneous = 1;
1534
- var hmt;
1535
- var homogRC = 0;
1536
- var i;
1537
- var j;
1538
- var k;
1539
- var someHomogeneous = 0; // Ok, first init some flags check and see if all the systems are homogeneous
1540
-
1423
+ // Ok, first init some flags check and see if all the systems are homogeneous
1541
1424
  if (checkHomogeneous) {
1542
1425
  // If Y' is zero, it's a homogeneous system and can't be solved via
1543
1426
  // the pseudoinverse method. Detect this case, warn the user, and
@@ -1545,11 +1428,11 @@ function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1545
1428
  // really make much sense for yOrder to be greater than one in this case,
1546
1429
  // since that's just yOrder occurrences of a 0 vector on the RHS, but
1547
1430
  // we allow it anyway. N
1431
+
1548
1432
  // Initialize homogeneous flags on a per-right-hand-side basis
1549
1433
  for (j = 0; j < yOrder; j++) {
1550
1434
  homogenFlags[j] = 1;
1551
1435
  }
1552
-
1553
1436
  for (i = 0; i < numberOfSamples; i++) {
1554
1437
  for (j = 0; j < yOrder; j++) {
1555
1438
  if (Math.abs(yt[i * yOrder + j]) > VTK_SMALL_NUMBER) {
@@ -1557,17 +1440,17 @@ function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1557
1440
  homogenFlags[j] = 0;
1558
1441
  }
1559
1442
  }
1560
- } // If we've got one system, and it's homogeneous, do it and bail out quickly.
1561
-
1443
+ }
1562
1444
 
1445
+ // If we've got one system, and it's homogeneous, do it and bail out quickly.
1563
1446
  if (allHomogeneous && yOrder === 1) {
1564
1447
  vtkWarningMacro('Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()');
1565
1448
  return solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, mt);
1566
- } // Ok, we've got more than one system of equations.
1449
+ }
1450
+
1451
+ // Ok, we've got more than one system of equations.
1567
1452
  // Figure out if we need to calculate the homogeneous equation solution for
1568
1453
  // any of them.
1569
-
1570
-
1571
1454
  if (allHomogeneous) {
1572
1455
  someHomogeneous = 1;
1573
1456
  } else {
@@ -1577,62 +1460,60 @@ function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1577
1460
  }
1578
1461
  }
1579
1462
  }
1580
- } // If necessary, solve the homogeneous problem
1581
-
1463
+ }
1582
1464
 
1465
+ // If necessary, solve the homogeneous problem
1583
1466
  if (someHomogeneous) {
1584
1467
  // hmt is the homogeneous equation version of mt, the general solution.
1585
1468
  // hmt should be xOrder x yOrder, but since we are solving only the homogeneous part, here it is xOrder x 1
1586
- hmt = createArray(xOrder); // Ok, solve the homogeneous problem
1469
+ hmt = createArray(xOrder);
1587
1470
 
1471
+ // Ok, solve the homogeneous problem
1588
1472
  homogRC = solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, hmt);
1589
- } // set up intermediate variables
1590
-
1591
-
1592
- var XXt = createArray(xOrder * xOrder); // size x by x
1473
+ }
1593
1474
 
1594
- var XXtI = createArray(xOrder * xOrder); // size x by x
1475
+ // set up intermediate variables
1476
+ const XXt = createArray(xOrder * xOrder); // size x by x
1477
+ const XXtI = createArray(xOrder * xOrder); // size x by x
1478
+ const XYt = createArray(xOrder * yOrder); // size x by y
1595
1479
 
1596
- var XYt = createArray(xOrder * yOrder); // size x by y
1597
1480
  // first find the pseudoinverse matrix
1598
-
1599
1481
  for (k = 0; k < numberOfSamples; k++) {
1600
1482
  for (i = 0; i < xOrder; i++) {
1601
1483
  // first calculate the XXt matrix, only do the upper half (symmetrical)
1602
1484
  for (j = i; j < xOrder; j++) {
1603
1485
  XXt[i * xOrder + j] += xt[k * xOrder + i] * xt[k * xOrder + j];
1604
- } // now calculate the XYt matrix
1605
-
1486
+ }
1606
1487
 
1488
+ // now calculate the XYt matrix
1607
1489
  for (j = 0; j < yOrder; j++) {
1608
1490
  XYt[i * yOrder + j] += xt[k * xOrder + i] * yt[k * yOrder + j];
1609
1491
  }
1610
1492
  }
1611
- } // now fill in the lower half of the XXt matrix
1612
-
1493
+ }
1613
1494
 
1495
+ // now fill in the lower half of the XXt matrix
1614
1496
  for (i = 0; i < xOrder; i++) {
1615
1497
  for (j = 0; j < i; j++) {
1616
1498
  XXt[i * xOrder + j] = XXt[j * xOrder + i];
1617
1499
  }
1618
1500
  }
1501
+ const successFlag = invertMatrix(XXt, XXtI, xOrder);
1619
1502
 
1620
- var successFlag = invertMatrix(XXt, XXtI, xOrder); // next get the inverse of XXt
1621
-
1503
+ // next get the inverse of XXt
1622
1504
  if (successFlag) {
1623
1505
  for (i = 0; i < xOrder; i++) {
1624
1506
  for (j = 0; j < yOrder; j++) {
1625
1507
  mt[i * yOrder + j] = 0.0;
1626
-
1627
1508
  for (k = 0; k < xOrder; k++) {
1628
1509
  mt[i * yOrder + j] += XXtI[i * xOrder + k] * XYt[k * yOrder + j];
1629
1510
  }
1630
1511
  }
1631
1512
  }
1632
- } // Fix up any of the solutions that correspond to the homogeneous equation
1633
- // problem.
1634
-
1513
+ }
1635
1514
 
1515
+ // Fix up any of the solutions that correspond to the homogeneous equation
1516
+ // problem.
1636
1517
  if (someHomogeneous) {
1637
1518
  for (j = 0; j < yOrder; j++) {
1638
1519
  if (homogenFlags[j]) {
@@ -1643,16 +1524,13 @@ function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1643
1524
  }
1644
1525
  }
1645
1526
  }
1646
-
1647
1527
  if (someHomogeneous) {
1648
1528
  return homogRC && successFlag;
1649
1529
  }
1650
-
1651
1530
  return successFlag;
1652
1531
  }
1653
1532
  function hex2float(hexStr) {
1654
- var outFloatArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0.5, 1];
1655
-
1533
+ let outFloatArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0.5, 1];
1656
1534
  switch (hexStr.length) {
1657
1535
  case 3:
1658
1536
  // abc => #aabbcc
@@ -1660,28 +1538,24 @@ function hex2float(hexStr) {
1660
1538
  outFloatArray[1] = parseInt(hexStr[1], 16) * 17 / 255;
1661
1539
  outFloatArray[2] = parseInt(hexStr[2], 16) * 17 / 255;
1662
1540
  return outFloatArray;
1663
-
1664
1541
  case 4:
1665
1542
  // #abc => #aabbcc
1666
1543
  outFloatArray[0] = parseInt(hexStr[1], 16) * 17 / 255;
1667
1544
  outFloatArray[1] = parseInt(hexStr[2], 16) * 17 / 255;
1668
1545
  outFloatArray[2] = parseInt(hexStr[3], 16) * 17 / 255;
1669
1546
  return outFloatArray;
1670
-
1671
1547
  case 6:
1672
1548
  // ab01df => #ab01df
1673
1549
  outFloatArray[0] = parseInt(hexStr.substr(0, 2), 16) / 255;
1674
1550
  outFloatArray[1] = parseInt(hexStr.substr(2, 2), 16) / 255;
1675
1551
  outFloatArray[2] = parseInt(hexStr.substr(4, 2), 16) / 255;
1676
1552
  return outFloatArray;
1677
-
1678
1553
  case 7:
1679
1554
  // #ab01df
1680
1555
  outFloatArray[0] = parseInt(hexStr.substr(1, 2), 16) / 255;
1681
1556
  outFloatArray[1] = parseInt(hexStr.substr(3, 2), 16) / 255;
1682
1557
  outFloatArray[2] = parseInt(hexStr.substr(5, 2), 16) / 255;
1683
1558
  return outFloatArray;
1684
-
1685
1559
  case 9:
1686
1560
  // #ab01df00
1687
1561
  outFloatArray[0] = parseInt(hexStr.substr(1, 2), 16) / 255;
@@ -1689,46 +1563,35 @@ function hex2float(hexStr) {
1689
1563
  outFloatArray[2] = parseInt(hexStr.substr(5, 2), 16) / 255;
1690
1564
  outFloatArray[3] = parseInt(hexStr.substr(7, 2), 16) / 255;
1691
1565
  return outFloatArray;
1692
-
1693
1566
  default:
1694
1567
  return outFloatArray;
1695
1568
  }
1696
1569
  }
1697
1570
  function rgb2hsv(rgb, hsv) {
1698
- var h;
1699
- var s;
1700
-
1701
- var _rgb = _slicedToArray(rgb, 3),
1702
- r = _rgb[0],
1703
- g = _rgb[1],
1704
- b = _rgb[2];
1705
-
1706
- var onethird = 1.0 / 3.0;
1707
- var onesixth = 1.0 / 6.0;
1708
- var twothird = 2.0 / 3.0;
1709
- var cmax = r;
1710
- var cmin = r;
1711
-
1571
+ let h;
1572
+ let s;
1573
+ const [r, g, b] = rgb;
1574
+ const onethird = 1.0 / 3.0;
1575
+ const onesixth = 1.0 / 6.0;
1576
+ const twothird = 2.0 / 3.0;
1577
+ let cmax = r;
1578
+ let cmin = r;
1712
1579
  if (g > cmax) {
1713
1580
  cmax = g;
1714
1581
  } else if (g < cmin) {
1715
1582
  cmin = g;
1716
1583
  }
1717
-
1718
1584
  if (b > cmax) {
1719
1585
  cmax = b;
1720
1586
  } else if (b < cmin) {
1721
1587
  cmin = b;
1722
1588
  }
1723
-
1724
- var v = cmax;
1725
-
1589
+ const v = cmax;
1726
1590
  if (v > 0.0) {
1727
1591
  s = (cmax - cmin) / cmax;
1728
1592
  } else {
1729
1593
  s = 0.0;
1730
1594
  }
1731
-
1732
1595
  if (s > 0) {
1733
1596
  if (r === cmax) {
1734
1597
  h = onesixth * (g - b) / (cmax - cmin);
@@ -1737,33 +1600,29 @@ function rgb2hsv(rgb, hsv) {
1737
1600
  } else {
1738
1601
  h = twothird + onesixth * (r - g) / (cmax - cmin);
1739
1602
  }
1740
-
1741
1603
  if (h < 0.0) {
1742
1604
  h += 1.0;
1743
1605
  }
1744
1606
  } else {
1745
1607
  h = 0.0;
1746
- } // Set the values back to the array
1747
-
1608
+ }
1748
1609
 
1610
+ // Set the values back to the array
1749
1611
  hsv[0] = h;
1750
1612
  hsv[1] = s;
1751
1613
  hsv[2] = v;
1752
1614
  }
1753
1615
  function hsv2rgb(hsv, rgb) {
1754
- var _hsv = _slicedToArray(hsv, 3),
1755
- h = _hsv[0],
1756
- s = _hsv[1],
1757
- v = _hsv[2];
1758
-
1759
- var onethird = 1.0 / 3.0;
1760
- var onesixth = 1.0 / 6.0;
1761
- var twothird = 2.0 / 3.0;
1762
- var fivesixth = 5.0 / 6.0;
1763
- var r;
1764
- var g;
1765
- var b; // compute RGB from HSV
1766
-
1616
+ const [h, s, v] = hsv;
1617
+ const onethird = 1.0 / 3.0;
1618
+ const onesixth = 1.0 / 6.0;
1619
+ const twothird = 2.0 / 3.0;
1620
+ const fivesixth = 5.0 / 6.0;
1621
+ let r;
1622
+ let g;
1623
+ let b;
1624
+
1625
+ // compute RGB from HSV
1767
1626
  if (h > onesixth && h <= onethird) {
1768
1627
  // green/red
1769
1628
  g = 1.0;
@@ -1794,89 +1653,73 @@ function hsv2rgb(hsv, rgb) {
1794
1653
  r = 1.0;
1795
1654
  g = h / onesixth;
1796
1655
  b = 0.0;
1797
- } // add Saturation to the equation.
1798
-
1656
+ }
1799
1657
 
1658
+ // add Saturation to the equation.
1800
1659
  r = s * r + (1.0 - s);
1801
1660
  g = s * g + (1.0 - s);
1802
1661
  b = s * b + (1.0 - s);
1803
1662
  r *= v;
1804
1663
  g *= v;
1805
- b *= v; // Assign back to the array
1664
+ b *= v;
1806
1665
 
1666
+ // Assign back to the array
1807
1667
  rgb[0] = r;
1808
1668
  rgb[1] = g;
1809
1669
  rgb[2] = b;
1810
1670
  }
1811
1671
  function lab2xyz(lab, xyz) {
1812
1672
  // LAB to XYZ
1813
- var _lab = _slicedToArray(lab, 3),
1814
- L = _lab[0],
1815
- a = _lab[1],
1816
- b = _lab[2];
1817
-
1818
- var var_Y = (L + 16) / 116;
1819
- var var_X = a / 500 + var_Y;
1820
- var var_Z = var_Y - b / 200;
1821
-
1822
- if (Math.pow(var_Y, 3) > 0.008856) {
1823
- var_Y = Math.pow(var_Y, 3);
1673
+ const [L, a, b] = lab;
1674
+ let var_Y = (L + 16) / 116;
1675
+ let var_X = a / 500 + var_Y;
1676
+ let var_Z = var_Y - b / 200;
1677
+ if (var_Y ** 3 > 0.008856) {
1678
+ var_Y **= 3;
1824
1679
  } else {
1825
1680
  var_Y = (var_Y - 16.0 / 116.0) / 7.787;
1826
1681
  }
1827
-
1828
- if (Math.pow(var_X, 3) > 0.008856) {
1829
- var_X = Math.pow(var_X, 3);
1682
+ if (var_X ** 3 > 0.008856) {
1683
+ var_X **= 3;
1830
1684
  } else {
1831
1685
  var_X = (var_X - 16.0 / 116.0) / 7.787;
1832
1686
  }
1833
-
1834
- if (Math.pow(var_Z, 3) > 0.008856) {
1835
- var_Z = Math.pow(var_Z, 3);
1687
+ if (var_Z ** 3 > 0.008856) {
1688
+ var_Z **= 3;
1836
1689
  } else {
1837
1690
  var_Z = (var_Z - 16.0 / 116.0) / 7.787;
1838
1691
  }
1839
-
1840
- var ref_X = 0.9505;
1841
- var ref_Y = 1.0;
1842
- var ref_Z = 1.089;
1692
+ const ref_X = 0.9505;
1693
+ const ref_Y = 1.0;
1694
+ const ref_Z = 1.089;
1843
1695
  xyz[0] = ref_X * var_X; // ref_X = 0.9505 Observer= 2 deg Illuminant= D65
1844
-
1845
1696
  xyz[1] = ref_Y * var_Y; // ref_Y = 1.000
1846
-
1847
1697
  xyz[2] = ref_Z * var_Z; // ref_Z = 1.089
1848
1698
  }
1849
- function xyz2lab(xyz, lab) {
1850
- var _xyz = _slicedToArray(xyz, 3),
1851
- x = _xyz[0],
1852
- y = _xyz[1],
1853
- z = _xyz[2];
1854
1699
 
1855
- var ref_X = 0.9505;
1856
- var ref_Y = 1.0;
1857
- var ref_Z = 1.089;
1858
- var var_X = x / ref_X; // ref_X = 0.9505 Observer= 2 deg, Illuminant= D65
1859
-
1860
- var var_Y = y / ref_Y; // ref_Y = 1.000
1861
-
1862
- var var_Z = z / ref_Z; // ref_Z = 1.089
1863
-
1864
- if (var_X > 0.008856) var_X = Math.pow(var_X, 1.0 / 3.0);else var_X = 7.787 * var_X + 16.0 / 116.0;
1865
- if (var_Y > 0.008856) var_Y = Math.pow(var_Y, 1.0 / 3.0);else var_Y = 7.787 * var_Y + 16.0 / 116.0;
1866
- if (var_Z > 0.008856) var_Z = Math.pow(var_Z, 1.0 / 3.0);else var_Z = 7.787 * var_Z + 16.0 / 116.0;
1700
+ function xyz2lab(xyz, lab) {
1701
+ const [x, y, z] = xyz;
1702
+ const ref_X = 0.9505;
1703
+ const ref_Y = 1.0;
1704
+ const ref_Z = 1.089;
1705
+ let var_X = x / ref_X; // ref_X = 0.9505 Observer= 2 deg, Illuminant= D65
1706
+ let var_Y = y / ref_Y; // ref_Y = 1.000
1707
+ let var_Z = z / ref_Z; // ref_Z = 1.089
1708
+
1709
+ if (var_X > 0.008856) var_X **= 1.0 / 3.0;else var_X = 7.787 * var_X + 16.0 / 116.0;
1710
+ if (var_Y > 0.008856) var_Y **= 1.0 / 3.0;else var_Y = 7.787 * var_Y + 16.0 / 116.0;
1711
+ if (var_Z > 0.008856) var_Z **= 1.0 / 3.0;else var_Z = 7.787 * var_Z + 16.0 / 116.0;
1867
1712
  lab[0] = 116 * var_Y - 16;
1868
1713
  lab[1] = 500 * (var_X - var_Y);
1869
1714
  lab[2] = 200 * (var_Y - var_Z);
1870
1715
  }
1871
1716
  function xyz2rgb(xyz, rgb) {
1872
- var _xyz2 = _slicedToArray(xyz, 3),
1873
- x = _xyz2[0],
1874
- y = _xyz2[1],
1875
- z = _xyz2[2];
1876
-
1877
- var r = x * 3.2406 + y * -1.5372 + z * -0.4986;
1878
- var g = x * -0.9689 + y * 1.8758 + z * 0.0415;
1879
- var b = x * 0.0557 + y * -0.204 + z * 1.057; // The following performs a "gamma correction" specified by the sRGB color
1717
+ const [x, y, z] = xyz;
1718
+ let r = x * 3.2406 + y * -1.5372 + z * -0.4986;
1719
+ let g = x * -0.9689 + y * 1.8758 + z * 0.0415;
1720
+ let b = x * 0.0557 + y * -0.204 + z * 1.057;
1721
+
1722
+ // The following performs a "gamma correction" specified by the sRGB color
1880
1723
  // space. sRGB is defined by a canonical definition of a display monitor and
1881
1724
  // has been standardized by the International Electrotechnical Commission (IEC
1882
1725
  // 61966-2-1). The nonlinearity of the correction is designed to make the
@@ -1884,36 +1727,33 @@ function xyz2rgb(xyz, rgb) {
1884
1727
  // several applications including Adobe Photoshop and Microsoft Windows color
1885
1728
  // management. OpenGL is agnostic on its RGB color space, but it is reasonable
1886
1729
  // to assume it is close to this one.
1730
+ if (r > 0.0031308) r = 1.055 * r ** (1 / 2.4) - 0.055;else r *= 12.92;
1731
+ if (g > 0.0031308) g = 1.055 * g ** (1 / 2.4) - 0.055;else g *= 12.92;
1732
+ if (b > 0.0031308) b = 1.055 * b ** (1 / 2.4) - 0.055;else b *= 12.92;
1887
1733
 
1888
- if (r > 0.0031308) r = 1.055 * Math.pow(r, 1 / 2.4) - 0.055;else r *= 12.92;
1889
- if (g > 0.0031308) g = 1.055 * Math.pow(g, 1 / 2.4) - 0.055;else g *= 12.92;
1890
- if (b > 0.0031308) b = 1.055 * Math.pow(b, 1 / 2.4) - 0.055;else b *= 12.92; // Clip colors. ideally we would do something that is perceptually closest
1734
+ // Clip colors. ideally we would do something that is perceptually closest
1891
1735
  // (since we can see colors outside of the display gamut), but this seems to
1892
1736
  // work well enough.
1893
-
1894
- var maxVal = r;
1737
+ let maxVal = r;
1895
1738
  if (maxVal < g) maxVal = g;
1896
1739
  if (maxVal < b) maxVal = b;
1897
-
1898
1740
  if (maxVal > 1.0) {
1899
1741
  r /= maxVal;
1900
1742
  g /= maxVal;
1901
1743
  b /= maxVal;
1902
1744
  }
1903
-
1904
1745
  if (r < 0) r = 0;
1905
1746
  if (g < 0) g = 0;
1906
- if (b < 0) b = 0; // Push values back to array
1747
+ if (b < 0) b = 0;
1907
1748
 
1749
+ // Push values back to array
1908
1750
  rgb[0] = r;
1909
1751
  rgb[1] = g;
1910
1752
  rgb[2] = b;
1911
1753
  }
1912
1754
  function rgb2xyz(rgb, xyz) {
1913
- var _rgb2 = _slicedToArray(rgb, 3),
1914
- r = _rgb2[0],
1915
- g = _rgb2[1],
1916
- b = _rgb2[2]; // The following performs a "gamma correction" specified by the sRGB color
1755
+ let [r, g, b] = rgb;
1756
+ // The following performs a "gamma correction" specified by the sRGB color
1917
1757
  // space. sRGB is defined by a canonical definition of a display monitor and
1918
1758
  // has been standardized by the International Electrotechnical Commission (IEC
1919
1759
  // 61966-2-1). The nonlinearity of the correction is designed to make the
@@ -1921,23 +1761,22 @@ function rgb2xyz(rgb, xyz) {
1921
1761
  // several applications including Adobe Photoshop and Microsoft Windows color
1922
1762
  // management. OpenGL is agnostic on its RGB color space, but it is reasonable
1923
1763
  // to assume it is close to this one.
1764
+ if (r > 0.04045) r = ((r + 0.055) / 1.055) ** 2.4;else r /= 12.92;
1765
+ if (g > 0.04045) g = ((g + 0.055) / 1.055) ** 2.4;else g /= 12.92;
1766
+ if (b > 0.04045) b = ((b + 0.055) / 1.055) ** 2.4;else b /= 12.92;
1924
1767
 
1925
-
1926
- if (r > 0.04045) r = Math.pow((r + 0.055) / 1.055, 2.4);else r /= 12.92;
1927
- if (g > 0.04045) g = Math.pow((g + 0.055) / 1.055, 2.4);else g /= 12.92;
1928
- if (b > 0.04045) b = Math.pow((b + 0.055) / 1.055, 2.4);else b /= 12.92; // Observer. = 2 deg, Illuminant = D65
1929
-
1768
+ // Observer. = 2 deg, Illuminant = D65
1930
1769
  xyz[0] = r * 0.4124 + g * 0.3576 + b * 0.1805;
1931
1770
  xyz[1] = r * 0.2126 + g * 0.7152 + b * 0.0722;
1932
1771
  xyz[2] = r * 0.0193 + g * 0.1192 + b * 0.9505;
1933
1772
  }
1934
1773
  function rgb2lab(rgb, lab) {
1935
- var xyz = [0, 0, 0];
1774
+ const xyz = [0, 0, 0];
1936
1775
  rgb2xyz(rgb, xyz);
1937
1776
  xyz2lab(xyz, lab);
1938
1777
  }
1939
1778
  function lab2rgb(lab, rgb) {
1940
- var xyz = [0, 0, 0];
1779
+ const xyz = [0, 0, 0];
1941
1780
  lab2xyz(lab, xyz);
1942
1781
  xyz2rgb(xyz, rgb);
1943
1782
  }
@@ -1953,10 +1792,10 @@ function uninitializeBounds(bounds) {
1953
1792
  function areBoundsInitialized(bounds) {
1954
1793
  return !(bounds[1] - bounds[0] < 0.0);
1955
1794
  }
1795
+
1956
1796
  /**
1957
1797
  * @deprecated please use vtkBoundingBox.addPoints(vtkBoundingBox.reset([]), points)
1958
1798
  */
1959
-
1960
1799
  function computeBoundsFromPoints(point1, point2, bounds) {
1961
1800
  bounds[0] = Math.min(point1[0], point2[0]);
1962
1801
  bounds[1] = Math.max(point1[0], point2[0]);
@@ -1970,23 +1809,20 @@ function clampValue(value, minValue, maxValue) {
1970
1809
  if (value < minValue) {
1971
1810
  return minValue;
1972
1811
  }
1973
-
1974
1812
  if (value > maxValue) {
1975
1813
  return maxValue;
1976
1814
  }
1977
-
1978
1815
  return value;
1979
1816
  }
1980
1817
  function clampVector(vector, minVector, maxVector) {
1981
- var out = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [0, 0, 0];
1818
+ let out = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [0, 0, 0];
1982
1819
  out[0] = clampValue(vector[0], minVector[0], maxVector[0]);
1983
1820
  out[1] = clampValue(vector[1], minVector[1], maxVector[1]);
1984
1821
  out[2] = clampValue(vector[2], minVector[2], maxVector[2]);
1985
1822
  return out;
1986
1823
  }
1987
1824
  function clampAndNormalizeValue(value, range) {
1988
- var result = 0;
1989
-
1825
+ let result = 0;
1990
1826
  if (range[0] !== range[1]) {
1991
1827
  // clamp
1992
1828
  if (value < range[0]) {
@@ -1995,64 +1831,55 @@ function clampAndNormalizeValue(value, range) {
1995
1831
  result = range[1];
1996
1832
  } else {
1997
1833
  result = value;
1998
- } // normalize
1999
-
2000
-
1834
+ }
1835
+ // normalize
2001
1836
  result = (result - range[0]) / (range[1] - range[0]);
2002
1837
  }
2003
-
2004
1838
  return result;
2005
1839
  }
2006
- var getScalarTypeFittingRange = notImplemented('GetScalarTypeFittingRange');
2007
- var getAdjustedScalarRange = notImplemented('GetAdjustedScalarRange');
1840
+ const getScalarTypeFittingRange = notImplemented('GetScalarTypeFittingRange');
1841
+ const getAdjustedScalarRange = notImplemented('GetAdjustedScalarRange');
2008
1842
  function extentIsWithinOtherExtent(extent1, extent2) {
2009
1843
  if (!extent1 || !extent2) {
2010
1844
  return 0;
2011
1845
  }
2012
-
2013
- for (var i = 0; i < 6; i += 2) {
1846
+ for (let i = 0; i < 6; i += 2) {
2014
1847
  if (extent1[i] < extent2[i] || extent1[i] > extent2[i + 1] || extent1[i + 1] < extent2[i] || extent1[i + 1] > extent2[i + 1]) {
2015
1848
  return 0;
2016
1849
  }
2017
1850
  }
2018
-
2019
1851
  return 1;
2020
1852
  }
2021
1853
  function boundsIsWithinOtherBounds(bounds1_6, bounds2_6, delta_3) {
2022
1854
  if (!bounds1_6 || !bounds2_6) {
2023
1855
  return 0;
2024
1856
  }
2025
-
2026
- for (var i = 0; i < 6; i += 2) {
1857
+ for (let i = 0; i < 6; i += 2) {
2027
1858
  if (bounds1_6[i] + delta_3[i / 2] < bounds2_6[i] || bounds1_6[i] - delta_3[i / 2] > bounds2_6[i + 1] || bounds1_6[i + 1] + delta_3[i / 2] < bounds2_6[i] || bounds1_6[i + 1] - delta_3[i / 2] > bounds2_6[i + 1]) {
2028
1859
  return 0;
2029
1860
  }
2030
1861
  }
2031
-
2032
1862
  return 1;
2033
1863
  }
2034
1864
  function pointIsWithinBounds(point_3, bounds_6, delta_3) {
2035
1865
  if (!point_3 || !bounds_6 || !delta_3) {
2036
1866
  return 0;
2037
1867
  }
2038
-
2039
- for (var i = 0; i < 3; i++) {
1868
+ for (let i = 0; i < 3; i++) {
2040
1869
  if (point_3[i] + delta_3[i] < bounds_6[2 * i] || point_3[i] - delta_3[i] > bounds_6[2 * i + 1]) {
2041
1870
  return 0;
2042
1871
  }
2043
1872
  }
2044
-
2045
1873
  return 1;
2046
1874
  }
2047
1875
  function solve3PointCircle(p1, p2, p3, center) {
2048
- var v21 = createArray(3);
2049
- var v32 = createArray(3);
2050
- var v13 = createArray(3);
2051
- var v12 = createArray(3);
2052
- var v23 = createArray(3);
2053
- var v31 = createArray(3);
2054
-
2055
- for (var i = 0; i < 3; ++i) {
1876
+ const v21 = createArray(3);
1877
+ const v32 = createArray(3);
1878
+ const v13 = createArray(3);
1879
+ const v12 = createArray(3);
1880
+ const v23 = createArray(3);
1881
+ const v31 = createArray(3);
1882
+ for (let i = 0; i < 3; ++i) {
2056
1883
  v21[i] = p1[i] - p2[i];
2057
1884
  v32[i] = p2[i] - p3[i];
2058
1885
  v13[i] = p3[i] - p1[i];
@@ -2060,256 +1887,241 @@ function solve3PointCircle(p1, p2, p3, center) {
2060
1887
  v23[i] = -v32[i];
2061
1888
  v31[i] = -v13[i];
2062
1889
  }
2063
-
2064
- var norm12 = norm(v12);
2065
- var norm23 = norm(v23);
2066
- var norm13 = norm(v13);
2067
- var crossv21v32 = createArray(3);
1890
+ const norm12 = norm(v12);
1891
+ const norm23 = norm(v23);
1892
+ const norm13 = norm(v13);
1893
+ const crossv21v32 = createArray(3);
2068
1894
  cross(v21, v32, crossv21v32);
2069
- var normCross = norm(crossv21v32);
2070
- var radius = norm12 * norm23 * norm13 / (2 * normCross);
2071
- var normCross22 = 2 * normCross * normCross;
2072
- var alpha = norm23 * norm23 * dot(v21, v31) / normCross22;
2073
- var beta = norm13 * norm13 * dot(v12, v32) / normCross22;
2074
- var gamma = norm12 * norm12 * dot(v13, v23) / normCross22;
2075
-
2076
- for (var _i6 = 0; _i6 < 3; ++_i6) {
2077
- center[_i6] = alpha * p1[_i6] + beta * p2[_i6] + gamma * p3[_i6];
1895
+ const normCross = norm(crossv21v32);
1896
+ const radius = norm12 * norm23 * norm13 / (2 * normCross);
1897
+ const normCross22 = 2 * normCross * normCross;
1898
+ const alpha = norm23 * norm23 * dot(v21, v31) / normCross22;
1899
+ const beta = norm13 * norm13 * dot(v12, v32) / normCross22;
1900
+ const gamma = norm12 * norm12 * dot(v13, v23) / normCross22;
1901
+ for (let i = 0; i < 3; ++i) {
1902
+ center[i] = alpha * p1[i] + beta * p2[i] + gamma * p3[i];
2078
1903
  }
2079
-
2080
1904
  return radius;
2081
1905
  }
2082
- var inf = Infinity;
2083
- var negInf = -Infinity;
2084
- var isInf = function isInf(value) {
2085
- return !Number.isFinite(value);
2086
- };
2087
- var isFinite = Number.isFinite,
2088
- isNaN = Number.isNaN;
2089
- var isNan = isNaN; // JavaScript - add-on ----------------------
1906
+ const inf = Infinity;
1907
+ const negInf = -Infinity;
1908
+ const isInf = value => !Number.isFinite(value);
1909
+ const {
1910
+ isFinite,
1911
+ isNaN
1912
+ } = Number;
1913
+ const isNan = isNaN;
1914
+
1915
+ // JavaScript - add-on ----------------------
2090
1916
 
2091
1917
  function createUninitializedBounds() {
2092
- return [].concat([Number.MAX_VALUE, -Number.MAX_VALUE, // X
2093
- Number.MAX_VALUE, -Number.MAX_VALUE, // Y
1918
+ return [].concat([Number.MAX_VALUE, -Number.MAX_VALUE,
1919
+ // X
1920
+ Number.MAX_VALUE, -Number.MAX_VALUE,
1921
+ // Y
2094
1922
  Number.MAX_VALUE, -Number.MAX_VALUE // Z
2095
1923
  ]);
2096
1924
  }
2097
- function getMajorAxisIndex(vector) {
2098
- var maxValue = -1;
2099
- var axisIndex = -1;
2100
-
2101
- for (var i = 0; i < vector.length; i++) {
2102
- var value = Math.abs(vector[i]);
2103
1925
 
1926
+ function getMajorAxisIndex(vector) {
1927
+ let maxValue = -1;
1928
+ let axisIndex = -1;
1929
+ for (let i = 0; i < vector.length; i++) {
1930
+ const value = Math.abs(vector[i]);
2104
1931
  if (value > maxValue) {
2105
1932
  axisIndex = i;
2106
1933
  maxValue = value;
2107
1934
  }
2108
1935
  }
2109
-
2110
1936
  return axisIndex;
2111
- } // Return the closest orthogonal matrix of 1, -1 and 0
1937
+ }
1938
+
1939
+ // Return the closest orthogonal matrix of 1, -1 and 0
2112
1940
  // It works for both column major and row major matrices
2113
1941
  // This function iteratively associate a column with a row by choosing
2114
1942
  // the greatest absolute value from the remaining row and columns
2115
1943
  // For each association, a -1 or a 1 is set in the output, depending on
2116
1944
  // the sign of the value in the original matrix
2117
-
2118
1945
  function getSparseOrthogonalMatrix(matrix) {
2119
- var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
1946
+ let n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
2120
1947
  // Initialize rows and columns to available indices
2121
- var rows = new Array(n);
2122
- var cols = new Array(n);
2123
-
2124
- for (var i = 0; i < n; ++i) {
1948
+ const rows = new Array(n);
1949
+ const cols = new Array(n);
1950
+ for (let i = 0; i < n; ++i) {
2125
1951
  rows[i] = i;
2126
1952
  cols[i] = i;
2127
- } // No need for the last iteration: i = 0
2128
-
2129
-
2130
- for (var _i7 = n - 1; _i7 > 0; _i7--) {
1953
+ }
1954
+ // No need for the last iteration: i = 0
1955
+ for (let i = n - 1; i > 0; i--) {
2131
1956
  // Loop invariant:
2132
1957
  // rows[0:i] and cols[0:i] contain the remaining rows and columns
2133
1958
  // rows]i:n[ and cols]i:n[ contain the associations found (rows[k] is associated with cols[k])
2134
- var bestValue = -Infinity;
2135
- var bestRowI = 0;
2136
- var bestColI = 0;
2137
-
2138
- for (var rowI = 0; rowI <= _i7; ++rowI) {
2139
- var row = rows[rowI];
2140
-
2141
- for (var colI = 0; colI <= _i7; ++colI) {
2142
- var col = cols[colI];
2143
- var absVal = Math.abs(matrix[row + n * col]);
2144
-
1959
+ let bestValue = -Infinity;
1960
+ let bestRowI = 0;
1961
+ let bestColI = 0;
1962
+ for (let rowI = 0; rowI <= i; ++rowI) {
1963
+ const row = rows[rowI];
1964
+ for (let colI = 0; colI <= i; ++colI) {
1965
+ const col = cols[colI];
1966
+ const absVal = Math.abs(matrix[row + n * col]);
2145
1967
  if (absVal > bestValue) {
2146
1968
  bestValue = absVal;
2147
1969
  bestRowI = rowI;
2148
1970
  bestColI = colI;
2149
1971
  }
2150
1972
  }
2151
- } // Found an association between rows[bestRowI] and cols[bestColI]
1973
+ }
1974
+ // Found an association between rows[bestRowI] and cols[bestColI]
2152
1975
  // Put both at the end of their array by swapping with i
1976
+ [rows[i], rows[bestRowI]] = [rows[bestRowI], rows[i]];
1977
+ [cols[i], cols[bestColI]] = [cols[bestColI], cols[i]];
1978
+ }
2153
1979
 
2154
-
2155
- var _ref = [rows[bestRowI], rows[_i7]];
2156
- rows[_i7] = _ref[0];
2157
- rows[bestRowI] = _ref[1];
2158
- var _ref2 = [cols[bestColI], cols[_i7]];
2159
- cols[_i7] = _ref2[0];
2160
- cols[bestColI] = _ref2[1];
2161
- } // Convert row/column association to a matrix
2162
-
2163
-
2164
- var output = new Array(n * n).fill(0);
2165
-
2166
- for (var _i8 = 0; _i8 < n; ++_i8) {
2167
- var matIdx = rows[_i8] + n * cols[_i8];
1980
+ // Convert row/column association to a matrix
1981
+ const output = new Array(n * n).fill(0);
1982
+ for (let i = 0; i < n; ++i) {
1983
+ const matIdx = rows[i] + n * cols[i];
2168
1984
  output[matIdx] = matrix[matIdx] < 0 ? -1 : 1;
2169
1985
  }
2170
-
2171
1986
  return output;
2172
1987
  }
2173
1988
  function floatToHex2(value) {
2174
- var integer = Math.floor(value * 255);
2175
-
1989
+ const integer = Math.floor(value * 255);
2176
1990
  if (integer > 15) {
2177
1991
  return integer.toString(16);
2178
1992
  }
2179
-
2180
- return "0".concat(integer.toString(16));
1993
+ return `0${integer.toString(16)}`;
2181
1994
  }
2182
1995
  function floatRGB2HexCode(rgbArray) {
2183
- var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#';
2184
- return "".concat(prefix).concat(rgbArray.map(floatToHex2).join(''));
1996
+ let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#';
1997
+ return `${prefix}${rgbArray.map(floatToHex2).join('')}`;
2185
1998
  }
2186
-
2187
1999
  function floatToChar(f) {
2188
2000
  return Math.round(f * 255);
2189
2001
  }
2190
-
2191
2002
  function float2CssRGBA(rgbArray) {
2192
2003
  if (rgbArray.length === 3) {
2193
- return "rgb(".concat(rgbArray.map(floatToChar).join(', '), ")");
2004
+ return `rgb(${rgbArray.map(floatToChar).join(', ')})`;
2194
2005
  }
2006
+ return `rgba(${floatToChar(rgbArray[0] || 0)}, ${floatToChar(rgbArray[1] || 0)}, ${floatToChar(rgbArray[2] || 0)}, ${rgbArray[3] || 0})`;
2007
+ }
2195
2008
 
2196
- return "rgba(".concat(floatToChar(rgbArray[0] || 0), ", ").concat(floatToChar(rgbArray[1] || 0), ", ").concat(floatToChar(rgbArray[2] || 0), ", ").concat(rgbArray[3] || 0, ")");
2197
- } // ----------------------------------------------------------------------------
2009
+ // ----------------------------------------------------------------------------
2198
2010
  // Only Static API
2199
2011
  // ----------------------------------------------------------------------------
2200
2012
 
2201
2013
  var vtkMath = {
2202
- Pi: Pi,
2203
- radiansFromDegrees: radiansFromDegrees,
2204
- degreesFromRadians: degreesFromRadians,
2205
- round: round,
2206
- floor: floor,
2207
- ceil: ceil,
2208
- ceilLog2: ceilLog2,
2209
- min: min,
2210
- max: max,
2211
- arrayMin: arrayMin,
2212
- arrayMax: arrayMax,
2213
- arrayRange: arrayRange,
2214
- isPowerOfTwo: isPowerOfTwo,
2215
- nearestPowerOfTwo: nearestPowerOfTwo,
2216
- factorial: factorial,
2217
- binomial: binomial,
2218
- beginCombination: beginCombination,
2219
- nextCombination: nextCombination,
2220
- randomSeed: randomSeed,
2221
- getSeed: getSeed,
2222
- random: random,
2223
- gaussian: gaussian,
2224
- add: add,
2225
- subtract: subtract,
2226
- multiplyScalar: multiplyScalar,
2227
- multiplyScalar2D: multiplyScalar2D,
2228
- multiplyAccumulate: multiplyAccumulate,
2229
- multiplyAccumulate2D: multiplyAccumulate2D,
2230
- dot: dot,
2231
- outer: outer,
2232
- cross: cross,
2233
- norm: norm,
2234
- normalize: normalize,
2235
- perpendiculars: perpendiculars,
2236
- projectVector: projectVector,
2237
- projectVector2D: projectVector2D,
2238
- distance2BetweenPoints: distance2BetweenPoints,
2239
- angleBetweenVectors: angleBetweenVectors,
2240
- gaussianAmplitude: gaussianAmplitude,
2241
- gaussianWeight: gaussianWeight,
2242
- dot2D: dot2D,
2243
- outer2D: outer2D,
2244
- norm2D: norm2D,
2245
- normalize2D: normalize2D,
2246
- determinant2x2: determinant2x2,
2247
- LUFactor3x3: LUFactor3x3,
2248
- LUSolve3x3: LUSolve3x3,
2249
- linearSolve3x3: linearSolve3x3,
2250
- multiply3x3_vect3: multiply3x3_vect3,
2251
- multiply3x3_mat3: multiply3x3_mat3,
2252
- multiplyMatrix: multiplyMatrix,
2253
- transpose3x3: transpose3x3,
2254
- invert3x3: invert3x3,
2255
- identity3x3: identity3x3,
2256
- identity: identity,
2257
- isIdentity: isIdentity,
2258
- isIdentity3x3: isIdentity3x3,
2259
- determinant3x3: determinant3x3,
2260
- quaternionToMatrix3x3: quaternionToMatrix3x3,
2261
- areEquals: areEquals,
2262
- areMatricesEqual: areMatricesEqual,
2263
- roundNumber: roundNumber,
2264
- roundVector: roundVector,
2265
- matrix3x3ToQuaternion: matrix3x3ToQuaternion,
2266
- multiplyQuaternion: multiplyQuaternion,
2267
- orthogonalize3x3: orthogonalize3x3,
2268
- diagonalize3x3: diagonalize3x3,
2269
- singularValueDecomposition3x3: singularValueDecomposition3x3,
2270
- solveLinearSystem: solveLinearSystem,
2271
- invertMatrix: invertMatrix,
2272
- luFactorLinearSystem: luFactorLinearSystem,
2273
- luSolveLinearSystem: luSolveLinearSystem,
2274
- estimateMatrixCondition: estimateMatrixCondition,
2275
- jacobi: jacobi,
2276
- jacobiN: jacobiN,
2277
- solveHomogeneousLeastSquares: solveHomogeneousLeastSquares,
2278
- solveLeastSquares: solveLeastSquares,
2279
- hex2float: hex2float,
2280
- rgb2hsv: rgb2hsv,
2281
- hsv2rgb: hsv2rgb,
2282
- lab2xyz: lab2xyz,
2283
- xyz2lab: xyz2lab,
2284
- xyz2rgb: xyz2rgb,
2285
- rgb2xyz: rgb2xyz,
2286
- rgb2lab: rgb2lab,
2287
- lab2rgb: lab2rgb,
2288
- uninitializeBounds: uninitializeBounds,
2289
- areBoundsInitialized: areBoundsInitialized,
2290
- computeBoundsFromPoints: computeBoundsFromPoints,
2291
- clampValue: clampValue,
2292
- clampVector: clampVector,
2293
- clampAndNormalizeValue: clampAndNormalizeValue,
2294
- getScalarTypeFittingRange: getScalarTypeFittingRange,
2295
- getAdjustedScalarRange: getAdjustedScalarRange,
2296
- extentIsWithinOtherExtent: extentIsWithinOtherExtent,
2297
- boundsIsWithinOtherBounds: boundsIsWithinOtherBounds,
2298
- pointIsWithinBounds: pointIsWithinBounds,
2299
- solve3PointCircle: solve3PointCircle,
2300
- inf: inf,
2301
- negInf: negInf,
2302
- isInf: isInf,
2014
+ Pi,
2015
+ radiansFromDegrees,
2016
+ degreesFromRadians,
2017
+ round,
2018
+ floor,
2019
+ ceil,
2020
+ ceilLog2,
2021
+ min,
2022
+ max,
2023
+ arrayMin,
2024
+ arrayMax,
2025
+ arrayRange,
2026
+ isPowerOfTwo,
2027
+ nearestPowerOfTwo,
2028
+ factorial,
2029
+ binomial,
2030
+ beginCombination,
2031
+ nextCombination,
2032
+ randomSeed,
2033
+ getSeed,
2034
+ random,
2035
+ gaussian,
2036
+ add,
2037
+ subtract,
2038
+ multiplyScalar,
2039
+ multiplyScalar2D,
2040
+ multiplyAccumulate,
2041
+ multiplyAccumulate2D,
2042
+ dot,
2043
+ outer,
2044
+ cross,
2045
+ norm,
2046
+ normalize,
2047
+ perpendiculars,
2048
+ projectVector,
2049
+ projectVector2D,
2050
+ distance2BetweenPoints,
2051
+ angleBetweenVectors,
2052
+ gaussianAmplitude,
2053
+ gaussianWeight,
2054
+ dot2D,
2055
+ outer2D,
2056
+ norm2D,
2057
+ normalize2D,
2058
+ determinant2x2,
2059
+ LUFactor3x3,
2060
+ LUSolve3x3,
2061
+ linearSolve3x3,
2062
+ multiply3x3_vect3,
2063
+ multiply3x3_mat3,
2064
+ multiplyMatrix,
2065
+ transpose3x3,
2066
+ invert3x3,
2067
+ identity3x3,
2068
+ identity,
2069
+ isIdentity,
2070
+ isIdentity3x3,
2071
+ determinant3x3,
2072
+ quaternionToMatrix3x3,
2073
+ areEquals,
2074
+ areMatricesEqual,
2075
+ roundNumber,
2076
+ roundVector,
2077
+ matrix3x3ToQuaternion,
2078
+ multiplyQuaternion,
2079
+ orthogonalize3x3,
2080
+ diagonalize3x3,
2081
+ singularValueDecomposition3x3,
2082
+ solveLinearSystem,
2083
+ invertMatrix,
2084
+ luFactorLinearSystem,
2085
+ luSolveLinearSystem,
2086
+ estimateMatrixCondition,
2087
+ jacobi,
2088
+ jacobiN,
2089
+ solveHomogeneousLeastSquares,
2090
+ solveLeastSquares,
2091
+ hex2float,
2092
+ rgb2hsv,
2093
+ hsv2rgb,
2094
+ lab2xyz,
2095
+ xyz2lab,
2096
+ xyz2rgb,
2097
+ rgb2xyz,
2098
+ rgb2lab,
2099
+ lab2rgb,
2100
+ uninitializeBounds,
2101
+ areBoundsInitialized,
2102
+ computeBoundsFromPoints,
2103
+ clampValue,
2104
+ clampVector,
2105
+ clampAndNormalizeValue,
2106
+ getScalarTypeFittingRange,
2107
+ getAdjustedScalarRange,
2108
+ extentIsWithinOtherExtent,
2109
+ boundsIsWithinOtherBounds,
2110
+ pointIsWithinBounds,
2111
+ solve3PointCircle,
2112
+ inf,
2113
+ negInf,
2114
+ isInf,
2303
2115
  isNan: isNaN,
2304
- isNaN: isNaN,
2305
- isFinite: isFinite,
2116
+ isNaN,
2117
+ isFinite,
2306
2118
  // JS add-on
2307
- createUninitializedBounds: createUninitializedBounds,
2308
- getMajorAxisIndex: getMajorAxisIndex,
2309
- getSparseOrthogonalMatrix: getSparseOrthogonalMatrix,
2310
- floatToHex2: floatToHex2,
2311
- floatRGB2HexCode: floatRGB2HexCode,
2312
- float2CssRGBA: float2CssRGBA
2119
+ createUninitializedBounds,
2120
+ getMajorAxisIndex,
2121
+ getSparseOrthogonalMatrix,
2122
+ floatToHex2,
2123
+ floatRGB2HexCode,
2124
+ float2CssRGBA
2313
2125
  };
2314
2126
 
2315
2127
  var vtkMath$1 = /*#__PURE__*/Object.freeze({
@@ -2433,4 +2245,4 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
2433
2245
  'default': vtkMath
2434
2246
  });
2435
2247
 
2436
- export { ceilLog2 as $, degreesFromRadians as A, areEquals as B, clampValue as C, arrayRange as D, getMajorAxisIndex as E, createUninitializedBounds as F, isInf as G, rgb2hsv as H, rgb2lab as I, lab2rgb as J, floor as K, round as L, normalize2D as M, nearestPowerOfTwo as N, multiply3x3_vect3 as O, getSparseOrthogonalMatrix as P, areBoundsInitialized as Q, isPowerOfTwo as R, angleBetweenVectors as S, signedAngleBetweenVectors as T, createArray as U, Pi as V, ceil as W, min as X, max as Y, arrayMin as Z, arrayMax as _, areMatricesEqual as a, float2CssRGBA as a$, factorial as a0, binomial as a1, beginCombination as a2, nextCombination as a3, randomSeed as a4, getSeed as a5, gaussian as a6, multiplyScalar2D as a7, multiplyAccumulate2D as a8, outer as a9, diagonalize3x3 as aA, singularValueDecomposition3x3 as aB, luFactorLinearSystem as aC, luSolveLinearSystem as aD, invertMatrix as aE, estimateMatrixCondition as aF, solveHomogeneousLeastSquares as aG, solveLeastSquares as aH, hex2float as aI, lab2xyz as aJ, xyz2lab as aK, xyz2rgb as aL, rgb2xyz as aM, computeBoundsFromPoints as aN, clampAndNormalizeValue as aO, getScalarTypeFittingRange as aP, getAdjustedScalarRange as aQ, extentIsWithinOtherExtent as aR, boundsIsWithinOtherBounds as aS, pointIsWithinBounds as aT, solve3PointCircle as aU, inf as aV, negInf as aW, isFinite as aX, isNaN as aY, floatToHex2 as aZ, floatRGB2HexCode as a_, projectVector as aa, dot2D as ab, projectVector2D as ac, gaussianAmplitude as ad, gaussianWeight as ae, outer2D as af, norm2D as ag, rowsToMat4 as ah, columnsToMat4 as ai, columnsToMat3 as aj, LUFactor3x3 as ak, LUSolve3x3 as al, linearSolve3x3 as am, multiply3x3_mat3 as an, multiplyMatrix as ao, transpose3x3 as ap, invert3x3 as aq, identity3x3 as ar, identity as as, isIdentity as at, isIdentity3x3 as au, quaternionToMatrix3x3 as av, roundNumber as aw, matrix3x3ToQuaternion as ax, multiplyQuaternion as ay, orthogonalize3x3 as az, roundVector as b, clampVector as c, dot as d, distance2BetweenPoints as e, vtkMath as f, solveLinearSystem as g, hsv2rgb as h, isNan as i, cross as j, add as k, normalize as l, multiplyAccumulate as m, norm as n, determinant2x2 as o, jacobiN as p, perpendiculars as q, radiansFromDegrees as r, subtract as s, jacobi as t, uninitializeBounds as u, vtkMath$1 as v, multiplyScalar as w, random as x, determinant3x3 as y, rowsToMat3 as z };
2248
+ export { ceilLog2 as $, degreesFromRadians as A, areEquals as B, clampValue as C, arrayRange as D, getMajorAxisIndex as E, createUninitializedBounds as F, floor as G, isInf as H, rgb2hsv as I, rgb2lab as J, lab2rgb as K, round as L, normalize2D as M, nearestPowerOfTwo as N, multiply3x3_vect3 as O, getSparseOrthogonalMatrix as P, areBoundsInitialized as Q, isPowerOfTwo as R, angleBetweenVectors as S, signedAngleBetweenVectors as T, createArray as U, Pi as V, ceil as W, min as X, max as Y, arrayMin as Z, arrayMax as _, areMatricesEqual as a, float2CssRGBA as a$, factorial as a0, binomial as a1, beginCombination as a2, nextCombination as a3, randomSeed as a4, getSeed as a5, gaussian as a6, multiplyScalar2D as a7, multiplyAccumulate2D as a8, outer as a9, diagonalize3x3 as aA, singularValueDecomposition3x3 as aB, luFactorLinearSystem as aC, luSolveLinearSystem as aD, invertMatrix as aE, estimateMatrixCondition as aF, solveHomogeneousLeastSquares as aG, solveLeastSquares as aH, hex2float as aI, lab2xyz as aJ, xyz2lab as aK, xyz2rgb as aL, rgb2xyz as aM, computeBoundsFromPoints as aN, clampAndNormalizeValue as aO, getScalarTypeFittingRange as aP, getAdjustedScalarRange as aQ, extentIsWithinOtherExtent as aR, boundsIsWithinOtherBounds as aS, pointIsWithinBounds as aT, solve3PointCircle as aU, inf as aV, negInf as aW, isFinite as aX, isNaN as aY, floatToHex2 as aZ, floatRGB2HexCode as a_, projectVector as aa, dot2D as ab, projectVector2D as ac, gaussianAmplitude as ad, gaussianWeight as ae, outer2D as af, norm2D as ag, rowsToMat4 as ah, columnsToMat4 as ai, columnsToMat3 as aj, LUFactor3x3 as ak, LUSolve3x3 as al, linearSolve3x3 as am, multiply3x3_mat3 as an, multiplyMatrix as ao, transpose3x3 as ap, invert3x3 as aq, identity3x3 as ar, identity as as, isIdentity as at, isIdentity3x3 as au, quaternionToMatrix3x3 as av, roundNumber as aw, matrix3x3ToQuaternion as ax, multiplyQuaternion as ay, orthogonalize3x3 as az, roundVector as b, clampVector as c, dot as d, distance2BetweenPoints as e, vtkMath as f, solveLinearSystem as g, hsv2rgb as h, isNan as i, cross as j, add as k, normalize as l, multiplyAccumulate as m, norm as n, determinant2x2 as o, jacobiN as p, perpendiculars as q, radiansFromDegrees as r, subtract as s, jacobi as t, uninitializeBounds as u, vtkMath$1 as v, multiplyScalar as w, random as x, determinant3x3 as y, rowsToMat3 as z };