@kitware/vtk.js 28.10.2 → 28.11.0

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 (565) 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 +185 -270
  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/Rendering/Core/AbstractImageMapper/helper.js +44 -49
  278. package/Rendering/Core/AbstractImageMapper.js +18 -19
  279. package/Rendering/Core/AbstractMapper.js +39 -55
  280. package/Rendering/Core/AbstractMapper3D.js +26 -31
  281. package/Rendering/Core/AbstractPicker.js +25 -21
  282. package/Rendering/Core/Actor.js +71 -93
  283. package/Rendering/Core/Actor2D.js +64 -78
  284. package/Rendering/Core/AnnotatedCubeActor/Presets.js +5 -11
  285. package/Rendering/Core/AnnotatedCubeActor.js +94 -79
  286. package/Rendering/Core/AxesActor.js +65 -87
  287. package/Rendering/Core/Camera.js +246 -271
  288. package/Rendering/Core/CellPicker.js +125 -148
  289. package/Rendering/Core/ColorTransferFunction/ColorMaps.js +20 -21
  290. package/Rendering/Core/ColorTransferFunction/ColorMapsLite.js +20 -21
  291. package/Rendering/Core/ColorTransferFunction/Constants.js +4 -4
  292. package/Rendering/Core/ColorTransferFunction.js +460 -546
  293. package/Rendering/Core/Coordinate/Constants.js +2 -2
  294. package/Rendering/Core/Coordinate.js +119 -198
  295. package/Rendering/Core/CubeAxesActor.js +294 -320
  296. package/Rendering/Core/Follower.js +46 -45
  297. package/Rendering/Core/Glyph3DMapper/Constants.js +4 -4
  298. package/Rendering/Core/Glyph3DMapper.js +96 -148
  299. package/Rendering/Core/HardwareSelector.js +36 -69
  300. package/Rendering/Core/ImageArrayMapper.js +87 -126
  301. package/Rendering/Core/ImageCPRMapper.js +134 -209
  302. package/Rendering/Core/ImageMapper/Constants.js +2 -2
  303. package/Rendering/Core/ImageMapper.js +85 -144
  304. package/Rendering/Core/ImageProperty/Constants.js +2 -2
  305. package/Rendering/Core/ImageProperty.js +66 -81
  306. package/Rendering/Core/ImageResliceMapper/Constants.js +2 -2
  307. package/Rendering/Core/ImageResliceMapper.js +36 -29
  308. package/Rendering/Core/ImageSlice.js +85 -127
  309. package/Rendering/Core/InteractorObserver.js +82 -73
  310. package/Rendering/Core/InteractorStyle/Constants.js +2 -2
  311. package/Rendering/Core/InteractorStyle.js +56 -58
  312. package/Rendering/Core/Light.js +43 -49
  313. package/Rendering/Core/Mapper/CoincidentTopologyHelper.js +37 -48
  314. package/Rendering/Core/Mapper/Constants.js +6 -6
  315. package/Rendering/Core/Mapper/Static.js +15 -12
  316. package/Rendering/Core/Mapper.js +194 -259
  317. package/Rendering/Core/Mapper2D.js +61 -100
  318. package/Rendering/Core/Picker.js +124 -143
  319. package/Rendering/Core/PixelSpaceCallbackMapper.js +40 -37
  320. package/Rendering/Core/PointPicker.js +68 -79
  321. package/Rendering/Core/Prop/Constants.js +2 -2
  322. package/Rendering/Core/Prop.js +58 -106
  323. package/Rendering/Core/Prop3D.js +54 -83
  324. package/Rendering/Core/Property/Constants.js +6 -6
  325. package/Rendering/Core/Property.js +45 -74
  326. package/Rendering/Core/Property2D/Constants.js +2 -2
  327. package/Rendering/Core/Property2D.js +33 -42
  328. package/Rendering/Core/RenderWindow.js +70 -82
  329. package/Rendering/Core/RenderWindowInteractor/Constants.js +7 -7
  330. package/Rendering/Core/RenderWindowInteractor.js +324 -439
  331. package/Rendering/Core/Renderer.js +192 -256
  332. package/Rendering/Core/ScalarBarActor.js +267 -272
  333. package/Rendering/Core/Skybox.js +26 -24
  334. package/Rendering/Core/SphereMapper.js +22 -12
  335. package/Rendering/Core/StickMapper.js +22 -12
  336. package/Rendering/Core/SurfaceLICInterface/Constants.js +6 -6
  337. package/Rendering/Core/SurfaceLICInterface.js +13 -9
  338. package/Rendering/Core/SurfaceLICMapper.js +23 -15
  339. package/Rendering/Core/Texture.js +99 -141
  340. package/Rendering/Core/Viewport.js +60 -88
  341. package/Rendering/Core/Volume.js +55 -77
  342. package/Rendering/Core/VolumeMapper/Constants.js +4 -4
  343. package/Rendering/Core/VolumeMapper.js +59 -91
  344. package/Rendering/Core/VolumeProperty/Constants.js +4 -4
  345. package/Rendering/Core/VolumeProperty.js +78 -115
  346. package/Rendering/Core.js +47 -49
  347. package/Rendering/Misc/CanvasView.js +62 -61
  348. package/Rendering/Misc/FullScreenRenderWindow.js +60 -62
  349. package/Rendering/Misc/GenericRenderWindow.js +48 -37
  350. package/Rendering/Misc/RemoteView.js +86 -80
  351. package/Rendering/Misc/RenderWindowWithControlBar.js +54 -48
  352. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +43 -51
  353. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +52 -82
  354. package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +258 -308
  355. package/Rendering/Misc/SynchronizableRenderWindow.js +133 -163
  356. package/Rendering/Misc/TextureLODsDownloader.js +72 -74
  357. package/Rendering/Misc.js +7 -7
  358. package/Rendering/OpenGL/Actor.js +57 -68
  359. package/Rendering/OpenGL/Actor2D.js +56 -56
  360. package/Rendering/OpenGL/BufferObject/Constants.js +2 -2
  361. package/Rendering/OpenGL/BufferObject.js +50 -65
  362. package/Rendering/OpenGL/Camera.js +35 -29
  363. package/Rendering/OpenGL/CellArrayBufferObject.js +119 -149
  364. package/Rendering/OpenGL/Convolution2DPass.js +87 -81
  365. package/Rendering/OpenGL/CubeAxesActor.js +28 -21
  366. package/Rendering/OpenGL/ForwardPass.js +53 -64
  367. package/Rendering/OpenGL/Framebuffer.js +61 -101
  368. package/Rendering/OpenGL/Glyph3DMapper.js +165 -196
  369. package/Rendering/OpenGL/HardwareSelector/Constants.js +2 -2
  370. package/Rendering/OpenGL/HardwareSelector.js +272 -397
  371. package/Rendering/OpenGL/Helper.js +58 -73
  372. package/Rendering/OpenGL/ImageCPRMapper.js +339 -421
  373. package/Rendering/OpenGL/ImageMapper.js +268 -361
  374. package/Rendering/OpenGL/ImageResliceMapper.js +306 -438
  375. package/Rendering/OpenGL/ImageSlice.js +48 -54
  376. package/Rendering/OpenGL/OrderIndependentTranslucentPass.js +102 -84
  377. package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +43 -42
  378. package/Rendering/OpenGL/PolyDataMapper.js +358 -492
  379. package/Rendering/OpenGL/PolyDataMapper2D.js +153 -205
  380. package/Rendering/OpenGL/RadialDistortionPass.js +86 -89
  381. package/Rendering/OpenGL/RenderWindow/Constants.js +2 -2
  382. package/Rendering/OpenGL/RenderWindow/ContextProxy.js +20 -29
  383. package/Rendering/OpenGL/RenderWindow.js +356 -510
  384. package/Rendering/OpenGL/Renderer.js +77 -89
  385. package/Rendering/OpenGL/ReplacementShaderMapper.js +28 -46
  386. package/Rendering/OpenGL/ScalarBarActor.js +28 -21
  387. package/Rendering/OpenGL/Shader.js +37 -31
  388. package/Rendering/OpenGL/ShaderCache.js +67 -74
  389. package/Rendering/OpenGL/ShaderProgram.js +136 -248
  390. package/Rendering/OpenGL/Skybox.js +99 -60
  391. package/Rendering/OpenGL/SphereMapper.js +94 -108
  392. package/Rendering/OpenGL/StickMapper.js +110 -114
  393. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +91 -157
  394. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +142 -151
  395. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +142 -216
  396. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +79 -100
  397. package/Rendering/OpenGL/SurfaceLIC.js +2 -2
  398. package/Rendering/OpenGL/Texture/Constants.js +4 -4
  399. package/Rendering/OpenGL/Texture.js +443 -608
  400. package/Rendering/OpenGL/TextureUnitManager.js +47 -43
  401. package/Rendering/OpenGL/VertexArrayObject.js +92 -131
  402. package/Rendering/OpenGL/ViewNodeFactory.js +25 -13
  403. package/Rendering/OpenGL/Volume.js +38 -34
  404. package/Rendering/OpenGL/VolumeMapper.js +437 -547
  405. package/Rendering/OpenGL.js +28 -28
  406. package/Rendering/SceneGraph/RenderPass.js +34 -31
  407. package/Rendering/SceneGraph/RenderWindowViewNode.js +68 -94
  408. package/Rendering/SceneGraph/ViewNode.js +82 -111
  409. package/Rendering/SceneGraph/ViewNodeFactory.js +31 -26
  410. package/Rendering/SceneGraph.js +4 -4
  411. package/Rendering/WebGPU/Actor.js +49 -49
  412. package/Rendering/WebGPU/Actor2D.js +45 -44
  413. package/Rendering/WebGPU/BindGroup.js +43 -50
  414. package/Rendering/WebGPU/Buffer.js +41 -50
  415. package/Rendering/WebGPU/BufferManager/Constants.js +4 -4
  416. package/Rendering/WebGPU/BufferManager.js +111 -141
  417. package/Rendering/WebGPU/Camera.js +65 -67
  418. package/Rendering/WebGPU/CellArrayMapper.js +621 -388
  419. package/Rendering/WebGPU/CubeAxesActor.js +28 -19
  420. package/Rendering/WebGPU/Device.js +78 -133
  421. package/Rendering/WebGPU/ForwardPass.js +75 -72
  422. package/Rendering/WebGPU/FullScreenQuad.js +25 -18
  423. package/Rendering/WebGPU/Glyph3DMapper.js +62 -74
  424. package/Rendering/WebGPU/HardwareSelectionPass.js +45 -38
  425. package/Rendering/WebGPU/HardwareSelector.js +200 -276
  426. package/Rendering/WebGPU/ImageMapper.js +180 -171
  427. package/Rendering/WebGPU/ImageSlice.js +45 -44
  428. package/Rendering/WebGPU/IndexBuffer.js +166 -200
  429. package/Rendering/WebGPU/OpaquePass.js +37 -36
  430. package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +72 -45
  431. package/Rendering/WebGPU/Pipeline.js +37 -51
  432. package/Rendering/WebGPU/PixelSpaceCallbackMapper.js +27 -19
  433. package/Rendering/WebGPU/PolyDataMapper.js +50 -53
  434. package/Rendering/WebGPU/PolyDataMapper2D.js +39 -39
  435. package/Rendering/WebGPU/RenderEncoder.js +68 -88
  436. package/Rendering/WebGPU/RenderWindow.js +262 -376
  437. package/Rendering/WebGPU/Renderer.js +224 -208
  438. package/Rendering/WebGPU/Sampler.js +27 -21
  439. package/Rendering/WebGPU/ScalarBarActor.js +28 -19
  440. package/Rendering/WebGPU/ShaderCache.js +43 -41
  441. package/Rendering/WebGPU/ShaderDescription.js +52 -59
  442. package/Rendering/WebGPU/ShaderModule.js +26 -17
  443. package/Rendering/WebGPU/SimpleMapper.js +185 -121
  444. package/Rendering/WebGPU/SphereMapper.js +200 -130
  445. package/Rendering/WebGPU/StickMapper.js +289 -152
  446. package/Rendering/WebGPU/StorageBuffer.js +100 -115
  447. package/Rendering/WebGPU/Texture.js +79 -99
  448. package/Rendering/WebGPU/TextureManager.js +52 -54
  449. package/Rendering/WebGPU/TextureView.js +40 -43
  450. package/Rendering/WebGPU/Types.js +53 -70
  451. package/Rendering/WebGPU/UniformBuffer.js +158 -184
  452. package/Rendering/WebGPU/VertexInput.js +64 -90
  453. package/Rendering/WebGPU/ViewNodeFactory.js +25 -13
  454. package/Rendering/WebGPU/Volume.js +52 -51
  455. package/Rendering/WebGPU/VolumePass.js +218 -239
  456. package/Rendering/WebGPU/VolumePassFSQ.js +625 -306
  457. package/Rendering/WebGPU.js +1 -1
  458. package/Rendering/index.js +5 -5
  459. package/Widgets/Core/AbstractWidget/Constants.js +2 -2
  460. package/Widgets/Core/AbstractWidget.js +49 -58
  461. package/Widgets/Core/AbstractWidgetFactory.js +101 -122
  462. package/Widgets/Core/StateBuilder/boundsMixin.js +23 -28
  463. package/Widgets/Core/StateBuilder/color3Mixin.js +10 -7
  464. package/Widgets/Core/StateBuilder/colorMixin.js +10 -6
  465. package/Widgets/Core/StateBuilder/cornerMixin.js +16 -15
  466. package/Widgets/Core/StateBuilder/directionMixin.js +20 -18
  467. package/Widgets/Core/StateBuilder/manipulatorMixin.js +26 -18
  468. package/Widgets/Core/StateBuilder/nameMixin.js +10 -6
  469. package/Widgets/Core/StateBuilder/orientationMixin.js +19 -16
  470. package/Widgets/Core/StateBuilder/originMixin.js +25 -32
  471. package/Widgets/Core/StateBuilder/scale1Mixin.js +10 -6
  472. package/Widgets/Core/StateBuilder/scale3Mixin.js +10 -6
  473. package/Widgets/Core/StateBuilder/shapeMixin.js +12 -6
  474. package/Widgets/Core/StateBuilder/textMixin.js +10 -6
  475. package/Widgets/Core/StateBuilder/visibleMixin.js +10 -6
  476. package/Widgets/Core/StateBuilder.js +120 -149
  477. package/Widgets/Core/WidgetManager/Constants.js +7 -7
  478. package/Widgets/Core/WidgetManager.js +249 -421
  479. package/Widgets/Core/WidgetState.js +48 -57
  480. package/Widgets/Core.js +5 -5
  481. package/Widgets/Manipulators/AbstractManipulator.js +20 -14
  482. package/Widgets/Manipulators/CPRManipulator.js +55 -71
  483. package/Widgets/Manipulators/LineManipulator.js +31 -28
  484. package/Widgets/Manipulators/PickerManipulator.d.ts +48 -0
  485. package/Widgets/Manipulators/PickerManipulator.js +65 -0
  486. package/Widgets/Manipulators/PlaneManipulator.js +26 -23
  487. package/Widgets/Manipulators/TrackballManipulator.js +39 -35
  488. package/Widgets/Manipulators.js +4 -2
  489. package/Widgets/Representations/ArrowHandleRepresentation.js +148 -162
  490. package/Widgets/Representations/CircleContextRepresentation.js +44 -38
  491. package/Widgets/Representations/ContextRepresentation.js +17 -14
  492. package/Widgets/Representations/ConvexFaceContextRepresentation.js +50 -47
  493. package/Widgets/Representations/CroppingOutlineRepresentation.js +38 -27
  494. package/Widgets/Representations/CubeHandleRepresentation.js +21 -18
  495. package/Widgets/Representations/GlyphRepresentation.js +107 -152
  496. package/Widgets/Representations/HandleRepresentation.js +17 -14
  497. package/Widgets/Representations/ImplicitPlaneRepresentation.js +97 -91
  498. package/Widgets/Representations/LineHandleRepresentation.js +44 -41
  499. package/Widgets/Representations/OutlineContextRepresentation.js +42 -36
  500. package/Widgets/Representations/PolyLineRepresentation.js +60 -75
  501. package/Widgets/Representations/RectangleContextRepresentation.js +42 -37
  502. package/Widgets/Representations/SphereContextRepresentation.js +19 -27
  503. package/Widgets/Representations/SphereHandleRepresentation.js +31 -27
  504. package/Widgets/Representations/SplineContextRepresentation.js +46 -70
  505. package/Widgets/Representations/WidgetRepresentation/Constants.js +2 -2
  506. package/Widgets/Representations/WidgetRepresentation.js +99 -134
  507. package/Widgets/Representations.js +13 -13
  508. package/Widgets/Widgets3D/AngleWidget/behavior.js +41 -63
  509. package/Widgets/Widgets3D/AngleWidget.js +40 -38
  510. package/Widgets/Widgets3D/DistanceWidget/behavior.js +40 -61
  511. package/Widgets/Widgets3D/DistanceWidget.js +38 -36
  512. package/Widgets/Widgets3D/EllipseWidget/behavior.js +14 -19
  513. package/Widgets/Widgets3D/EllipseWidget/state.js +4 -2
  514. package/Widgets/Widgets3D/EllipseWidget.js +37 -26
  515. package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +26 -56
  516. package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +14 -17
  517. package/Widgets/Widgets3D/ImageCroppingWidget/state.js +20 -16
  518. package/Widgets/Widgets3D/ImageCroppingWidget.js +80 -98
  519. package/Widgets/Widgets3D/ImplicitPlaneWidget.js +55 -77
  520. package/Widgets/Widgets3D/InteractiveOrientationWidget/behavior.js +17 -18
  521. package/Widgets/Widgets3D/InteractiveOrientationWidget/state.js +15 -7
  522. package/Widgets/Widgets3D/InteractiveOrientationWidget.js +30 -29
  523. package/Widgets/Widgets3D/LabelWidget/behavior.js +37 -62
  524. package/Widgets/Widgets3D/LabelWidget.js +31 -25
  525. package/Widgets/Widgets3D/LineWidget/Constants.js +8 -8
  526. package/Widgets/Widgets3D/LineWidget/behavior.js +77 -114
  527. package/Widgets/Widgets3D/LineWidget/helpers.js +13 -20
  528. package/Widgets/Widgets3D/LineWidget/state.js +2 -1
  529. package/Widgets/Widgets3D/LineWidget.js +39 -35
  530. package/Widgets/Widgets3D/PaintWidget/behavior.js +24 -59
  531. package/Widgets/Widgets3D/PaintWidget.js +39 -37
  532. package/Widgets/Widgets3D/PolyLineWidget/behavior.js +44 -68
  533. package/Widgets/Widgets3D/PolyLineWidget.js +36 -31
  534. package/Widgets/Widgets3D/RectangleWidget/behavior.js +6 -11
  535. package/Widgets/Widgets3D/RectangleWidget/state.js +4 -2
  536. package/Widgets/Widgets3D/RectangleWidget.js +37 -25
  537. package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +35 -21
  538. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +133 -209
  539. package/Widgets/Widgets3D/ResliceCursorWidget/cprBehavior.js +26 -41
  540. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +89 -116
  541. package/Widgets/Widgets3D/ResliceCursorWidget/state.js +33 -40
  542. package/Widgets/Widgets3D/ResliceCursorWidget.js +186 -227
  543. package/Widgets/Widgets3D/SeedWidget/behavior.js +82 -0
  544. package/Widgets/Widgets3D/SeedWidget/state.js +18 -0
  545. package/Widgets/Widgets3D/SeedWidget.d.ts +44 -0
  546. package/Widgets/Widgets3D/SeedWidget.js +43 -0
  547. package/Widgets/Widgets3D/ShapeWidget/Constants.js +19 -19
  548. package/Widgets/Widgets3D/ShapeWidget/behavior.js +150 -252
  549. package/Widgets/Widgets3D/ShapeWidget.js +24 -27
  550. package/Widgets/Widgets3D/SphereWidget/behavior.js +35 -69
  551. package/Widgets/Widgets3D/SphereWidget/state.js +9 -5
  552. package/Widgets/Widgets3D/SphereWidget.js +34 -44
  553. package/Widgets/Widgets3D/SplineWidget/behavior.js +85 -120
  554. package/Widgets/Widgets3D/SplineWidget.js +43 -39
  555. package/Widgets/Widgets3D.js +15 -15
  556. package/Widgets/index.js +4 -4
  557. package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +95 -207
  558. package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +0 -3
  559. package/favicon.js +5 -6
  560. package/index.d.ts +4 -2
  561. package/index.js +4 -3
  562. package/macros.js +4 -1931
  563. package/macros2.js +1684 -0
  564. package/package.json +6 -6
  565. package/vtk.js +18 -31
