@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,5 +1,4 @@
1
- import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
- import macro from '../../macros.js';
1
+ import { m as macro } from '../../macros2.js';
3
2
  import vtkCellArray from '../../Common/Core/CellArray.js';
4
3
  import vtkLine from '../../Common/DataModel/Line.js';
5
4
  import { d as dot, j as cross, n as norm, t as jacobi, l as normalize, k as add } from '../../Common/Core/Math/index.js';
@@ -12,14 +11,19 @@ import vtkTriangle from '../../Common/DataModel/Triangle.js';
12
11
  import { pushArray, getCellTriangles } from './OBBTree/helper.js';
13
12
  import { mat4, vec4 } from 'gl-matrix';
14
13
 
15
- var vtkErrorMacro = macro.vtkErrorMacro;
16
- var VTK_DOUBLE_MAX = Number.MAX_SAFE_INTEGER; // ----------------------------------------------------------------------------
14
+ const {
15
+ vtkErrorMacro
16
+ } = macro;
17
+ const VTK_DOUBLE_MAX = Number.MAX_SAFE_INTEGER;
18
+
19
+ // ----------------------------------------------------------------------------
17
20
  // vtkOBBTree methods
18
21
  // ----------------------------------------------------------------------------
19
22
 
20
23
  function vtkOBBTree(publicAPI, model) {
21
24
  // Set our classname
22
25
  model.classHierarchy.push('vtkOBBTree');
26
+
23
27
  /**
24
28
  * Compute an OBB from the list of cells given. This used to be
25
29
  * public but should not have been. A public call has been added
@@ -31,116 +35,108 @@ function vtkOBBTree(publicAPI, model) {
31
35
  * @param {Array[3]} min
32
36
  * @param {Array[3]} size
33
37
  */
34
-
35
38
  function computeOBB(cells, corner, max, mid, min, size) {
36
39
  model.OBBCount++;
37
- model.pointsList = []; //
40
+ model.pointsList = [];
41
+ //
38
42
  // Compute mean & moments
39
43
  //
40
44
 
41
- var numCells = cells.length;
42
- var mean = [0, 0, 0];
43
- var totMass = 0.0;
44
- var a0 = [0, 0, 0];
45
- var a1 = [0, 0, 0];
46
- var a2 = [0, 0, 0];
47
- var a = [0, 0, 0, 0, 0, 0, 0, 0, 0];
48
- var dp0 = [0, 0, 0];
49
- var dp1 = [0, 0, 0];
50
- var c = [0, 0, 0];
51
- var triMass = 0;
52
-
45
+ const numCells = cells.length;
46
+ const mean = [0, 0, 0];
47
+ let totMass = 0.0;
48
+ const a0 = [0, 0, 0];
49
+ const a1 = [0, 0, 0];
50
+ const a2 = [0, 0, 0];
51
+ let a = [0, 0, 0, 0, 0, 0, 0, 0, 0];
52
+ const dp0 = [0, 0, 0];
53
+ const dp1 = [0, 0, 0];
54
+ const c = [0, 0, 0];
55
+ let triMass = 0;
53
56
  if (!model.dataset.getCells()) {
54
57
  model.dataset.buildCells();
55
58
  }
56
-
57
- for (var i = 0; i < numCells; i++) {
58
- var cellId = cells[i];
59
- var type = model.dataset.getCells().getCellType(cellId);
60
- var ptIds = model.dataset.getCellPoints(cellId).cellPointIds;
61
- var _numPts = ptIds.length;
62
-
63
- for (var j = 0; j < _numPts - 2; j++) {
64
- var cellsIds = getCellTriangles(ptIds, type, j);
65
- var pId = cellsIds.ptId0;
66
- var qId = cellsIds.ptId1;
67
- var rId = cellsIds.ptId2;
68
-
59
+ for (let i = 0; i < numCells; i++) {
60
+ const cellId = cells[i];
61
+ const type = model.dataset.getCells().getCellType(cellId);
62
+ const ptIds = model.dataset.getCellPoints(cellId).cellPointIds;
63
+ const numPts = ptIds.length;
64
+ for (let j = 0; j < numPts - 2; j++) {
65
+ const cellsIds = getCellTriangles(ptIds, type, j);
66
+ const pId = cellsIds.ptId0;
67
+ const qId = cellsIds.ptId1;
68
+ const rId = cellsIds.ptId2;
69
69
  if (pId < 0) {
70
70
  // eslint-disable-next-line no-continue
71
71
  continue;
72
72
  }
73
-
74
- var p = [];
75
- var q = [];
76
- var r = [];
73
+ const p = [];
74
+ const q = [];
75
+ const r = [];
77
76
  model.dataset.getPoints().getPoint(pId, p);
78
77
  model.dataset.getPoints().getPoint(qId, q);
79
- model.dataset.getPoints().getPoint(rId, r); // p, q, and r are the oriented triangle points.
80
- // Compute the components of the moment of inertia tensor.
78
+ model.dataset.getPoints().getPoint(rId, r);
81
79
 
82
- for (var k = 0; k < 3; k++) {
80
+ // p, q, and r are the oriented triangle points.
81
+ // Compute the components of the moment of inertia tensor.
82
+ for (let k = 0; k < 3; k++) {
83
83
  // two edge vectors
84
84
  dp0[k] = q[k] - p[k];
85
- dp1[k] = r[k] - p[k]; // centroid
86
-
85
+ dp1[k] = r[k] - p[k];
86
+ // centroid
87
87
  c[k] = (p[k] + q[k] + r[k]) / 3;
88
88
  }
89
-
90
- var xp = cross(dp0, dp1, []);
89
+ const xp = cross(dp0, dp1, []);
91
90
  triMass = 0.5 * norm(xp);
92
91
  totMass += triMass;
92
+ for (let k = 0; k < 3; k++) {
93
+ mean[k] += triMass * c[k];
94
+ }
93
95
 
94
- for (var _k = 0; _k < 3; _k++) {
95
- mean[_k] += triMass * c[_k];
96
- } // on-diagonal terms
97
-
98
-
96
+ // on-diagonal terms
99
97
  a0[0] += triMass * (9 * c[0] * c[0] + p[0] * p[0] + q[0] * q[0] + r[0] * r[0]) / 12;
100
98
  a1[1] += triMass * (9 * c[1] * c[1] + p[1] * p[1] + q[1] * q[1] + r[1] * r[1]) / 12;
101
- a2[2] += triMass * (9 * c[2] * c[2] + p[2] * p[2] + q[2] * q[2] + r[2] * r[2]) / 12; // off-diagonal terms
99
+ a2[2] += triMass * (9 * c[2] * c[2] + p[2] * p[2] + q[2] * q[2] + r[2] * r[2]) / 12;
102
100
 
101
+ // off-diagonal terms
103
102
  a0[1] += triMass * (9 * c[0] * c[1] + p[0] * p[1] + q[0] * q[1] + r[0] * r[1]) / 12;
104
103
  a0[2] += triMass * (9 * c[0] * c[2] + p[0] * p[2] + q[0] * q[2] + r[0] * r[2]) / 12;
105
104
  a1[2] += triMass * (9 * c[1] * c[2] + p[1] * p[2] + q[1] * q[2] + r[1] * r[2]) / 12;
106
105
  } // end foreach triangle
106
+
107
107
  // While computing cell moments, gather all the cell's
108
108
  // point coordinates into a single list.
109
-
110
-
111
- for (var _j = 0; _j < _numPts; _j++) {
112
- if (model.insertedPoints[ptIds[_j]] !== model.OBBCount) {
113
- model.insertedPoints[ptIds[_j]] = model.OBBCount;
114
- var pt = [];
115
- model.dataset.getPoints().getPoint(ptIds[_j], pt);
109
+ for (let j = 0; j < numPts; j++) {
110
+ if (model.insertedPoints[ptIds[j]] !== model.OBBCount) {
111
+ model.insertedPoints[ptIds[j]] = model.OBBCount;
112
+ const pt = [];
113
+ model.dataset.getPoints().getPoint(ptIds[j], pt);
116
114
  model.pointsList.push(pt);
117
115
  }
118
116
  } // for all points of this cell
119
-
120
117
  } // end foreach cell
121
- // normalize data
122
-
123
-
124
- for (var _i = 0; _i < 3; _i++) {
125
- mean[_i] /= totMass;
126
- } // matrix is symmetric
127
118
 
119
+ // normalize data
120
+ for (let i = 0; i < 3; i++) {
121
+ mean[i] /= totMass;
122
+ }
128
123
 
124
+ // matrix is symmetric
129
125
  a1[0] = a0[1];
130
126
  a2[0] = a0[2];
131
127
  a2[1] = a1[2];
132
- a = [a0[0], a0[1], a0[2], a1[0], a1[1], a1[2], a2[0], a2[1], a2[2]]; // get covariance from moments
133
-
134
- for (var _i2 = 0; _i2 < 3; _i2++) {
135
- for (var _j2 = 0; _j2 < 3; _j2++) {
136
- a[_i2 * 3 + _j2] = a[_i2 * 3 + _j2] / totMass - mean[_i2] * mean[_j2];
128
+ a = [a0[0], a0[1], a0[2], a1[0], a1[1], a1[2], a2[0], a2[1], a2[2]];
129
+ // get covariance from moments
130
+ for (let i = 0; i < 3; i++) {
131
+ for (let j = 0; j < 3; j++) {
132
+ a[i * 3 + j] = a[i * 3 + j] / totMass - mean[i] * mean[j];
137
133
  }
138
- } //
134
+ }
135
+
136
+ //
139
137
  // Extract axes (i.e., eigenvectors) from covariance matrix.
140
138
  //
141
-
142
-
143
- var v = [0, 0, 0, 0, 0, 0, 0, 0, 0];
139
+ const v = [0, 0, 0, 0, 0, 0, 0, 0, 0];
144
140
  jacobi(a, size, v);
145
141
  max[0] = v[0];
146
142
  max[1] = v[3];
@@ -151,130 +147,116 @@ function vtkOBBTree(publicAPI, model) {
151
147
  min[0] = v[2];
152
148
  min[1] = v[5];
153
149
  min[2] = v[8];
150
+ for (let i = 0; i < 3; i++) {
151
+ a[i] = mean[i] + max[i];
152
+ a[3 + i] = mean[i] + mid[i];
153
+ a[6 + i] = mean[i] + min[i];
154
+ }
154
155
 
155
- for (var _i3 = 0; _i3 < 3; _i3++) {
156
- a[_i3] = mean[_i3] + max[_i3];
157
- a[3 + _i3] = mean[_i3] + mid[_i3];
158
- a[6 + _i3] = mean[_i3] + min[_i3];
159
- } //
156
+ //
160
157
  // Create oriented bounding box by projecting points onto eigenvectors.
161
158
  //
162
-
163
-
164
- var tMin = [VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, VTK_DOUBLE_MAX];
165
- var tMax = [-VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX];
166
- var numPts = model.pointsList.length;
167
-
168
- for (var ptId = 0; ptId < numPts; ptId++) {
169
- var _p = model.pointsList[ptId];
170
-
171
- for (var _i4 = 0; _i4 < 3; _i4++) {
172
- var out = vtkLine.distanceToLine(_p, mean, a.slice(3 * _i4, 3 * (_i4 + 1)), []);
173
-
174
- if (out.t < tMin[_i4]) {
175
- tMin[_i4] = out.t;
159
+ const tMin = [VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, VTK_DOUBLE_MAX];
160
+ const tMax = [-VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX];
161
+ const numPts = model.pointsList.length;
162
+ for (let ptId = 0; ptId < numPts; ptId++) {
163
+ const p = model.pointsList[ptId];
164
+ for (let i = 0; i < 3; i++) {
165
+ const out = vtkLine.distanceToLine(p, mean, a.slice(3 * i, 3 * (i + 1)), []);
166
+ if (out.t < tMin[i]) {
167
+ tMin[i] = out.t;
176
168
  }
177
-
178
- if (out.t > tMax[_i4]) {
179
- tMax[_i4] = out.t;
169
+ if (out.t > tMax[i]) {
170
+ tMax[i] = out.t;
180
171
  }
181
172
  }
182
173
  } // for all points
183
174
 
184
-
185
- for (var _i5 = 0; _i5 < 3; _i5++) {
186
- corner[_i5] = mean[_i5] + tMin[0] * max[_i5] + tMin[1] * mid[_i5] + tMin[2] * min[_i5];
187
- max[_i5] *= tMax[0] - tMin[0];
188
- mid[_i5] *= tMax[1] - tMin[1];
189
- min[_i5] *= tMax[2] - tMin[2];
175
+ for (let i = 0; i < 3; i++) {
176
+ corner[i] = mean[i] + tMin[0] * max[i] + tMin[1] * mid[i] + tMin[2] * min[i];
177
+ max[i] *= tMax[0] - tMin[0];
178
+ mid[i] *= tMax[1] - tMin[1];
179
+ min[i] *= tMax[2] - tMin[2];
190
180
  }
191
181
  }
182
+
192
183
  /**
193
184
  * Build the OBB tree
194
185
  * @param {Array} cells
195
186
  * @param {vtkOBBNode} obbNode
196
187
  * @param {Number} level
197
188
  */
198
-
199
-
200
189
  function buildTree(cells, obbNode, level) {
201
- var numCells = cells.length;
202
-
190
+ const numCells = cells.length;
203
191
  if (level > model.level) {
204
192
  model.level = level;
205
193
  }
206
-
207
- var axes = obbNode.getAxes();
208
- var corner = obbNode.getCorner();
209
- var size = [0, 0, 0];
194
+ const axes = obbNode.getAxes();
195
+ const corner = obbNode.getCorner();
196
+ const size = [0, 0, 0];
210
197
  computeOBB(cells, corner, axes[0], axes[1], axes[2], size);
211
198
  obbNode.setAxes(axes);
212
- obbNode.setCorner(corner); // Check whether to continue recursing; if so, create two children and
213
- // assign cells to appropriate child.
199
+ obbNode.setCorner(corner);
214
200
 
201
+ // Check whether to continue recursing; if so, create two children and
202
+ // assign cells to appropriate child.
215
203
  if (level < model.maxLevel && numCells > model.numberOfCellsPerNode) {
216
- var LHlist = [];
217
- var RHlist = [];
218
- var p = [0, 0, 0];
219
- var n = [0, 0, 0]; // loop over three split planes to find acceptable one
204
+ let LHlist = [];
205
+ let RHlist = [];
206
+ const p = [0, 0, 0];
207
+ const n = [0, 0, 0];
220
208
 
221
- for (var i = 0; i < 3; i++) {
209
+ // loop over three split planes to find acceptable one
210
+ for (let i = 0; i < 3; i++) {
222
211
  // compute split point
223
212
  p[i] = corner[i] + axes[0][i] / 2 + axes[1][i] / 2 + axes[2][i] / 2;
224
213
  }
225
-
226
- var splitPlane = 0;
227
- var splitAcceptable = 0;
228
- var bestRatio = 1;
229
- var foundBestSplit = 0;
230
- var bestPlane = 0;
231
-
214
+ let splitPlane = 0;
215
+ let splitAcceptable = 0;
216
+ let bestRatio = 1;
217
+ let foundBestSplit = 0;
218
+ let bestPlane = 0;
232
219
  for (; !splitAcceptable && splitPlane < 3;) {
233
220
  // compute split normal
234
- for (var _i6 = 0; _i6 < 3; _i6++) {
235
- n[_i6] = axes[splitPlane][_i6];
221
+ for (let i = 0; i < 3; i++) {
222
+ n[i] = axes[splitPlane][i];
236
223
  }
237
-
238
- normalize(n); // traverse cells, assigning to appropriate child list as necessary
239
-
240
- var _loop = function _loop(_i7) {
241
- var cellId = cells[_i7];
242
- var pointsIDs = model.dataset.getCellPoints(cellId).cellPointIds;
243
- var cellPts = [];
244
- pointsIDs.forEach(function (id) {
245
- var pt = [];
224
+ normalize(n);
225
+
226
+ // traverse cells, assigning to appropriate child list as necessary
227
+ for (let i = 0; i < numCells; i++) {
228
+ const cellId = cells[i];
229
+ const pointsIDs = model.dataset.getCellPoints(cellId).cellPointIds;
230
+ const cellPts = [];
231
+ pointsIDs.forEach(id => {
232
+ const pt = [];
246
233
  model.dataset.getPoints().getPoint(pointsIDs[id], pt);
247
234
  cellPts.push(pt);
248
235
  });
249
- var c = [0, 0, 0];
250
- var numPts = cellPts.length;
251
- var negative = 0;
252
- var positive = 0;
253
-
254
- for (var j = 0; j < numPts; j++) {
255
- var ptId = pointsIDs[j];
256
- var x = model.dataset.getPoints().getPoint(ptId);
257
- var val = n[0] * (x[0] - p[0]) + n[1] * (x[1] - p[1]) + n[2] * (x[2] - p[2]);
236
+ const c = [0, 0, 0];
237
+ const numPts = cellPts.length;
238
+ let negative = 0;
239
+ let positive = 0;
240
+ for (let j = 0; j < numPts; j++) {
241
+ const ptId = pointsIDs[j];
242
+ const x = model.dataset.getPoints().getPoint(ptId);
243
+ const val = n[0] * (x[0] - p[0]) + n[1] * (x[1] - p[1]) + n[2] * (x[2] - p[2]);
258
244
  c[0] += x[0];
259
245
  c[1] += x[1];
260
246
  c[2] += x[2];
261
-
262
247
  if (val < 0.0) {
263
248
  negative = 1;
264
249
  } else {
265
250
  positive = 1;
266
251
  }
267
252
  }
268
-
269
253
  if (negative && positive) {
270
254
  // Use centroid to decide straddle cases
271
255
  c[0] /= numPts;
272
256
  c[1] /= numPts;
273
257
  c[2] /= numPts;
274
-
275
- var _val = n[0] * (c[0] - p[0]) + n[1] * (c[1] - p[1]) + n[2] * (c[2] - p[2]);
276
-
277
- if (_val < 0.0) {
258
+ const val = n[0] * (c[0] - p[0]) + n[1] * (c[1] - p[1]) + n[2] * (c[2] - p[2]);
259
+ if (val < 0.0) {
278
260
  LHlist.push(cellId);
279
261
  } else {
280
262
  RHlist.push(cellId);
@@ -284,18 +266,14 @@ function vtkOBBTree(publicAPI, model) {
284
266
  } else {
285
267
  RHlist.push(cellId);
286
268
  }
287
- };
288
-
289
- for (var _i7 = 0; _i7 < numCells; _i7++) {
290
- _loop(_i7);
291
269
  } // for all cells
292
- // evaluate this split
293
270
 
271
+ // evaluate this split
272
+ const numInLHnode = LHlist.length;
273
+ const numInRHnode = RHlist.length;
274
+ const ratio = Math.abs((numInRHnode - numInLHnode) / numCells);
294
275
 
295
- var numInLHnode = LHlist.length;
296
- var numInRHnode = RHlist.length;
297
- var ratio = Math.abs((numInRHnode - numInLHnode) / numCells); // see whether we've found acceptable split plane
298
-
276
+ // see whether we've found acceptable split plane
299
277
  if (ratio < 0.6 || foundBestSplit) {
300
278
  // accept right off the bat
301
279
  splitAcceptable = 1;
@@ -303,26 +281,22 @@ function vtkOBBTree(publicAPI, model) {
303
281
  // not a great split try another
304
282
  LHlist = [];
305
283
  RHlist = [];
306
-
307
284
  if (ratio < bestRatio) {
308
285
  bestRatio = ratio;
309
286
  bestPlane = splitPlane;
310
287
  }
311
-
312
288
  if (++splitPlane === 3 && bestRatio < 0.95) {
313
289
  // at closing time, even the ugly ones look good
314
290
  splitPlane = bestPlane;
315
291
  foundBestSplit = 1;
316
292
  }
317
293
  } // try another split
318
-
319
294
  } // for each split
320
295
 
321
-
322
296
  if (splitAcceptable) {
323
297
  // otherwise recursion terminates
324
- var LHnode = vtkOBBNode.newInstance();
325
- var RHnode = vtkOBBNode.newInstance();
298
+ const LHnode = vtkOBBNode.newInstance();
299
+ const RHnode = vtkOBBNode.newInstance();
326
300
  obbNode.setKids([LHnode, RHnode]);
327
301
  LHnode.setParent(obbNode);
328
302
  RHnode.setParent(obbNode);
@@ -336,42 +310,40 @@ function vtkOBBTree(publicAPI, model) {
336
310
  }
337
311
  } // if should build tree
338
312
 
339
-
340
313
  if (cells && model.retainCellLists) {
341
314
  obbNode.setCells(cells);
342
315
  } else if (cells) {
343
316
  cells.length = 0;
344
317
  }
345
318
  }
346
-
347
319
  function generatePolygons(obbNode, level, repLevel, points, cells) {
348
320
  if (level === repLevel || repLevel < 0 && obbNode.getKids()) {
349
- var nbPoints = points.getNumberOfPoints();
350
- var newPoints = [];
351
- var newCells = [];
352
- var cubeIds = [];
353
- newPoints.push.apply(newPoints, _toConsumableArray(obbNode.getCorner()));
321
+ let nbPoints = points.getNumberOfPoints();
322
+ const newPoints = [];
323
+ const newCells = [];
324
+ const cubeIds = [];
325
+ newPoints.push(...obbNode.getCorner());
354
326
  cubeIds[0] = nbPoints++;
355
- var x = [];
356
- newPoints.push.apply(newPoints, _toConsumableArray(add(obbNode.getCorner(), obbNode.getAxis(0), x)));
327
+ const x = [];
328
+ newPoints.push(...add(obbNode.getCorner(), obbNode.getAxis(0), x));
357
329
  cubeIds[1] = nbPoints++;
358
- var y = [];
359
- newPoints.push.apply(newPoints, _toConsumableArray(add(obbNode.getCorner(), obbNode.getAxis(1), y)));
330
+ const y = [];
331
+ newPoints.push(...add(obbNode.getCorner(), obbNode.getAxis(1), y));
360
332
  cubeIds[2] = nbPoints++;
361
- var xy = [];
362
- newPoints.push.apply(newPoints, _toConsumableArray(add(x, obbNode.getAxis(1), xy)));
333
+ const xy = [];
334
+ newPoints.push(...add(x, obbNode.getAxis(1), xy));
363
335
  cubeIds[3] = nbPoints++;
364
- var z = [];
365
- newPoints.push.apply(newPoints, _toConsumableArray(add(obbNode.getCorner(), obbNode.getAxis(2), z)));
336
+ const z = [];
337
+ newPoints.push(...add(obbNode.getCorner(), obbNode.getAxis(2), z));
366
338
  cubeIds[4] = nbPoints++;
367
- var xz = [];
368
- newPoints.push.apply(newPoints, _toConsumableArray(add(x, obbNode.getAxis(2), xz)));
339
+ const xz = [];
340
+ newPoints.push(...add(x, obbNode.getAxis(2), xz));
369
341
  cubeIds[5] = nbPoints++;
370
- var yz = [];
371
- newPoints.push.apply(newPoints, _toConsumableArray(add(y, obbNode.getAxis(2), yz)));
342
+ const yz = [];
343
+ newPoints.push(...add(y, obbNode.getAxis(2), yz));
372
344
  cubeIds[6] = nbPoints++;
373
- var xyz = [];
374
- newPoints.push.apply(newPoints, _toConsumableArray(add(xy, obbNode.getAxis(2), xyz)));
345
+ const xyz = [];
346
+ newPoints.push(...add(xy, obbNode.getAxis(2), xyz));
375
347
  cubeIds[7] = nbPoints++;
376
348
  newCells.push(4, cubeIds[0], cubeIds[2], cubeIds[3], cubeIds[1]);
377
349
  newCells.push(4, cubeIds[0], cubeIds[1], cubeIds[5], cubeIds[4]);
@@ -386,39 +358,36 @@ function vtkOBBTree(publicAPI, model) {
386
358
  generatePolygons(obbNode.getKids()[1], level + 1, repLevel, points, cells);
387
359
  }
388
360
  }
361
+
389
362
  /**
390
363
  * Transform the whole OBB tree by using input transform
391
364
  * @param {Transform} transform vtkjs Transform object
392
365
  */
393
-
394
-
395
- publicAPI.transform = function (transform) {
366
+ publicAPI.transform = transform => {
396
367
  // Setup matrix used to transform vectors
397
- var matrix = mat4.create();
368
+ const matrix = mat4.create();
398
369
  mat4.copy(matrix, transform.getMatrix());
399
370
  matrix[12] = 0;
400
371
  matrix[13] = 0;
401
372
  matrix[14] = 0;
402
373
  matrix[15] = 1;
403
- var transformVector = vtkMatrixBuilder.buildFromRadian().setMatrix(matrix);
404
- var obbStack = new Array(model.level + 1);
374
+ const transformVector = vtkMatrixBuilder.buildFromRadian().setMatrix(matrix);
375
+ const obbStack = new Array(model.level + 1);
405
376
  obbStack[0] = model.tree;
406
- var depth = 1;
407
-
377
+ let depth = 1;
408
378
  while (depth > 0) {
409
379
  depth -= 1;
410
- var node = obbStack[depth];
411
- var corner = node.getCorner();
412
- var max = node.getAxis(0);
413
- var mid = node.getAxis(1);
414
- var min = node.getAxis(2);
380
+ const node = obbStack[depth];
381
+ const corner = node.getCorner();
382
+ const max = node.getAxis(0);
383
+ const mid = node.getAxis(1);
384
+ const min = node.getAxis(2);
415
385
  transform.apply(corner);
416
386
  transformVector.apply(max);
417
387
  transformVector.apply(mid);
418
388
  transformVector.apply(min);
419
389
  node.setCorner(corner);
420
390
  node.setAxes([max, mid, min]);
421
-
422
391
  if (node.getKids() !== null) {
423
392
  // push kids onto stack
424
393
  obbStack[depth] = node.getKids()[0];
@@ -427,31 +396,29 @@ function vtkOBBTree(publicAPI, model) {
427
396
  }
428
397
  }
429
398
  };
399
+
430
400
  /**
431
401
  * Deep copy input node into class attribute tree
432
402
  * @param {vtkOBBNode} tree
433
403
  * @returns
434
404
  */
435
-
436
-
437
- publicAPI.deepCopy = function (tree) {
405
+ publicAPI.deepCopy = tree => {
438
406
  if (!tree) {
439
407
  return;
440
408
  }
441
-
442
409
  publicAPI.setLevel(tree.getLevel());
443
410
  publicAPI.setRetainCellLists(tree.getRetainCellLists());
444
411
  publicAPI.setDataset(tree.getDataset());
445
412
  publicAPI.setAutomatic(tree.getAutomatic());
446
413
  publicAPI.setNumberOfCellsPerNode(tree.getNumberOfCellsPerNode());
447
414
  publicAPI.setTolerance(tree.getTolerance());
448
- var root = tree.getTree();
449
-
415
+ const root = tree.getTree();
450
416
  if (root) {
451
417
  model.tree = vtkOBBNode.newInstance();
452
418
  model.tree.deepCopy(root);
453
419
  }
454
420
  };
421
+
455
422
  /**
456
423
  * A method to compute the OBB of a dataset without having to go through the
457
424
  * Execute method; It does set
@@ -462,36 +429,28 @@ function vtkOBBTree(publicAPI, model) {
462
429
  * @param {Array[3]} min
463
430
  * @param {Array[3]} size
464
431
  */
465
-
466
-
467
- publicAPI.computeOBBFromDataset = function (input, corner, max, mid, min, size) {
432
+ publicAPI.computeOBBFromDataset = (input, corner, max, mid, min, size) => {
468
433
  if (!input) {
469
434
  return;
470
435
  }
471
-
472
- var numPts = input.getPoints().getNumberOfPoints();
473
- var numCells = input.getNumberOfCells();
474
-
436
+ const numPts = input.getPoints().getNumberOfPoints();
437
+ const numCells = input.getNumberOfCells();
475
438
  if (numPts < 1 || numCells < 1) {
476
439
  vtkErrorMacro("Can't compute OBB - no data available!");
477
440
  return;
478
441
  }
479
-
480
442
  model.dataset = input;
481
443
  model.OBBCount = 0;
482
444
  model.insertedPoints = Array.from({
483
445
  length: numPts
484
- }, function (_) {
485
- return 0;
486
- });
446
+ }, _ => 0);
487
447
  model.pointsList = [];
488
- var cellList = Array.from({
448
+ const cellList = Array.from({
489
449
  length: numCells
490
- }, function (_, i) {
491
- return i;
492
- });
450
+ }, (_, i) => i);
493
451
  computeOBB(cellList, corner, max, mid, min, size);
494
452
  };
453
+
495
454
  /**
496
455
  * Returns true if nodeB and nodeA are disjoint after optional
497
456
  * transformation of nodeB with matrix XformBtoA
@@ -499,20 +458,17 @@ function vtkOBBTree(publicAPI, model) {
499
458
  * @param {vtkOBBNode} nodeB
500
459
  * @param {mat4} XformBtoA
501
460
  */
502
-
503
-
504
- publicAPI.disjointOBBNodes = function (nodeA, nodeB, XformBtoA) {
461
+ publicAPI.disjointOBBNodes = (nodeA, nodeB, XformBtoA) => {
505
462
  if (!nodeA || !nodeB) {
506
463
  return 5; // A and B are disjoint
507
464
  }
508
465
 
509
- var input = new Array(4);
510
- var output = new Array(4);
511
- var eps = model.tolerance;
512
- var pA = nodeA;
513
- var pB = vtkOBBNode.newInstance();
514
- var dotAB = [0, 0, 0, 0, 0, 0, 0, 0, 0];
515
-
466
+ const input = new Array(4);
467
+ const output = new Array(4);
468
+ const eps = model.tolerance;
469
+ const pA = nodeA;
470
+ let pB = vtkOBBNode.newInstance();
471
+ const dotAB = [0, 0, 0, 0, 0, 0, 0, 0, 0];
516
472
  if (XformBtoA) {
517
473
  // Here we assume that XformBtoA is an orthogonal matrix
518
474
  input[0] = nodeB.getCorner()[0];
@@ -520,171 +476,155 @@ function vtkOBBTree(publicAPI, model) {
520
476
  input[2] = nodeB.getCorner()[2];
521
477
  input[3] = 1.0;
522
478
  vec4.transformMat4(output, input, XformBtoA);
523
- pB.setCorner([output[0] / output[3], output[1] / output[3], output[2] / output[3]]); // Clean this up when the bug input MultiplyVectors is fixed!
524
-
525
- for (var ii = 0; ii < 3; ii++) {
479
+ pB.setCorner([output[0] / output[3], output[1] / output[3], output[2] / output[3]]);
480
+ // Clean this up when the bug input MultiplyVectors is fixed!
481
+ for (let ii = 0; ii < 3; ii++) {
526
482
  pB.getAxis(0)[ii] = nodeB.getCorner()[ii] + nodeB.getAxis(0)[ii];
527
483
  pB.getAxis(1)[ii] = nodeB.getCorner()[ii] + nodeB.getAxis(1)[ii];
528
484
  pB.getAxis(2)[ii] = nodeB.getCorner()[ii] + nodeB.getAxis(2)[ii];
529
485
  }
530
-
531
- for (var _ii = 0; _ii < 3; _ii++) {
532
- input[0] = pB.getAxis(_ii)[0];
533
- input[1] = pB.getAxis(_ii)[1];
534
- input[2] = pB.getAxis(_ii)[2];
486
+ for (let ii = 0; ii < 3; ii++) {
487
+ input[0] = pB.getAxis(ii)[0];
488
+ input[1] = pB.getAxis(ii)[1];
489
+ input[2] = pB.getAxis(ii)[2];
535
490
  input[3] = 1.0;
536
491
  vec4.transformMat4(output, input, XformBtoA);
537
- pB.getAxis(_ii)[0] = output[0] / output[3];
538
- pB.getAxis(_ii)[1] = output[1] / output[3];
539
- pB.getAxis(_ii)[2] = output[2] / output[3];
492
+ pB.getAxis(ii)[0] = output[0] / output[3];
493
+ pB.getAxis(ii)[1] = output[1] / output[3];
494
+ pB.getAxis(ii)[2] = output[2] / output[3];
540
495
  }
541
-
542
- for (var _ii2 = 0; _ii2 < 3; _ii2++) {
543
- pB.getAxis(0)[_ii2] = pB.getAxis(0)[_ii2] - pB.getCorner()[_ii2];
544
- pB.getAxis(1)[_ii2] = pB.getAxis(1)[_ii2] - pB.getCorner()[_ii2];
545
- pB.getAxis(2)[_ii2] = pB.getAxis(2)[_ii2] - pB.getCorner()[_ii2];
496
+ for (let ii = 0; ii < 3; ii++) {
497
+ pB.getAxis(0)[ii] = pB.getAxis(0)[ii] - pB.getCorner()[ii];
498
+ pB.getAxis(1)[ii] = pB.getAxis(1)[ii] - pB.getCorner()[ii];
499
+ pB.getAxis(2)[ii] = pB.getAxis(2)[ii] - pB.getCorner()[ii];
546
500
  }
547
501
  } else {
548
502
  pB = nodeB;
549
503
  }
504
+ const centerA = [0, 0, 0];
505
+ const centerB = [0, 0, 0];
506
+ const AtoB = [0, 0, 0];
507
+ for (let ii = 0; ii < 3; ii++) {
508
+ centerA[ii] = pA.getCorner()[ii] + 0.5 * (pA.getAxis(0)[ii] + pA.getAxis(1)[ii] + pA.getAxis(2)[ii]);
509
+ centerB[ii] = pB.getCorner()[ii] + 0.5 * (pB.getAxis(0)[ii] + pB.getAxis(1)[ii] + pB.getAxis(2)[ii]);
510
+ AtoB[ii] = centerB[ii] - centerA[ii];
511
+ }
550
512
 
551
- var centerA = [0, 0, 0];
552
- var centerB = [0, 0, 0];
553
- var AtoB = [0, 0, 0];
554
-
555
- for (var _ii3 = 0; _ii3 < 3; _ii3++) {
556
- centerA[_ii3] = pA.getCorner()[_ii3] + 0.5 * (pA.getAxis(0)[_ii3] + pA.getAxis(1)[_ii3] + pA.getAxis(2)[_ii3]);
557
- centerB[_ii3] = pB.getCorner()[_ii3] + 0.5 * (pB.getAxis(0)[_ii3] + pB.getAxis(1)[_ii3] + pB.getAxis(2)[_ii3]);
558
- AtoB[_ii3] = centerB[_ii3] - centerA[_ii3];
559
- } // Project maximal and minimal corners onto line between centers
560
-
561
-
562
- var rangeAmin = dot(pA.getCorner(), AtoB);
563
- var rangeAmax = rangeAmin;
564
- var rangeBmin = dot(pB.getCorner(), AtoB);
565
- var rangeBmax = rangeBmin;
566
- var dotA = 0;
567
- var dotB = 0;
568
-
569
- for (var _ii4 = 0; _ii4 < 3; _ii4++) {
513
+ // Project maximal and minimal corners onto line between centers
514
+ let rangeAmin = dot(pA.getCorner(), AtoB);
515
+ let rangeAmax = rangeAmin;
516
+ let rangeBmin = dot(pB.getCorner(), AtoB);
517
+ let rangeBmax = rangeBmin;
518
+ let dotA = 0;
519
+ let dotB = 0;
520
+ for (let ii = 0; ii < 3; ii++) {
570
521
  // compute A range
571
- dotA = dot(pA.getAxis(_ii4), AtoB);
572
-
522
+ dotA = dot(pA.getAxis(ii), AtoB);
573
523
  if (dotA > 0) {
574
524
  rangeAmax += dotA;
575
525
  } else {
576
526
  rangeAmin += dotA;
577
- } // compute B range
578
-
579
-
580
- dotB = dot(pB.getAxis(_ii4), AtoB);
527
+ }
581
528
 
529
+ // compute B range
530
+ dotB = dot(pB.getAxis(ii), AtoB);
582
531
  if (dotB > 0) {
583
532
  rangeBmax += dotB;
584
533
  } else {
585
534
  rangeBmin += dotB;
586
535
  }
587
536
  }
588
-
589
537
  if (rangeAmax + eps < rangeBmin || rangeBmax + eps < rangeAmin) {
590
538
  return 1; // A and B are Disjoint by the 1st test.
591
- } // now check for a separation plane parallel to the faces of B
592
-
539
+ }
593
540
 
594
- for (var _ii5 = 0; _ii5 < 3; _ii5++) {
541
+ // now check for a separation plane parallel to the faces of B
542
+ for (let ii = 0; ii < 3; ii++) {
595
543
  // plane is normal to pB.getAxis(ii)
596
544
  // computing B range is easy...
597
- rangeBmin = dot(pB.getCorner(), pB.getAxis(_ii5));
545
+ rangeBmin = dot(pB.getCorner(), pB.getAxis(ii));
598
546
  rangeBmax = rangeBmin;
599
- rangeBmax += dot(pB.getAxis(_ii5), pB.getAxis(_ii5)); // compute A range...
547
+ rangeBmax += dot(pB.getAxis(ii), pB.getAxis(ii));
600
548
 
601
- rangeAmin = dot(pA.getCorner(), pB.getAxis(_ii5));
549
+ // compute A range...
550
+ rangeAmin = dot(pA.getCorner(), pB.getAxis(ii));
602
551
  rangeAmax = rangeAmin;
603
-
604
- for (var jj = 0; jj < 3; jj++) {
552
+ for (let jj = 0; jj < 3; jj++) {
605
553
  // (note: we are saving all 9 dotproducts for future use)
606
- dotA = dot(pB.getAxis(_ii5), pA.getAxis(jj));
607
- dotAB[_ii5 * 3 + jj] = dotA;
608
-
554
+ dotA = dot(pB.getAxis(ii), pA.getAxis(jj));
555
+ dotAB[ii * 3 + jj] = dotA;
609
556
  if (dotA > 0) {
610
557
  rangeAmax += dotA;
611
558
  } else {
612
559
  rangeAmin += dotA;
613
560
  }
614
561
  }
615
-
616
562
  if (rangeAmax + eps < rangeBmin || rangeBmax + eps < rangeAmin) {
617
563
  return 2; // A and B are Disjoint by the 3rd test.
618
564
  }
619
- } // now check for a separation plane parallel to the faces of A
620
-
565
+ }
621
566
 
622
- for (var _ii6 = 0; _ii6 < 3; _ii6++) {
567
+ // now check for a separation plane parallel to the faces of A
568
+ for (let ii = 0; ii < 3; ii++) {
623
569
  // plane is normal to pA.getAxis(ii)
624
570
  // computing A range is easy...
625
- rangeAmin = dot(pA.getCorner(), pA.getAxis(_ii6));
571
+ rangeAmin = dot(pA.getCorner(), pA.getAxis(ii));
626
572
  rangeAmax = rangeAmin;
627
- rangeAmax += dot(pA.getAxis(_ii6), pA.getAxis(_ii6)); // compute B range...
573
+ rangeAmax += dot(pA.getAxis(ii), pA.getAxis(ii));
628
574
 
629
- rangeBmin = dot(pB.getCorner(), pA.getAxis(_ii6));
575
+ // compute B range...
576
+ rangeBmin = dot(pB.getCorner(), pA.getAxis(ii));
630
577
  rangeBmax = rangeBmin;
631
-
632
- for (var _jj = 0; _jj < 3; _jj++) {
578
+ for (let jj = 0; jj < 3; jj++) {
633
579
  // (note: we are using the 9 dotproducts computed earlier)
634
- dotB = dotAB[_jj * 3 + _ii6];
635
-
580
+ dotB = dotAB[jj * 3 + ii];
636
581
  if (dotB > 0) {
637
582
  rangeBmax += dotB;
638
583
  } else {
639
584
  rangeBmin += dotB;
640
585
  }
641
586
  }
642
-
643
587
  if (rangeAmax + eps < rangeBmin || rangeBmax + eps < rangeAmin) {
644
588
  return 3; // A and B are Disjoint by the 2nd test.
645
589
  }
646
- } // Bad luck: now we must look for a separation plane parallel
647
- // to one edge from A and one edge from B.
648
-
590
+ }
649
591
 
650
- for (var _ii7 = 0; _ii7 < 3; _ii7++) {
651
- for (var _jj2 = 0; _jj2 < 3; _jj2++) {
592
+ // Bad luck: now we must look for a separation plane parallel
593
+ // to one edge from A and one edge from B.
594
+ for (let ii = 0; ii < 3; ii++) {
595
+ for (let jj = 0; jj < 3; jj++) {
652
596
  // the plane is normal to pA.getAxis(ii) X pB.getAxis(jj)
653
- cross(pA.getAxis(_ii7), pB.getAxis(_jj2), AtoB);
597
+ cross(pA.getAxis(ii), pB.getAxis(jj), AtoB);
654
598
  rangeAmin = dot(pA.getCorner(), AtoB);
655
599
  rangeAmax = rangeAmin;
656
600
  rangeBmin = dot(pB.getCorner(), AtoB);
657
601
  rangeBmax = rangeBmin;
658
-
659
- for (var kk = 0; kk < 3; kk++) {
602
+ for (let kk = 0; kk < 3; kk++) {
660
603
  // compute A range
661
604
  dotA = dot(pA.getAxis(kk), AtoB);
662
-
663
605
  if (dotA > 0) {
664
606
  rangeAmax += dotA;
665
607
  } else {
666
608
  rangeAmin += dotA;
667
- } // compute B range
668
-
609
+ }
669
610
 
611
+ // compute B range
670
612
  dotB = dot(pB.getAxis(kk), AtoB);
671
-
672
613
  if (dotB > 0) {
673
614
  rangeBmax += dotB;
674
615
  } else {
675
616
  rangeBmin += dotB;
676
617
  }
677
618
  }
678
-
679
619
  if (rangeAmax + eps < rangeBmin || rangeBmax + eps < rangeAmin) {
680
620
  return 4; // A and B are Disjoint by the 4th test.
681
621
  }
682
622
  }
683
- } // if we fall through to here, the OBB's overlap
684
-
685
-
623
+ }
624
+ // if we fall through to here, the OBB's overlap
686
625
  return 0;
687
626
  };
627
+
688
628
  /**
689
629
  * Intersect this OBBTree with OBBTreeB (as transformed) and
690
630
  * call processing function for each intersecting leaf node pair.
@@ -696,34 +636,27 @@ function vtkOBBTree(publicAPI, model) {
696
636
  * @param {function|null|undefined} callback Compared function that takes in argument:
697
637
  * nodeA (vtkOBBNode), nodeB (vtkOBBNode), XForm (mat4), arg
698
638
  */
699
-
700
-
701
639
  publicAPI.intersectWithOBBTree = function (obbTreeB, XformBtoA) {
702
- var onIntersect = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
703
- return -1;
704
- };
705
- var maxDepth = model.level;
706
- var minDepth = obbTreeB.getLevel();
707
-
640
+ let onIntersect = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => -1;
641
+ let maxDepth = model.level;
642
+ let minDepth = obbTreeB.getLevel();
708
643
  if (minDepth > maxDepth) {
709
644
  minDepth = maxDepth;
710
645
  maxDepth = obbTreeB.getLevel();
711
646
  }
712
-
713
- var maxStackDepth = 3 * minDepth + 2 * (maxDepth - minDepth) + 1;
714
- var OBBStackA = new Array(maxStackDepth);
715
- var OBBStackB = new Array(maxStackDepth);
647
+ const maxStackDepth = 3 * minDepth + 2 * (maxDepth - minDepth) + 1;
648
+ const OBBStackA = new Array(maxStackDepth);
649
+ const OBBStackB = new Array(maxStackDepth);
716
650
  OBBStackA[0] = model.tree;
717
651
  OBBStackB[0] = obbTreeB.getTree();
718
- var depth = 1;
719
- var count = 0;
720
- var returnValue = 0; // simulate recursion without overhead of real recursion.
721
-
652
+ let depth = 1;
653
+ let count = 0;
654
+ let returnValue = 0;
655
+ // simulate recursion without overhead of real recursion.
722
656
  while (depth > 0 && returnValue > -1) {
723
657
  depth--;
724
- var nodeA = OBBStackA[depth];
725
- var nodeB = OBBStackB[depth];
726
-
658
+ const nodeA = OBBStackA[depth];
659
+ const nodeB = OBBStackB[depth];
727
660
  if (!publicAPI.disjointOBBNodes(nodeA, nodeB, XformBtoA)) {
728
661
  // Collision
729
662
  if (!nodeA.getKids()) {
@@ -759,21 +692,17 @@ function vtkOBBTree(publicAPI, model) {
759
692
  }
760
693
  }
761
694
  }
762
-
763
695
  return count;
764
696
  };
765
-
766
- publicAPI.triangleIntersectsNode = function (nodeA, p0, p1, p2, XformBtoA) {
767
- var eps = model.tolerance;
768
- var pA = nodeA;
769
- var pB = [_toConsumableArray(p0), _toConsumableArray(p1), _toConsumableArray(p2)];
770
-
697
+ publicAPI.triangleIntersectsNode = (nodeA, p0, p1, p2, XformBtoA) => {
698
+ const eps = model.tolerance;
699
+ const pA = nodeA;
700
+ const pB = [[...p0], [...p1], [...p2]];
771
701
  if (XformBtoA) {
772
702
  // Here we assume that XformBtoA is an orthogonal matrix
773
- var input = [0, 0, 0, 1];
774
- var output = [];
775
-
776
- for (var ii = 0; ii < 3; ii++) {
703
+ const input = [0, 0, 0, 1];
704
+ const output = [];
705
+ for (let ii = 0; ii < 3; ii++) {
777
706
  input[0] = pB[ii][0];
778
707
  input[1] = pB[ii][1];
779
708
  input[2] = pB[ii][2];
@@ -782,119 +711,105 @@ function vtkOBBTree(publicAPI, model) {
782
711
  pB[ii][1] = output[1] / output[3];
783
712
  pB[ii][2] = output[2] / output[3];
784
713
  }
785
- } // now check for a separation plane parallel to the triangle
786
-
787
-
788
- var v0 = [];
789
- var v1 = [];
714
+ }
790
715
 
791
- for (var _ii8 = 0; _ii8 < 3; _ii8++) {
716
+ // now check for a separation plane parallel to the triangle
717
+ const v0 = [];
718
+ const v1 = [];
719
+ for (let ii = 0; ii < 3; ii++) {
792
720
  // plane is normal to the triangle
793
- v0[_ii8] = pB[1][_ii8] - pB[0][_ii8];
794
- v1[_ii8] = pB[2][_ii8] - pB[0][_ii8];
721
+ v0[ii] = pB[1][ii] - pB[0][ii];
722
+ v1[ii] = pB[2][ii] - pB[0][ii];
795
723
  }
796
-
797
- var xprod = cross(v0, v1, []); // computing B range is easy...
798
-
799
- var rangeBmax = dot(pB[0], xprod);
800
- var rangeBmin = rangeBmax; // compute A range...
801
-
802
- var rangeAmax = dot(pA.getCorner(), xprod);
803
- var rangeAmin = rangeAmax;
804
- var dotA;
805
-
806
- for (var jj = 0; jj < 3; jj++) {
724
+ const xprod = cross(v0, v1, []);
725
+ // computing B range is easy...
726
+ let rangeBmax = dot(pB[0], xprod);
727
+ let rangeBmin = rangeBmax;
728
+ // compute A range...
729
+ let rangeAmax = dot(pA.getCorner(), xprod);
730
+ let rangeAmin = rangeAmax;
731
+ let dotA;
732
+ for (let jj = 0; jj < 3; jj++) {
807
733
  dotA = dot(xprod, pA.getAxis(jj));
808
-
809
734
  if (dotA > 0) {
810
735
  rangeAmax += dotA;
811
736
  } else {
812
737
  rangeAmin += dotA;
813
738
  }
814
739
  }
815
-
816
740
  if (rangeAmax + eps < rangeBmin || rangeBmax + eps < rangeAmin) {
817
741
  return 0; // A and B are Disjoint by the 1st test.
818
- } // now check for a separation plane parallel to the faces of A
819
-
742
+ }
820
743
 
821
- for (var _ii9 = 0; _ii9 < 3; _ii9++) {
744
+ // now check for a separation plane parallel to the faces of A
745
+ for (let ii = 0; ii < 3; ii++) {
822
746
  // plane is normal to pA->Axes[ii]
823
747
  // computing A range is easy...
824
- rangeAmax = dot(pA.getCorner(), pA.getAxis(_ii9));
748
+ rangeAmax = dot(pA.getCorner(), pA.getAxis(ii));
825
749
  rangeAmin = rangeAmax;
826
- rangeAmax += dot(pA.getAxis(_ii9), pA.getAxis(_ii9)); // compute B range...
750
+ rangeAmax += dot(pA.getAxis(ii), pA.getAxis(ii));
827
751
 
828
- rangeBmax = dot(pB[0], pA.getAxis(_ii9));
752
+ // compute B range...
753
+ rangeBmax = dot(pB[0], pA.getAxis(ii));
829
754
  rangeBmin = rangeBmax;
830
-
831
- var _dotB = dot(pB[1], pA.getAxis(_ii9));
832
-
833
- if (_dotB > rangeBmax) {
834
- rangeBmax = _dotB;
755
+ let dotB = dot(pB[1], pA.getAxis(ii));
756
+ if (dotB > rangeBmax) {
757
+ rangeBmax = dotB;
835
758
  } else {
836
- rangeBmin = _dotB;
759
+ rangeBmin = dotB;
837
760
  }
838
-
839
- _dotB = dot(pB[2], pA.getAxis(_ii9));
840
-
841
- if (_dotB > rangeBmax) {
842
- rangeBmax = _dotB;
843
- } else if (_dotB < rangeBmin) {
844
- rangeBmin = _dotB;
761
+ dotB = dot(pB[2], pA.getAxis(ii));
762
+ if (dotB > rangeBmax) {
763
+ rangeBmax = dotB;
764
+ } else if (dotB < rangeBmin) {
765
+ rangeBmin = dotB;
845
766
  }
846
-
847
767
  if (rangeAmax + eps < rangeBmin || rangeBmax + eps < rangeAmin) {
848
768
  return 0; // A and B are Disjoint by the 2nd test.
849
769
  }
850
- } // Bad luck: now we must look for a separation plane parallel
851
- // to one edge from A and one edge from B.
852
-
853
-
854
- var AtoB = [];
855
- var dotB;
770
+ }
856
771
 
857
- for (var _ii10 = 0; _ii10 < 3; _ii10++) {
858
- for (var _jj3 = 0; _jj3 < 3; _jj3++) {
772
+ // Bad luck: now we must look for a separation plane parallel
773
+ // to one edge from A and one edge from B.
774
+ const AtoB = [];
775
+ let dotB;
776
+ for (let ii = 0; ii < 3; ii++) {
777
+ for (let jj = 0; jj < 3; jj++) {
859
778
  // the plane is normal to pA->Axes[ii] X (pB[jj+1]-pB[jj])
860
- v0[0] = pB[(_jj3 + 1) % 3][0] - pB[_jj3][0];
861
- v0[1] = pB[(_jj3 + 1) % 3][1] - pB[_jj3][1];
862
- v0[2] = pB[(_jj3 + 1) % 3][2] - pB[_jj3][2];
863
- cross(pA.getAxis(_ii10), v0, AtoB);
779
+ v0[0] = pB[(jj + 1) % 3][0] - pB[jj][0];
780
+ v0[1] = pB[(jj + 1) % 3][1] - pB[jj][1];
781
+ v0[2] = pB[(jj + 1) % 3][2] - pB[jj][2];
782
+ cross(pA.getAxis(ii), v0, AtoB);
864
783
  rangeAmax = dot(pA.getCorner(), AtoB);
865
784
  rangeAmin = rangeAmax;
866
- rangeBmax = dot(pB[_jj3], AtoB);
785
+ rangeBmax = dot(pB[jj], AtoB);
867
786
  rangeBmin = rangeBmax;
868
-
869
- for (var kk = 0; kk < 3; kk++) {
787
+ for (let kk = 0; kk < 3; kk++) {
870
788
  // compute A range
871
789
  dotA = dot(pA.getAxis(kk), AtoB);
872
-
873
790
  if (dotA > 0) {
874
791
  rangeAmax += dotA;
875
792
  } else {
876
793
  rangeAmin += dotA;
877
794
  }
878
- } // compute B range
879
-
880
-
881
- dotB = dot(pB[(_jj3 + 2) % 3], AtoB);
882
-
795
+ }
796
+ // compute B range
797
+ dotB = dot(pB[(jj + 2) % 3], AtoB);
883
798
  if (dotB > rangeBmax) {
884
799
  rangeBmax = dotB;
885
800
  } else {
886
801
  rangeBmin = dotB;
887
802
  }
888
-
889
803
  if (rangeAmax + eps < rangeBmin || rangeBmax + eps < rangeAmin) {
890
804
  return 0; // A and B are Disjoint by the 3rd test.
891
805
  }
892
806
  }
893
- } // if we fall through to here, the OBB overlaps the triangle.
894
-
807
+ }
895
808
 
809
+ // if we fall through to here, the OBB overlaps the triangle.
896
810
  return 1;
897
811
  };
812
+
898
813
  /**
899
814
  *
900
815
  * @param {*} info must be an object with { obbTree1, intersectionLines }
@@ -903,9 +818,7 @@ function vtkOBBTree(publicAPI, model) {
903
818
  * @param {*} transform
904
819
  * @returns the number of intersection lines found
905
820
  */
906
-
907
-
908
- publicAPI.findTriangleIntersections = function (info, node0, node1, transform) {
821
+ publicAPI.findTriangleIntersections = (info, node0, node1, transform) => {
909
822
  // Set up local structures to hold Impl array information
910
823
  // vtkOBBTree* obbTree1 = info->OBBTree1;
911
824
  // vtkCellArray* intersectionLines = info->IntersectionLines;
@@ -914,61 +827,58 @@ function vtkOBBTree(publicAPI, model) {
914
827
  // vtkIdTypeArray* intersectionCellIds1 = info->CellIds[1];
915
828
  // vtkPointLocator* pointMerger = info->PointMerger;
916
829
  // double tolerance = info->Tolerance;
917
- var mesh0 = publicAPI.getDataset();
918
- var mesh1 = info.obbTree1.getDataset();
919
- var pointOffset = info.intersectionLines.getPoints().getNumberOfPoints();
920
- var intersectionPoints = [];
921
- var intersectionLines = []; // The number of cells in OBBTree
922
-
923
- var numCells0 = node0.getCells().length;
924
-
925
- for (var id0 = 0; id0 < numCells0; id0++) {
926
- var cellId0 = node0.getCells()[id0];
927
- var type0 = mesh0.getCellType(cellId0); // Make sure the cell is a triangle
928
-
830
+ const mesh0 = publicAPI.getDataset();
831
+ const mesh1 = info.obbTree1.getDataset();
832
+ const pointOffset = info.intersectionLines.getPoints().getNumberOfPoints();
833
+ const intersectionPoints = [];
834
+ const intersectionLines = [];
835
+
836
+ // The number of cells in OBBTree
837
+ const numCells0 = node0.getCells().length;
838
+ for (let id0 = 0; id0 < numCells0; id0++) {
839
+ const cellId0 = node0.getCells()[id0];
840
+ const type0 = mesh0.getCellType(cellId0);
841
+
842
+ // Make sure the cell is a triangle
929
843
  if (type0 === CellType.VTK_TRIANGLE) {
930
- var _mesh0$getCellPoints = mesh0.getCellPoints(cellId0),
931
- triPtIds0 = _mesh0$getCellPoints.cellPointIds;
932
-
933
- var triPts0 = [[], [], []];
934
-
935
- for (var id = 0; id < triPtIds0.length; id++) {
844
+ const {
845
+ cellPointIds: triPtIds0
846
+ } = mesh0.getCellPoints(cellId0);
847
+ const triPts0 = [[], [], []];
848
+ for (let id = 0; id < triPtIds0.length; id++) {
936
849
  mesh0.getPoints().getPoint(triPtIds0[id], triPts0[id]);
937
850
  }
938
-
939
851
  if (info.obbTree1.triangleIntersectsNode(node1, triPts0[0], triPts0[1], triPts0[2], transform)) {
940
- var numCells1 = node1.getCells().length;
941
-
942
- for (var id1 = 0; id1 < numCells1; id1++) {
943
- var cellId1 = node1.getCells()[id1];
944
- var type1 = mesh1.getCellType(cellId1);
945
-
852
+ const numCells1 = node1.getCells().length;
853
+ for (let id1 = 0; id1 < numCells1; id1++) {
854
+ const cellId1 = node1.getCells()[id1];
855
+ const type1 = mesh1.getCellType(cellId1);
946
856
  if (type1 === CellType.VTK_TRIANGLE) {
947
857
  // See if the two cells actually intersect. If they do,
948
858
  // add an entry into the intersection maps and add an
949
859
  // intersection line.
950
- var _mesh1$getCellPoints = mesh1.getCellPoints(cellId1),
951
- triPtIds1 = _mesh1$getCellPoints.cellPointIds;
952
-
953
- var triPts1 = [[], [], []];
954
-
955
- for (var _id = 0; _id < triPtIds1.length; _id++) {
956
- mesh1.getPoints().getPoint(triPtIds1[_id], triPts1[_id]);
860
+ const {
861
+ cellPointIds: triPtIds1
862
+ } = mesh1.getCellPoints(cellId1);
863
+ const triPts1 = [[], [], []];
864
+ for (let id = 0; id < triPtIds1.length; id++) {
865
+ mesh1.getPoints().getPoint(triPtIds1[id], triPts1[id]);
957
866
  }
958
-
959
- var _vtkTriangle$intersec = vtkTriangle.intersectWithTriangle.apply(vtkTriangle, triPts0.concat(triPts1, [model.tolerance])),
960
- intersect = _vtkTriangle$intersec.intersect,
961
- coplanar = _vtkTriangle$intersec.coplanar,
962
- outpt0 = _vtkTriangle$intersec.pt1,
963
- outpt1 = _vtkTriangle$intersec.pt2;
964
-
867
+ const {
868
+ intersect,
869
+ coplanar,
870
+ pt1: outpt0,
871
+ pt2: outpt1
872
+ // surfaceId,
873
+ } = vtkTriangle.intersectWithTriangle(...triPts0, ...triPts1, model.tolerance);
965
874
  if (intersect && !coplanar) {
966
- var pointId = intersectionPoints.length / 3;
967
- intersectionPoints.push.apply(intersectionPoints, _toConsumableArray(outpt0).concat(_toConsumableArray(outpt1)));
875
+ const pointId = intersectionPoints.length / 3;
876
+ intersectionPoints.push(...outpt0, ...outpt1);
968
877
  intersectionLines.push(2, pointOffset + pointId, pointOffset + pointId + 1);
969
- } // If actual intersection, add point and cell to edge, line,
970
- // and surface maps!
878
+ }
971
879
 
880
+ // If actual intersection, add point and cell to edge, line,
881
+ // and surface maps!
972
882
  /*
973
883
  if (coplanar) {
974
884
  // Coplanar triangle intersection is not handled.
@@ -1125,7 +1035,6 @@ function vtkOBBTree(publicAPI, model) {
1125
1035
  }
1126
1036
  }
1127
1037
  */
1128
-
1129
1038
  }
1130
1039
  }
1131
1040
  }
@@ -1133,16 +1042,16 @@ function vtkOBBTree(publicAPI, model) {
1133
1042
  }
1134
1043
 
1135
1044
  if (intersectionPoints.length) {
1136
- var points = vtkPoints.newInstance();
1045
+ const points = vtkPoints.newInstance();
1137
1046
  points.setData(pushArray(info.intersectionLines.getPoints().getData(), intersectionPoints));
1138
1047
  info.intersectionLines.setPoints(points);
1139
- var lines = vtkCellArray.newInstance();
1048
+ const lines = vtkCellArray.newInstance();
1140
1049
  lines.setData(pushArray(info.intersectionLines.getLines().getData(), intersectionLines));
1141
1050
  info.intersectionLines.setLines(lines);
1142
1051
  }
1143
-
1144
1052
  return intersectionLines.length / 3;
1145
1053
  };
1054
+
1146
1055
  /**
1147
1056
  * Create polygonal representation for OBB tree at specified level. If
1148
1057
  * level < 0, then the leaf OBB nodes will be gathered. The aspect ratio (ar)
@@ -1154,50 +1063,39 @@ function vtkOBBTree(publicAPI, model) {
1154
1063
  * @param {Number} level Level of the representation
1155
1064
  * @returns {vtkPolyData}
1156
1065
  */
1157
-
1158
-
1159
- publicAPI.generateRepresentation = function (level) {
1066
+ publicAPI.generateRepresentation = level => {
1160
1067
  if (!model.tree) {
1161
1068
  vtkErrorMacro('No tree to generate representation for');
1162
1069
  return null;
1163
1070
  }
1164
-
1165
- var points = vtkPoints.newInstance();
1166
- var polys = vtkCellArray.newInstance();
1071
+ const points = vtkPoints.newInstance();
1072
+ const polys = vtkCellArray.newInstance();
1167
1073
  generatePolygons(model.tree, 0, level, points, polys);
1168
- var output = vtkPolyData.newInstance();
1074
+ const output = vtkPolyData.newInstance();
1169
1075
  output.setPoints(points);
1170
1076
  output.setPolys(polys);
1171
1077
  return output;
1172
1078
  };
1173
-
1174
- publicAPI.buildLocator = function () {
1079
+ publicAPI.buildLocator = () => {
1175
1080
  if (model.dataset === null) {
1176
1081
  vtkErrorMacro("Can't build OBB tree - no data available!");
1177
1082
  return;
1178
1083
  }
1179
-
1180
- var numPts = model.dataset.getPoints().getNumberOfPoints();
1181
- var numCells = model.dataset.getNumberOfCells();
1182
-
1084
+ const numPts = model.dataset.getPoints().getNumberOfPoints();
1085
+ const numCells = model.dataset.getNumberOfCells();
1183
1086
  if (numPts < 1 || numCells < 1) {
1184
1087
  vtkErrorMacro("Can't build OBB tree - no data available!");
1185
1088
  return;
1186
1089
  }
1187
-
1188
- model.OBBCount = 0; // Initialize an array of numPts elements set to value 0
1189
-
1090
+ model.OBBCount = 0;
1091
+ // Initialize an array of numPts elements set to value 0
1190
1092
  model.insertedPoints = Array.from({
1191
1093
  length: numPts
1192
- }, function (_) {
1193
- return 0;
1194
- });
1094
+ }, _ => 0);
1195
1095
  model.pointsList = [];
1196
- var cellList = Array.from({
1096
+ const cellList = Array.from({
1197
1097
  length: numCells
1198
- }, function (_, i) {
1199
- return i;
1200
- });
1098
+ }, (_, i) => i);
1201
1099
  model.tree = vtkOBBNode.newInstance();
1202
1100
  model.level = 0;
1203
1101
  buildTree(cellList, model.tree, 0);
@@ -1205,10 +1103,11 @@ function vtkOBBTree(publicAPI, model) {
1205
1103
  model.pointsList = [];
1206
1104
  publicAPI.modified();
1207
1105
  };
1208
- } // ----------------------------------------------------------------------------
1106
+ }
1209
1107
 
1108
+ // ----------------------------------------------------------------------------
1210
1109
 
1211
- var DEFAULT_VALUES = {
1110
+ const DEFAULT_VALUES = {
1212
1111
  tolerance: 0.01,
1213
1112
  automatic: true,
1214
1113
  numberOfCellsPerNode: 32,
@@ -1220,24 +1119,33 @@ var DEFAULT_VALUES = {
1220
1119
  level: 8,
1221
1120
  maxLevel: 8,
1222
1121
  retainCellLists: 1
1223
- }; // ----------------------------------------------------------------------------
1122
+ };
1123
+
1124
+ // ----------------------------------------------------------------------------
1224
1125
 
1225
1126
  function extend(publicAPI, model) {
1226
- var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1227
- Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
1127
+ let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1128
+ Object.assign(model, DEFAULT_VALUES, initialValues);
1228
1129
 
1229
- macro.setGet(publicAPI, model, ['tolerance', 'automatic', 'numberOfCellsPerNode', 'dataset', 'tree', 'maxLevel', 'level', 'retainCellLists']); // Make this a VTK object
1130
+ // Build VTK API
1131
+ macro.setGet(publicAPI, model, ['tolerance', 'automatic', 'numberOfCellsPerNode', 'dataset', 'tree', 'maxLevel', 'level', 'retainCellLists']);
1230
1132
 
1231
- macro.obj(publicAPI, model); // Object specific methods
1133
+ // Make this a VTK object
1134
+ macro.obj(publicAPI, model);
1232
1135
 
1136
+ // Object specific methods
1233
1137
  vtkOBBTree(publicAPI, model);
1234
- } // ----------------------------------------------------------------------------
1138
+ }
1139
+
1140
+ // ----------------------------------------------------------------------------
1141
+
1142
+ const newInstance = macro.newInstance(extend, 'vtkOBBTree');
1235
1143
 
1236
- var newInstance = macro.newInstance(extend, 'vtkOBBTree'); // ----------------------------------------------------------------------------
1144
+ // ----------------------------------------------------------------------------
1237
1145
 
1238
1146
  var vtkOBBTree$1 = {
1239
- newInstance: newInstance,
1240
- extend: extend
1147
+ newInstance,
1148
+ extend
1241
1149
  };
1242
1150
 
1243
1151
  export { vtkOBBTree$1 as default, extend, newInstance };