@@ -1,9 +1,7 @@
1
- import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
1
  import { vec3, mat4 } from 'gl-matrix';
4
2
  import * as d3 from 'd3-scale';
5
3
  import { M as normalize2D, N as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
6
- import macro from '../../macros.js';
4
+ import { m as macro } from '../../macros2.js';
7
5
  import vtkActor from './Actor.js';
8
6
  import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
9
7
  import vtkDataArray from '../../Common/Core/DataArray.js';
@@ -11,19 +9,18 @@ import vtkMapper from './Mapper.js';
11
9
  import vtkPolyData from '../../Common/DataModel/PolyData.js';
12
10
  import vtkTexture from './Texture.js';
13
11
 
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
+ // ----------------------------------------------------------------------------
17
13
  // vtkCubeAxesActor
18
14
  // ----------------------------------------------------------------------------
19
15
  // faces are -x x -y y -z z
20
16
  // point 0 is 0,0,0 and then +x fastest changing, +y then +z
17
+ const faceNormals = [[-1, 0, 0], [1, 0, 0], [0, -1, 0], [0, 1, 0], [0, 0, -1], [0, 0, 1]];
18
+ const faceEdges = [[8, 7, 11, 3], [9, 1, 10, 5], [4, 9, 0, 8], [2, 11, 6, 10], [0, 3, 2, 1], [4, 5, 6, 7]];
19
+ const edgePoints = [[0, 1], [1, 3], [2, 3], [0, 2], [4, 5], [5, 7], [6, 7], [4, 6], [0, 4], [1, 5], [3, 7], [2, 6]];
20
+ const edgeAxes = [0, 1, 0, 1, 0, 1, 0, 1, 2, 2, 2, 2];
21
+ const faceAxes = [[1, 2], [1, 2], [0, 2], [0, 2], [0, 1], [0, 1]];
21
22
 
22
- var faceNormals = [[-1, 0, 0], [1, 0, 0], [0, -1, 0], [0, 1, 0], [0, 0, -1], [0, 0, 1]];
23
- var faceEdges = [[8, 7, 11, 3], [9, 1, 10, 5], [4, 9, 0, 8], [2, 11, 6, 10], [0, 3, 2, 1], [4, 5, 6, 7]];
24
- var edgePoints = [[0, 1], [1, 3], [2, 3], [0, 2], [4, 5], [5, 7], [6, 7], [4, 6], [0, 4], [1, 5], [3, 7], [2, 6]];
25
- var edgeAxes = [0, 1, 0, 1, 0, 1, 0, 1, 2, 2, 2, 2];
26
- var faceAxes = [[1, 2], [1, 2], [0, 2], [0, 2], [0, 1], [0, 1]]; //
23
+ //
27
24
  // Developer note: This class is broken into the main class and a helper
28
25
  // class. The main class holds view independent properties (those properties
29
26
  // that do not change as the view's resolution/aspect ratio change). The
@@ -33,85 +30,80 @@ var faceAxes = [[1, 2], [1, 2], [0, 2], [0, 2], [0, 1], [0, 1]]; //
33
30
  // vtkWebGPUCubeAxesActor) but is instead placed here to it can be shared by
34
31
  // multiple rendering backends.
35
32
  //
36
- // some shared temp variables to reduce heap allocs
37
-
38
- var ptv3 = new Float64Array(3);
39
- var pt2v3 = new Float64Array(3);
40
- var tmpv3 = new Float64Array(3);
41
- var tmp2v3 = new Float64Array(3);
42
- var xDir = new Float64Array(3);
43
- var yDir = new Float64Array(3);
44
- var invmat = new Float64Array(16);
45
33
 
34
+ // some shared temp variables to reduce heap allocs
35
+ const ptv3 = new Float64Array(3);
36
+ const pt2v3 = new Float64Array(3);
37
+ const tmpv3 = new Float64Array(3);
38
+ const tmp2v3 = new Float64Array(3);
39
+ const xDir = new Float64Array(3);
40
+ const yDir = new Float64Array(3);
41
+ const invmat = new Float64Array(16);
46
42
  function applyTextStyle(ctx, style) {
47
43
  ctx.strokeStyle = style.strokeColor;
48
44
  ctx.lineWidth = style.strokeSize;
49
45
  ctx.fillStyle = style.fontColor;
50
- ctx.font = "".concat(style.fontStyle, " ").concat(style.fontSize, "px ").concat(style.fontFamily);
51
- } // many properties of this actor depend on the API specific view The main
46
+ ctx.font = `${style.fontStyle} ${style.fontSize}px ${style.fontFamily}`;
47
+ }
48
+
49
+ // many properties of this actor depend on the API specific view The main
52
50
  // dependency being the resolution as that drives what font sizes to use.
53
51
  // Bacause of this we need to do some of the calculations in a API specific
54
52
  // subclass. But... we don't want a lot of duplicated code between WebGL and
55
53
  // WebGPU for example so we have this helper class, that is designed to be
56
54
  // fairly API independent so that API specific views can call this to do
57
55
  // most of the work.
58
-
59
-
60
56
  function vtkCubeAxesActorHelper(publicAPI, model) {
61
57
  // Set our className
62
58
  model.classHierarchy.push('vtkCubeAxesActorHelper');
63
-
64
- publicAPI.setRenderable = function (renderable) {
59
+ publicAPI.setRenderable = renderable => {
65
60
  if (model.renderable === renderable) {
66
61
  return;
67
62
  }
68
-
69
63
  model.renderable = renderable;
70
64
  model.tmActor.addTexture(model.renderable.getTmTexture());
71
65
  model.tmActor.setProperty(renderable.getProperty());
72
66
  model.tmActor.setParentProp(renderable);
73
67
  publicAPI.modified();
74
- }; // called by updateTexturePolyData
75
-
76
-
77
- publicAPI.createPolyDataForOneLabel = function (text, pos, cmat, imat, dir, offset, results) {
78
- var value = model.renderable.get_tmAtlas().get(text);
68
+ };
79
69
 
70
+ // called by updateTexturePolyData
71
+ publicAPI.createPolyDataForOneLabel = (text, pos, cmat, imat, dir, offset, results) => {
72
+ const value = model.renderable.get_tmAtlas().get(text);
80
73
  if (!value) {
81
74
  return;
82
75
  }
76
+ const coords = model.renderable.getTextPolyData().getPoints().getData();
83
77
 
84
- var coords = model.renderable.getTextPolyData().getPoints().getData(); // compute pixel to distance factors
85
-
86
- var size = model.lastSize;
78
+ // compute pixel to distance factors
79
+ const size = model.lastSize;
87
80
  ptv3[0] = coords[pos * 3];
88
81
  ptv3[1] = coords[pos * 3 + 1];
89
82
  ptv3[2] = coords[pos * 3 + 2];
90
- vec3.transformMat4(tmpv3, ptv3, cmat); // moving 0.1 in NDC
91
-
83
+ vec3.transformMat4(tmpv3, ptv3, cmat);
84
+ // moving 0.1 in NDC
92
85
  tmpv3[0] += 0.1;
93
- vec3.transformMat4(pt2v3, tmpv3, imat); // results in WC move of
94
-
86
+ vec3.transformMat4(pt2v3, tmpv3, imat);
87
+ // results in WC move of
95
88
  vec3.subtract(xDir, pt2v3, ptv3);
96
89
  tmpv3[0] -= 0.1;
97
90
  tmpv3[1] += 0.1;
98
- vec3.transformMat4(pt2v3, tmpv3, imat); // results in WC move of
99
-
91
+ vec3.transformMat4(pt2v3, tmpv3, imat);
92
+ // results in WC move of
100
93
  vec3.subtract(yDir, pt2v3, ptv3);
101
-
102
- for (var i = 0; i < 3; i++) {
94
+ for (let i = 0; i < 3; i++) {
103
95
  xDir[i] /= 0.5 * 0.1 * size[0];
104
96
  yDir[i] /= 0.5 * 0.1 * size[1];
105
- } // have to find the four corners of the texture polygon for this label
106
- // convert anchor point to View Coords
107
-
97
+ }
108
98
 
109
- var ptIdx = results.ptIdx;
110
- var cellIdx = results.cellIdx;
99
+ // have to find the four corners of the texture polygon for this label
100
+ // convert anchor point to View Coords
101
+ let ptIdx = results.ptIdx;
102
+ let cellIdx = results.cellIdx;
111
103
  ptv3[0] = coords[pos * 3];
112
104
  ptv3[1] = coords[pos * 3 + 1];
113
- ptv3[2] = coords[pos * 3 + 2]; // horizontal left, right, or middle alignment based on dir[0]
114
-
105
+ ptv3[2] = coords[pos * 3 + 2];
106
+ // horizontal left, right, or middle alignment based on dir[0]
115
107
  if (dir[0] < -0.5) {
116
108
  vec3.scale(tmpv3, xDir, dir[0] * offset - value.width);
117
109
  } else if (dir[0] > 0.5) {
@@ -119,7 +111,6 @@ function vtkCubeAxesActorHelper(publicAPI, model) {
119
111
  } else {
120
112
  vec3.scale(tmpv3, xDir, dir[0] * offset - value.width / 2.0);
121
113
  }
122
-
123
114
  vec3.add(ptv3, ptv3, tmpv3);
124
115
  vec3.scale(tmpv3, yDir, dir[1] * offset - value.height / 2.0);
125
116
  vec3.add(ptv3, ptv3, tmpv3);
@@ -152,8 +143,9 @@ function vtkCubeAxesActorHelper(publicAPI, model) {
152
143
  results.points[ptIdx * 3 + 2] = ptv3[2];
153
144
  results.tcoords[ptIdx * 2] = value.tcoords[6];
154
145
  results.tcoords[ptIdx * 2 + 1] = value.tcoords[7];
155
- ptIdx++; // add the two triangles to represent the quad
146
+ ptIdx++;
156
147
 
148
+ // add the two triangles to represent the quad
157
149
  results.polys[cellIdx * 4] = 3;
158
150
  results.polys[cellIdx * 4 + 1] = ptIdx - 4;
159
151
  results.polys[cellIdx * 4 + 2] = ptIdx - 3;
@@ -165,35 +157,35 @@ function vtkCubeAxesActorHelper(publicAPI, model) {
165
157
  results.polys[cellIdx * 4 + 3] = ptIdx - 1;
166
158
  results.ptIdx += 4;
167
159
  results.cellIdx += 2;
168
- }; // update the polydata associated with drawing the text labels
160
+ };
161
+
162
+ // update the polydata associated with drawing the text labels
169
163
  // specifically the quads used for each label and their associated tcoords
170
164
  // etc. This changes every time the camera viewpoint changes
165
+ publicAPI.updateTexturePolyData = () => {
166
+ const cmat = model.camera.getCompositeProjectionMatrix(model.lastAspectRatio, -1, 1);
167
+ mat4.transpose(cmat, cmat);
171
168
 
172
-
173
- publicAPI.updateTexturePolyData = function () {
174
- var cmat = model.camera.getCompositeProjectionMatrix(model.lastAspectRatio, -1, 1);
175
- mat4.transpose(cmat, cmat); // update the polydata
176
-
177
- var numLabels = model.renderable.getTextValues().length;
178
- var numPts = numLabels * 4;
179
- var numTris = numLabels * 2;
180
- var points = new Float64Array(numPts * 3);
181
- var polys = new Uint16Array(numTris * 4);
182
- var tcoords = new Float32Array(numPts * 2);
169
+ // update the polydata
170
+ const numLabels = model.renderable.getTextValues().length;
171
+ const numPts = numLabels * 4;
172
+ const numTris = numLabels * 2;
173
+ const points = new Float64Array(numPts * 3);
174
+ const polys = new Uint16Array(numTris * 4);
175
+ const tcoords = new Float32Array(numPts * 2);
183
176
  mat4.invert(invmat, cmat);
184
- var results = {
177
+ const results = {
185
178
  ptIdx: 0,
186
179
  cellIdx: 0,
187
- polys: polys,
188
- points: points,
189
- tcoords: tcoords
180
+ polys,
181
+ points,
182
+ tcoords
190
183
  };
191
- var ptIdx = 0;
192
- var textIdx = 0;
193
- var axisIdx = 0;
194
- var coords = model.renderable.getTextPolyData().getPoints().getData();
195
- var textValues = model.renderable.getTextValues();
196
-
184
+ let ptIdx = 0;
185
+ let textIdx = 0;
186
+ let axisIdx = 0;
187
+ const coords = model.renderable.getTextPolyData().getPoints().getData();
188
+ const textValues = model.renderable.getTextValues();
197
189
  while (ptIdx < coords.length / 3) {
198
190
  // compute the direction to move out
199
191
  ptv3[0] = coords[ptIdx * 3];
@@ -205,23 +197,23 @@ function vtkCubeAxesActorHelper(publicAPI, model) {
205
197
  ptv3[2] = coords[ptIdx * 3 + 5];
206
198
  vec3.transformMat4(tmp2v3, ptv3, cmat);
207
199
  vec3.subtract(tmpv3, tmpv3, tmp2v3);
208
- var dir = [tmpv3[0], tmpv3[1]];
209
- normalize2D(dir); // write the axis label
200
+ const dir = [tmpv3[0], tmpv3[1]];
201
+ normalize2D(dir);
210
202
 
203
+ // write the axis label
211
204
  publicAPI.createPolyDataForOneLabel(textValues[textIdx], ptIdx, cmat, invmat, dir, model.renderable.getAxisTitlePixelOffset(), results);
212
205
  ptIdx += 2;
213
- textIdx++; // write the tick labels
206
+ textIdx++;
214
207
 
215
- for (var t = 0; t < model.renderable.getTickCounts()[axisIdx]; t++) {
208
+ // write the tick labels
209
+ for (let t = 0; t < model.renderable.getTickCounts()[axisIdx]; t++) {
216
210
  publicAPI.createPolyDataForOneLabel(textValues[textIdx], ptIdx, cmat, invmat, dir, model.renderable.getTickLabelPixelOffset(), results);
217
211
  ptIdx++;
218
212
  textIdx++;
219
213
  }
220
-
221
214
  axisIdx++;
222
215
  }
223
-
224
- var tcoordDA = vtkDataArray.newInstance({
216
+ const tcoordDA = vtkDataArray.newInstance({
225
217
  numberOfComponents: 2,
226
218
  values: tcoords,
227
219
  name: 'TextureCoordinates'
@@ -233,8 +225,7 @@ function vtkCubeAxesActorHelper(publicAPI, model) {
233
225
  model.tmPolyData.getPolys().modified();
234
226
  model.tmPolyData.modified();
235
227
  };
236
-
237
- publicAPI.updateAPISpecificData = function (size, camera, renderWindow) {
228
+ publicAPI.updateAPISpecificData = (size, camera, renderWindow) => {
238
229
  // has the size changed?
239
230
  if (model.lastSize[0] !== size[0] || model.lastSize[1] !== size[1]) {
240
231
  model.lastSize[0] = size[0];
@@ -242,19 +233,19 @@ function vtkCubeAxesActorHelper(publicAPI, model) {
242
233
  model.lastAspectRatio = size[0] / size[1];
243
234
  model.forceUpdate = true;
244
235
  }
236
+ model.camera = camera;
245
237
 
246
- model.camera = camera; // compute bounds for label quads whenever the camera changes
247
-
238
+ // compute bounds for label quads whenever the camera changes
248
239
  publicAPI.updateTexturePolyData();
249
240
  };
250
241
  }
251
-
252
- var newCubeAxesActorHelper = macro.newInstance(function (publicAPI, model) {
253
- var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
242
+ const newCubeAxesActorHelper = macro.newInstance(function (publicAPI, model) {
243
+ let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
254
244
  renderable: null
255
245
  };
256
- Object.assign(model, {}, initialValues); // Inheritance
246
+ Object.assign(model, {}, initialValues);
257
247
 
248
+ // Inheritance
258
249
  macro.obj(publicAPI, model);
259
250
  model.tmPolyData = vtkPolyData.newInstance();
260
251
  model.tmMapper = vtkMapper.newInstance();
@@ -274,51 +265,45 @@ var newCubeAxesActorHelper = macro.newInstance(function (publicAPI, model) {
274
265
  macro.obj(model.lastRebuildTime, {
275
266
  mtime: 0
276
267
  });
277
- model.lastSize = [-1, -1]; // internal variables
268
+ model.lastSize = [-1, -1];
278
269
 
270
+ // internal variables
279
271
  model.lastTickBounds = [];
280
272
  vtkCubeAxesActorHelper(publicAPI, model);
281
273
  }, 'vtkCubeAxesActorHelper');
282
-
283
274
  function vtkCubeAxesActor(publicAPI, model) {
284
275
  // Set our className
285
276
  model.classHierarchy.push('vtkCubeAxesActor');
286
-
287
- publicAPI.setCamera = function (cam) {
277
+ publicAPI.setCamera = cam => {
288
278
  if (model.camera === cam) {
289
279
  return;
290
280
  }
291
-
292
281
  if (model.cameraModifiedSub) {
293
282
  model.cameraModifiedSub.unsubscribe();
294
283
  model.cameraModifiedSub = null;
295
284
  }
296
-
297
285
  model.camera = cam;
298
-
299
286
  if (cam) {
300
287
  model.cameraModifiedSub = cam.onModified(publicAPI.update);
301
288
  }
302
-
303
289
  publicAPI.update();
304
290
  publicAPI.modified();
305
- }; // estimate from a camera model what faces to draw
306
- // return true if the list of faces to draw has changed
307
-
291
+ };
308
292
 
309
- publicAPI.computeFacesToDraw = function () {
310
- var cmat = model.camera.getViewMatrix();
293
+ // estimate from a camera model what faces to draw
294
+ // return true if the list of faces to draw has changed
295
+ publicAPI.computeFacesToDraw = () => {
296
+ const cmat = model.camera.getViewMatrix();
311
297
  mat4.transpose(cmat, cmat);
312
- var changed = false;
313
- var length = vtkBoundingBox.getDiagonalLength(model.dataBounds);
314
- var faceDot = Math.sin(model.faceVisibilityAngle * Math.PI / 180.0);
315
-
316
- for (var f = 0; f < 6; f++) {
317
- var drawit = false;
318
- var faceAxis = Math.floor(f / 2);
319
- var otherAxis1 = (faceAxis + 1) % 3;
320
- var otherAxis2 = (faceAxis + 2) % 3; // only for non degenerate axes
321
-
298
+ let changed = false;
299
+ const length = vtkBoundingBox.getDiagonalLength(model.dataBounds);
300
+ const faceDot = Math.sin(model.faceVisibilityAngle * Math.PI / 180.0);
301
+ for (let f = 0; f < 6; f++) {
302
+ let drawit = false;
303
+ const faceAxis = Math.floor(f / 2);
304
+ const otherAxis1 = (faceAxis + 1) % 3;
305
+ const otherAxis2 = (faceAxis + 2) % 3;
306
+ // only for non degenerate axes
322
307
  if (model.dataBounds[otherAxis1 * 2] !== model.dataBounds[otherAxis1 * 2 + 1] && model.dataBounds[otherAxis2 * 2] !== model.dataBounds[otherAxis2 * 2 + 1]) {
323
308
  // for each face transform the center and off center to get a direction vector
324
309
  ptv3[faceAxis] = model.dataBounds[f] - 0.1 * length * faceNormals[f][faceAxis];
@@ -328,115 +313,111 @@ function vtkCubeAxesActor(publicAPI, model) {
328
313
  ptv3[faceAxis] = model.dataBounds[f];
329
314
  vec3.transformMat4(tmp2v3, ptv3, cmat);
330
315
  vec3.subtract(tmpv3, tmp2v3, tmpv3);
331
- vec3.normalize(tmpv3, tmpv3); // tmpv3 now holds the face normal vector
332
-
333
- drawit = tmpv3[2] > faceDot; // for perspctive we need the view direction to the plane
334
-
316
+ vec3.normalize(tmpv3, tmpv3);
317
+ // tmpv3 now holds the face normal vector
318
+ drawit = tmpv3[2] > faceDot;
319
+ // for perspctive we need the view direction to the plane
335
320
  if (!model.camera.getParallelProjection()) {
336
321
  vec3.normalize(tmp2v3, tmp2v3);
337
322
  drawit = vec3.dot(tmp2v3, tmpv3) > faceDot;
338
323
  }
339
324
  }
340
-
341
325
  if (drawit !== model.lastFacesToDraw[f]) {
342
326
  model.lastFacesToDraw[f] = drawit;
343
327
  changed = true;
344
328
  }
345
329
  }
346
-
347
330
  return changed;
348
- }; // update the polydata that represents the boundingd edges and gridlines
349
-
331
+ };
350
332
 
351
- publicAPI.updatePolyData = function (facesToDraw, edgesToDraw, ticks) {
333
+ // update the polydata that represents the boundingd edges and gridlines
334
+ publicAPI.updatePolyData = (facesToDraw, edgesToDraw, ticks) => {
352
335
  // compute the number of points and lines required
353
- var numPts = 0;
354
- var numLines = 0;
336
+ let numPts = 0;
337
+ let numLines = 0;
355
338
  numPts += 8; // always start with the 8 cube points
356
- // count edgesToDraw
357
-
358
- var numEdgesToDraw = 0;
359
339
 
360
- for (var e = 0; e < 12; e++) {
340
+ // count edgesToDraw
341
+ let numEdgesToDraw = 0;
342
+ for (let e = 0; e < 12; e++) {
361
343
  if (edgesToDraw[e] > 0) {
362
344
  numEdgesToDraw++;
363
345
  }
364
346
  }
347
+ numLines += numEdgesToDraw;
365
348
 
366
- numLines += numEdgesToDraw; // add values for gridlines
367
-
349
+ // add values for gridlines
368
350
  if (model.gridLines) {
369
- for (var f = 0; f < 6; f++) {
351
+ for (let f = 0; f < 6; f++) {
370
352
  if (facesToDraw[f]) {
371
353
  numPts += ticks[faceAxes[f][0]].length * 2 + ticks[faceAxes[f][1]].length * 2;
372
354
  numLines += ticks[faceAxes[f][0]].length + ticks[faceAxes[f][1]].length;
373
355
  }
374
356
  }
375
- } // now allocate the memory
376
-
357
+ }
377
358
 
378
- var points = new Float64Array(numPts * 3);
379
- var lines = new Uint32Array(numLines * 3);
380
- var ptIdx = 0;
381
- var lineIdx = 0; // add the 8 corner points
359
+ // now allocate the memory
360
+ const points = new Float64Array(numPts * 3);
361
+ const lines = new Uint32Array(numLines * 3);
362
+ let ptIdx = 0;
363
+ let lineIdx = 0;
382
364
 
383
- for (var z = 0; z < 2; z++) {
384
- for (var y = 0; y < 2; y++) {
385
- for (var x = 0; x < 2; x++) {
365
+ // add the 8 corner points
366
+ for (let z = 0; z < 2; z++) {
367
+ for (let y = 0; y < 2; y++) {
368
+ for (let x = 0; x < 2; x++) {
386
369
  points[ptIdx * 3] = model.dataBounds[x];
387
370
  points[ptIdx * 3 + 1] = model.dataBounds[2 + y];
388
371
  points[ptIdx * 3 + 2] = model.dataBounds[4 + z];
389
372
  ptIdx++;
390
373
  }
391
374
  }
392
- } // draw the edges
393
-
375
+ }
394
376
 
395
- for (var _e = 0; _e < 12; _e++) {
396
- if (edgesToDraw[_e] > 0) {
377
+ // draw the edges
378
+ for (let e = 0; e < 12; e++) {
379
+ if (edgesToDraw[e] > 0) {
397
380
  lines[lineIdx * 3] = 2;
398
- lines[lineIdx * 3 + 1] = edgePoints[_e][0];
399
- lines[lineIdx * 3 + 2] = edgePoints[_e][1];
381
+ lines[lineIdx * 3 + 1] = edgePoints[e][0];
382
+ lines[lineIdx * 3 + 2] = edgePoints[e][1];
400
383
  lineIdx++;
401
384
  }
402
- } // now handle gridlines
385
+ }
386
+
387
+ // now handle gridlines
403
388
  // grid lines are tick[axis1] + ticks[axes2] lines each having two points
404
389
  // for simplicity we don;t worry about duplicating points, this is tiny
405
390
 
406
-
407
391
  if (model.gridLines) {
408
392
  // for each visible face
409
393
  // add the points
410
- for (var _f = 0; _f < 6; _f++) {
411
- if (facesToDraw[_f]) {
412
- var faceIdx = Math.floor(_f / 2);
413
- var aticks = ticks[faceAxes[_f][0]];
414
-
415
- for (var t = 0; t < aticks.length; t++) {
416
- points[ptIdx * 3 + faceIdx] = model.dataBounds[_f];
417
- points[ptIdx * 3 + faceAxes[_f][0]] = aticks[t];
418
- points[ptIdx * 3 + faceAxes[_f][1]] = model.dataBounds[faceAxes[_f][1] * 2];
394
+ for (let f = 0; f < 6; f++) {
395
+ if (facesToDraw[f]) {
396
+ const faceIdx = Math.floor(f / 2);
397
+ let aticks = ticks[faceAxes[f][0]];
398
+ for (let t = 0; t < aticks.length; t++) {
399
+ points[ptIdx * 3 + faceIdx] = model.dataBounds[f];
400
+ points[ptIdx * 3 + faceAxes[f][0]] = aticks[t];
401
+ points[ptIdx * 3 + faceAxes[f][1]] = model.dataBounds[faceAxes[f][1] * 2];
419
402
  ptIdx++;
420
- points[ptIdx * 3 + faceIdx] = model.dataBounds[_f];
421
- points[ptIdx * 3 + faceAxes[_f][0]] = aticks[t];
422
- points[ptIdx * 3 + faceAxes[_f][1]] = model.dataBounds[faceAxes[_f][1] * 2 + 1];
403
+ points[ptIdx * 3 + faceIdx] = model.dataBounds[f];
404
+ points[ptIdx * 3 + faceAxes[f][0]] = aticks[t];
405
+ points[ptIdx * 3 + faceAxes[f][1]] = model.dataBounds[faceAxes[f][1] * 2 + 1];
423
406
  ptIdx++;
424
407
  lines[lineIdx * 3] = 2;
425
408
  lines[lineIdx * 3 + 1] = ptIdx - 2;
426
409
  lines[lineIdx * 3 + 2] = ptIdx - 1;
427
410
  lineIdx++;
428
411
  }
429
-
430
- aticks = ticks[faceAxes[_f][1]];
431
-
432
- for (var _t = 0; _t < aticks.length; _t++) {
433
- points[ptIdx * 3 + faceIdx] = model.dataBounds[_f];
434
- points[ptIdx * 3 + faceAxes[_f][1]] = aticks[_t];
435
- points[ptIdx * 3 + faceAxes[_f][0]] = model.dataBounds[faceAxes[_f][0] * 2];
412
+ aticks = ticks[faceAxes[f][1]];
413
+ for (let t = 0; t < aticks.length; t++) {
414
+ points[ptIdx * 3 + faceIdx] = model.dataBounds[f];
415
+ points[ptIdx * 3 + faceAxes[f][1]] = aticks[t];
416
+ points[ptIdx * 3 + faceAxes[f][0]] = model.dataBounds[faceAxes[f][0] * 2];
436
417
  ptIdx++;
437
- points[ptIdx * 3 + faceIdx] = model.dataBounds[_f];
438
- points[ptIdx * 3 + faceAxes[_f][1]] = aticks[_t];
439
- points[ptIdx * 3 + faceAxes[_f][0]] = model.dataBounds[faceAxes[_f][0] * 2 + 1];
418
+ points[ptIdx * 3 + faceIdx] = model.dataBounds[f];
419
+ points[ptIdx * 3 + faceAxes[f][1]] = aticks[t];
420
+ points[ptIdx * 3 + faceAxes[f][0]] = model.dataBounds[faceAxes[f][0] * 2 + 1];
440
421
  ptIdx++;
441
422
  lines[lineIdx * 3] = 2;
442
423
  lines[lineIdx * 3 + 1] = ptIdx - 2;
@@ -446,276 +427,259 @@ function vtkCubeAxesActor(publicAPI, model) {
446
427
  }
447
428
  }
448
429
  }
449
-
450
430
  model.polyData.getPoints().setData(points, 3);
451
431
  model.polyData.getPoints().modified();
452
432
  model.polyData.getLines().setData(lines, 1);
453
433
  model.polyData.getLines().modified();
454
434
  model.polyData.modified();
455
- }; // update the data that represents where to put the labels
435
+ };
436
+
437
+ // update the data that represents where to put the labels
456
438
  // in world coordinates. This only changes when faces to draw changes
457
439
  // of dataBounds changes
458
-
459
-
460
- publicAPI.updateTextData = function (facesToDraw, edgesToDraw, ticks, tickStrings) {
440
+ publicAPI.updateTextData = (facesToDraw, edgesToDraw, ticks, tickStrings) => {
461
441
  // count outside edgesToDraw
462
- var textPointCount = 0;
463
-
464
- for (var e = 0; e < 12; e++) {
442
+ let textPointCount = 0;
443
+ for (let e = 0; e < 12; e++) {
465
444
  if (edgesToDraw[e] === 1) {
466
445
  textPointCount += 2;
467
446
  textPointCount += ticks[edgeAxes[e]].length;
468
447
  }
469
448
  }
470
-
471
- var points = model.polyData.getPoints().getData();
472
- var textPoints = new Float64Array(textPointCount * 3);
473
- var ptIdx = 0;
474
- var textIdx = 0;
475
- var axisCount = 0;
476
-
477
- for (var f = 0; f < 6; f++) {
449
+ const points = model.polyData.getPoints().getData();
450
+ const textPoints = new Float64Array(textPointCount * 3);
451
+ let ptIdx = 0;
452
+ let textIdx = 0;
453
+ let axisCount = 0;
454
+ for (let f = 0; f < 6; f++) {
478
455
  if (facesToDraw[f]) {
479
- for (var _e2 = 0; _e2 < 4; _e2++) {
480
- var edgeIdx = faceEdges[f][_e2];
481
-
456
+ for (let e = 0; e < 4; e++) {
457
+ const edgeIdx = faceEdges[f][e];
482
458
  if (edgesToDraw[edgeIdx] === 1) {
483
- var edgeAxis = edgeAxes[edgeIdx]; // add a middle point on the edge
484
-
485
- var ptIdx1 = edgePoints[edgeIdx][0] * 3;
486
- var ptIdx2 = edgePoints[edgeIdx][1] * 3;
459
+ const edgeAxis = edgeAxes[edgeIdx];
460
+ // add a middle point on the edge
461
+ const ptIdx1 = edgePoints[edgeIdx][0] * 3;
462
+ const ptIdx2 = edgePoints[edgeIdx][1] * 3;
487
463
  textPoints[ptIdx * 3] = 0.5 * (points[ptIdx1] + points[ptIdx2]);
488
464
  textPoints[ptIdx * 3 + 1] = 0.5 * (points[ptIdx1 + 1] + points[ptIdx2 + 1]);
489
465
  textPoints[ptIdx * 3 + 2] = 0.5 * (points[ptIdx1 + 2] + points[ptIdx2 + 2]);
490
- ptIdx++; // add a middle face point, we use this to
466
+ ptIdx++;
467
+ // add a middle face point, we use this to
491
468
  // move the labels away from the edge in the right direction
492
-
493
- var faceIdx = Math.floor(f / 2);
469
+ const faceIdx = Math.floor(f / 2);
494
470
  textPoints[ptIdx * 3 + faceIdx] = model.dataBounds[f];
495
471
  textPoints[ptIdx * 3 + faceAxes[f][0]] = 0.5 * (model.dataBounds[faceAxes[f][0] * 2] + model.dataBounds[faceAxes[f][0] * 2 + 1]);
496
472
  textPoints[ptIdx * 3 + faceAxes[f][1]] = 0.5 * (model.dataBounds[faceAxes[f][1] * 2] + model.dataBounds[faceAxes[f][1] * 2 + 1]);
497
- ptIdx++; // set the text
498
-
473
+ ptIdx++;
474
+ // set the text
499
475
  model.textValues[textIdx] = model.axisLabels[edgeAxis];
500
- textIdx++; // now add the tick marks along the edgeAxis
476
+ textIdx++;
501
477
 
502
- var otherAxis1 = (edgeAxis + 1) % 3;
503
- var otherAxis2 = (edgeAxis + 2) % 3;
504
- var aticks = ticks[edgeAxis];
505
- var atickStrings = tickStrings[edgeAxis];
478
+ // now add the tick marks along the edgeAxis
479
+ const otherAxis1 = (edgeAxis + 1) % 3;
480
+ const otherAxis2 = (edgeAxis + 2) % 3;
481
+ const aticks = ticks[edgeAxis];
482
+ const atickStrings = tickStrings[edgeAxis];
506
483
  model.tickCounts[axisCount] = aticks.length;
507
-
508
- for (var t = 0; t < aticks.length; t++) {
484
+ for (let t = 0; t < aticks.length; t++) {
509
485
  textPoints[ptIdx * 3 + edgeAxis] = aticks[t];
510
486
  textPoints[ptIdx * 3 + otherAxis1] = points[ptIdx1 + otherAxis1];
511
487
  textPoints[ptIdx * 3 + otherAxis2] = points[ptIdx1 + otherAxis2];
512
- ptIdx++; // set the text
513
-
488
+ ptIdx++;
489
+ // set the text
514
490
  model.textValues[textIdx] = atickStrings[t];
515
491
  textIdx++;
516
492
  }
517
-
518
493
  axisCount++;
519
494
  }
520
495
  }
521
496
  }
522
497
  }
523
-
524
498
  model.textPolyData.getPoints().setData(textPoints, 3);
525
499
  model.textPolyData.modified();
526
- }; // main method to rebuild the cube axes, gets called on camera modify
527
- // and changes to key members
528
-
500
+ };
529
501
 
530
- publicAPI.update = function () {
502
+ // main method to rebuild the cube axes, gets called on camera modify
503
+ // and changes to key members
504
+ publicAPI.update = () => {
531
505
  // Can't do anything if we don't have a camera...
532
506
  if (!model.camera) {
533
507
  return;
534
- } // compute what faces to draw
535
-
536
-
537
- var facesChanged = publicAPI.computeFacesToDraw();
538
- var facesToDraw = model.lastFacesToDraw; // have the bounds changed?
508
+ }
539
509
 
540
- var boundsChanged = false;
510
+ // compute what faces to draw
511
+ const facesChanged = publicAPI.computeFacesToDraw();
512
+ const facesToDraw = model.lastFacesToDraw;
541
513
 
542
- for (var i = 0; i < 6; i++) {
514
+ // have the bounds changed?
515
+ let boundsChanged = false;
516
+ for (let i = 0; i < 6; i++) {
543
517
  if (model.dataBounds[i] !== model.lastTickBounds[i]) {
544
518
  boundsChanged = true;
545
519
  model.lastTickBounds[i] = model.dataBounds[i];
546
520
  }
547
- } // did something significant change? If so rebuild a lot of things
548
-
521
+ }
549
522
 
523
+ // did something significant change? If so rebuild a lot of things
550
524
  if (facesChanged || boundsChanged || model.forceUpdate) {
551
525
  // compute the edges to draw
552
526
  // for each drawn face, mark edges, all single mark edges we draw
553
- var edgesToDraw = new Array(12).fill(0);
554
-
555
- for (var f = 0; f < 6; f++) {
527
+ const edgesToDraw = new Array(12).fill(0);
528
+ for (let f = 0; f < 6; f++) {
556
529
  if (facesToDraw[f]) {
557
- for (var e = 0; e < 4; e++) {
530
+ for (let e = 0; e < 4; e++) {
558
531
  edgesToDraw[faceEdges[f][e]]++;
559
532
  }
560
533
  }
561
- } // compute tick marks for axes
562
-
563
-
564
- var ticks = [];
565
- var tickStrings = [];
534
+ }
566
535
 
567
- for (var _i = 0; _i < 3; _i++) {
568
- var scale = d3.scaleLinear().domain([model.dataBounds[_i * 2], model.dataBounds[_i * 2 + 1]]);
569
- ticks[_i] = scale.ticks(5);
570
- var format = scale.tickFormat(5);
571
- tickStrings[_i] = ticks[_i].map(format);
572
- } // update gridlines / edge lines
536
+ // compute tick marks for axes
537
+ const ticks = [];
538
+ const tickStrings = [];
539
+ for (let i = 0; i < 3; i++) {
540
+ const scale = d3.scaleLinear().domain([model.dataBounds[i * 2], model.dataBounds[i * 2 + 1]]);
541
+ ticks[i] = scale.ticks(5);
542
+ const format = scale.tickFormat(5);
543
+ tickStrings[i] = ticks[i].map(format);
544
+ }
573
545
 
546
+ // update gridlines / edge lines
547
+ publicAPI.updatePolyData(facesToDraw, edgesToDraw, ticks);
574
548
 
575
- publicAPI.updatePolyData(facesToDraw, edgesToDraw, ticks); // compute label world coords and text
549
+ // compute label world coords and text
550
+ publicAPI.updateTextData(facesToDraw, edgesToDraw, ticks, tickStrings);
576
551
 
577
- publicAPI.updateTextData(facesToDraw, edgesToDraw, ticks, tickStrings); // rebuild the texture only when force or changed bounds, face
552
+ // rebuild the texture only when force or changed bounds, face
578
553
  // visibility changes do to change the atlas
579
-
580
554
  if (boundsChanged || model.forceUpdate) {
581
555
  publicAPI.updateTextureAtlas(tickStrings);
582
556
  }
583
557
  }
584
-
585
558
  model.forceUpdate = false;
586
- }; // create the texture map atlas that contains the rendering of
559
+ };
560
+
561
+ // create the texture map atlas that contains the rendering of
587
562
  // all the text strings. Only needs to be called when the text strings
588
563
  // have changed (labels and ticks)
589
-
590
-
591
- publicAPI.updateTextureAtlas = function (tickStrings) {
564
+ publicAPI.updateTextureAtlas = tickStrings => {
592
565
  // compute the width and height we need
566
+
593
567
  // set the text properties
594
568
  model.tmContext.textBaseline = 'bottom';
595
- model.tmContext.textAlign = 'left'; // first the three labels
569
+ model.tmContext.textAlign = 'left';
596
570
 
571
+ // first the three labels
597
572
  model._tmAtlas.clear();
598
-
599
- var maxWidth = 0;
600
- var totalHeight = 1; // start one pixel in so we have a border
601
-
602
- for (var i = 0; i < 3; i++) {
573
+ let maxWidth = 0;
574
+ let totalHeight = 1; // start one pixel in so we have a border
575
+ for (let i = 0; i < 3; i++) {
603
576
  if (!model._tmAtlas.has(model.axisLabels[i])) {
604
577
  applyTextStyle(model.tmContext, model.axisTextStyle);
605
- var metrics = model.tmContext.measureText(model.axisLabels[i]);
606
- var entry = {
578
+ const metrics = model.tmContext.measureText(model.axisLabels[i]);
579
+ const entry = {
607
580
  height: metrics.actualBoundingBoxAscent + 2,
608
581
  startingHeight: totalHeight,
609
582
  width: metrics.width + 2,
610
583
  textStyle: model.axisTextStyle
611
584
  };
612
-
613
585
  model._tmAtlas.set(model.axisLabels[i], entry);
614
-
615
586
  totalHeight += entry.height;
616
-
617
587
  if (maxWidth < entry.width) {
618
588
  maxWidth = entry.width;
619
589
  }
620
- } // and the ticks
621
-
622
-
590
+ }
591
+ // and the ticks
623
592
  applyTextStyle(model.tmContext, model.tickTextStyle);
624
-
625
- for (var t = 0; t < tickStrings[i].length; t++) {
593
+ for (let t = 0; t < tickStrings[i].length; t++) {
626
594
  if (!model._tmAtlas.has(tickStrings[i][t])) {
627
- var _metrics = model.tmContext.measureText(tickStrings[i][t]);
628
-
629
- var _entry = {
630
- height: _metrics.actualBoundingBoxAscent + 2,
595
+ const metrics = model.tmContext.measureText(tickStrings[i][t]);
596
+ const entry = {
597
+ height: metrics.actualBoundingBoxAscent + 2,
631
598
  startingHeight: totalHeight,
632
- width: _metrics.width + 2,
599
+ width: metrics.width + 2,
633
600
  textStyle: model.tickTextStyle
634
601
  };
635
-
636
- model._tmAtlas.set(tickStrings[i][t], _entry);
637
-
638
- totalHeight += _entry.height;
639
-
640
- if (maxWidth < _entry.width) {
641
- maxWidth = _entry.width;
602
+ model._tmAtlas.set(tickStrings[i][t], entry);
603
+ totalHeight += entry.height;
604
+ if (maxWidth < entry.width) {
605
+ maxWidth = entry.width;
642
606
  }
643
607
  }
644
608
  }
645
- } // always use power of two to avoid interpolation
646
- // in cases where PO2 is required
647
-
609
+ }
648
610
 
611
+ // always use power of two to avoid interpolation
612
+ // in cases where PO2 is required
649
613
  maxWidth = nearestPowerOfTwo(maxWidth);
650
- totalHeight = nearestPowerOfTwo(totalHeight); // set the tcoord values
614
+ totalHeight = nearestPowerOfTwo(totalHeight);
651
615
 
652
- model._tmAtlas.forEach(function (value) {
616
+ // set the tcoord values
617
+ model._tmAtlas.forEach(value => {
653
618
  value.tcoords = [0.0, (totalHeight - value.startingHeight - value.height) / totalHeight, value.width / maxWidth, (totalHeight - value.startingHeight - value.height) / totalHeight, value.width / maxWidth, (totalHeight - value.startingHeight) / totalHeight, 0.0, (totalHeight - value.startingHeight) / totalHeight];
654
- }); // make sure we have power of two dimensions
655
-
619
+ });
656
620
 
621
+ // make sure we have power of two dimensions
657
622
  model.tmCanvas.width = maxWidth;
658
623
  model.tmCanvas.height = totalHeight;
659
624
  model.tmContext.textBaseline = 'bottom';
660
625
  model.tmContext.textAlign = 'left';
661
- model.tmContext.clearRect(0, 0, maxWidth, totalHeight); // draw the text onto the texture
626
+ model.tmContext.clearRect(0, 0, maxWidth, totalHeight);
662
627
 
663
- model._tmAtlas.forEach(function (value, key) {
628
+ // draw the text onto the texture
629
+ model._tmAtlas.forEach((value, key) => {
664
630
  applyTextStyle(model.tmContext, value.textStyle);
665
631
  model.tmContext.fillText(key, 1, value.startingHeight + value.height - 1);
666
632
  });
667
-
668
633
  model.tmTexture.setCanvas(model.tmCanvas);
669
634
  model.tmTexture.modified();
670
- }; // Make sure the data is correct
671
-
635
+ };
672
636
 
673
- publicAPI.onModified(function () {
637
+ // Make sure the data is correct
638
+ publicAPI.onModified(() => {
674
639
  model.forceUpdate = true;
675
640
  publicAPI.update();
676
641
  });
677
-
678
- publicAPI.setTickTextStyle = function (tickStyle) {
679
- model.tickTextStyle = _objectSpread(_objectSpread({}, model.tickTextStyle), tickStyle);
642
+ publicAPI.setTickTextStyle = tickStyle => {
643
+ model.tickTextStyle = {
644
+ ...model.tickTextStyle,
645
+ ...tickStyle
646
+ };
680
647
  publicAPI.modified();
681
648
  };
682
-
683
- publicAPI.setAxisTextStyle = function (axisStyle) {
684
- model.axisTextStyle = _objectSpread(_objectSpread({}, model.axisTextStyle), axisStyle);
649
+ publicAPI.setAxisTextStyle = axisStyle => {
650
+ model.axisTextStyle = {
651
+ ...model.axisTextStyle,
652
+ ...axisStyle
653
+ };
685
654
  publicAPI.modified();
686
655
  };
656
+ publicAPI.get_tmAtlas = () => model._tmAtlas;
687
657
 
688
- publicAPI.get_tmAtlas = function () {
689
- return model._tmAtlas;
690
- }; // try to get the bounds for the annotation. This is complicated
658
+ // try to get the bounds for the annotation. This is complicated
691
659
  // as it relies on the pixel size of the window. Every time the camera
692
660
  // changes the bounds change. This method simplifies by just expanding
693
661
  // the grid bounds by a user specified factor.
694
-
695
-
696
- publicAPI.getBounds = function () {
662
+ publicAPI.getBounds = () => {
697
663
  publicAPI.update();
698
664
  vtkBoundingBox.setBounds(model.bounds, model.gridActor.getBounds());
699
665
  vtkBoundingBox.scaleAboutCenter(model.bounds, model.boundsScaleFactor, model.boundsScaleFactor, model.boundsScaleFactor);
700
666
  return model.bounds;
701
- }; // Make sure the grid share the actor property
702
-
667
+ };
703
668
 
704
- var _setProp = macro.chain(publicAPI.setProperty, model.gridActor.setProperty);
669
+ // Make sure the grid share the actor property
670
+ const _setProp = macro.chain(publicAPI.setProperty, model.gridActor.setProperty);
671
+ publicAPI.setProperty = p => _setProp(p)[0];
672
+ }
705
673
 
706
- publicAPI.setProperty = function (p) {
707
- return _setProp(p)[0];
708
- };
709
- } // ----------------------------------------------------------------------------
674
+ // ----------------------------------------------------------------------------
710
675
  // Object factory
711
676
  // ----------------------------------------------------------------------------
712
677
 
713
-
714
678
  function defaultValues(initialValues) {
715
- return _objectSpread({
679
+ return {
716
680
  boundsScaleFactor: 1.3,
717
681
  camera: null,
718
- dataBounds: _toConsumableArray(vtkBoundingBox.INIT_BOUNDS),
682
+ dataBounds: [...vtkBoundingBox.INIT_BOUNDS],
719
683
  faceVisibilityAngle: 8,
720
684
  gridLines: true,
721
685
  axisLabels: null,
@@ -732,17 +696,21 @@ function defaultValues(initialValues) {
732
696
  fontStyle: 'normal',
733
697
  fontSize: 14,
734
698
  fontFamily: 'serif'
735
- }
736
- }, initialValues);
737
- } // ----------------------------------------------------------------------------
699
+ },
700
+ ...initialValues
701
+ };
702
+ }
738
703
 
704
+ // ----------------------------------------------------------------------------
739
705
 
740
706
  function extend(publicAPI, model) {
741
- var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
742
- Object.assign(model, defaultValues(initialValues)); // Inheritance
707
+ let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
708
+ Object.assign(model, defaultValues(initialValues));
743
709
 
744
- vtkActor.extend(publicAPI, model, initialValues); // internal variables
710
+ // Inheritance
711
+ vtkActor.extend(publicAPI, model, initialValues);
745
712
 
713
+ // internal variables
746
714
  model.lastFacesToDraw = [false, false, false, false, false, false];
747
715
  model.axisLabels = ['X-Axis', 'Y-Axis', 'Z-Axis'];
748
716
  model.tickCounts = [];
@@ -750,8 +718,9 @@ function extend(publicAPI, model) {
750
718
  model.lastTickBounds = [];
751
719
  model.tmCanvas = document.createElement('canvas');
752
720
  model.tmContext = model.tmCanvas.getContext('2d');
753
- model._tmAtlas = new Map(); // for texture atlas
721
+ model._tmAtlas = new Map();
754
722
 
723
+ // for texture atlas
755
724
  model.tmTexture = vtkTexture.newInstance();
756
725
  model.tmTexture.setInterpolate(false);
757
726
  publicAPI.getProperty().setDiffuse(0.0);
@@ -767,17 +736,22 @@ function extend(publicAPI, model) {
767
736
  macro.setGet(publicAPI, model, ['axisTitlePixelOffset', 'boundsScaleFactor', 'faceVisibilityAngle', 'gridLines', 'tickLabelPixelOffset']);
768
737
  macro.setGetArray(publicAPI, model, ['dataBounds'], 6);
769
738
  macro.setGetArray(publicAPI, model, ['axisLabels'], 3);
770
- macro.get(publicAPI, model, ['axisTextStyle', 'tickTextStyle', 'camera', 'tmTexture', 'textValues', 'textPolyData', 'tickCounts', 'gridActor']); // Object methods
739
+ macro.get(publicAPI, model, ['axisTextStyle', 'tickTextStyle', 'camera', 'tmTexture', 'textValues', 'textPolyData', 'tickCounts', 'gridActor']);
771
740
 
741
+ // Object methods
772
742
  vtkCubeAxesActor(publicAPI, model);
773
- } // ----------------------------------------------------------------------------
743
+ }
774
744
 
775
- var newInstance = macro.newInstance(extend, 'vtkCubeAxesActor'); // ----------------------------------------------------------------------------
745
+ // ----------------------------------------------------------------------------
746
+
747
+ const newInstance = macro.newInstance(extend, 'vtkCubeAxesActor');
748
+
749
+ // ----------------------------------------------------------------------------
776
750
 
777
751
  var vtkCubeAxesActor$1 = {
778
- newInstance: newInstance,
779
- extend: extend,
780
- newCubeAxesActorHelper: newCubeAxesActorHelper
752
+ newInstance,
753
+ extend,
754
+ newCubeAxesActorHelper
781
755
  };
782
756
 
783
757
  export { vtkCubeAxesActor$1 as default, extend, newInstance };