@kitware/vtk.js 28.10.2 → 28.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/Core/Base64.js +53 -82
- package/Common/Core/CellArray.js +52 -60
- package/Common/Core/ClassHierarchy.js +8 -36
- package/Common/Core/DataArray/Constants.js +6 -6
- package/Common/Core/DataArray.js +193 -277
- package/Common/Core/Endian.js +14 -17
- package/Common/Core/HalfFloat.js +17 -34
- package/Common/Core/ImageHelper.js +17 -25
- package/Common/Core/LookupTable.js +131 -144
- package/Common/Core/Math/Constants.js +8 -8
- package/Common/Core/Math/index.js +754 -942
- package/Common/Core/Math.js +2 -4
- package/Common/Core/MatrixBuilder.js +99 -151
- package/Common/Core/Points.js +43 -43
- package/Common/Core/PriorityQueue.js +30 -28
- package/Common/Core/ProgressHandler.js +31 -32
- package/Common/Core/ScalarsToColors/Constants.js +4 -4
- package/Common/Core/ScalarsToColors.js +196 -253
- package/Common/Core/StringArray.js +48 -73
- package/Common/Core/URLExtract.js +10 -29
- package/Common/Core/VariantArray.js +48 -73
- package/Common/Core.js +11 -11
- package/Common/DataModel/AbstractPointLocator.js +19 -17
- package/Common/DataModel/BoundingBox.js +322 -490
- package/Common/DataModel/Box.js +46 -63
- package/Common/DataModel/CardinalSpline1D.js +92 -102
- package/Common/DataModel/Cell.js +41 -61
- package/Common/DataModel/CellLinks.js +91 -127
- package/Common/DataModel/CellTypes/Constants.js +7 -6
- package/Common/DataModel/CellTypes.js +55 -74
- package/Common/DataModel/Collection.js +45 -61
- package/Common/DataModel/Cone.js +28 -20
- package/Common/DataModel/Cylinder.js +41 -35
- package/Common/DataModel/DataSet/Constants.js +11 -5
- package/Common/DataModel/DataSet.js +37 -25
- package/Common/DataModel/DataSetAttributes/Constants.js +18 -18
- package/Common/DataModel/DataSetAttributes/FieldData.js +103 -194
- package/Common/DataModel/DataSetAttributes.js +96 -138
- package/Common/DataModel/EdgeLocator.js +45 -70
- package/Common/DataModel/ITKHelper.js +67 -137
- package/Common/DataModel/ImageData.js +115 -172
- package/Common/DataModel/ImplicitBoolean/Constants.js +2 -2
- package/Common/DataModel/ImplicitBoolean.js +66 -96
- package/Common/DataModel/IncrementalOctreeNode.js +201 -231
- package/Common/DataModel/IncrementalOctreePointLocator.js +160 -198
- package/Common/DataModel/KochanekSpline1D.js +78 -81
- package/Common/DataModel/Line/Constants.js +2 -2
- package/Common/DataModel/Line.js +82 -105
- package/Common/DataModel/Locator.js +17 -10
- package/Common/DataModel/Molecule.js +26 -17
- package/Common/DataModel/PiecewiseFunction.js +218 -239
- package/Common/DataModel/Plane.js +90 -113
- package/Common/DataModel/PointSet.js +30 -26
- package/Common/DataModel/PolyData/Constants.js +2 -2
- package/Common/DataModel/PolyData.js +95 -120
- package/Common/DataModel/PolyLine.js +44 -61
- package/Common/DataModel/Polygon/Constants.js +4 -4
- package/Common/DataModel/Polygon.js +128 -169
- package/Common/DataModel/Quad/Constants.js +2 -2
- package/Common/DataModel/Quad.js +61 -100
- package/Common/DataModel/SelectionNode/Constants.js +5 -4
- package/Common/DataModel/SelectionNode.js +25 -21
- package/Common/DataModel/Sphere.js +40 -35
- package/Common/DataModel/Spline1D/Constants.js +3 -2
- package/Common/DataModel/Spline1D.js +34 -18
- package/Common/DataModel/Spline3D/Constants.js +2 -2
- package/Common/DataModel/Spline3D.js +46 -41
- package/Common/DataModel/StructuredData/Constants.js +2 -2
- package/Common/DataModel/StructuredData.js +9 -20
- package/Common/DataModel/Triangle.js +207 -250
- package/Common/DataModel.js +19 -19
- package/Common/System/MobileVR.js +56 -61
- package/Common/System/TimerLog.js +1 -1
- package/Common/System.js +2 -2
- package/Common/Transform/LandmarkTransform/Constants.js +2 -2
- package/Common/Transform/LandmarkTransform.js +133 -117
- package/Common/Transform/Transform.js +42 -57
- package/Common/Transform.js +2 -2
- package/Common/index.js +4 -4
- package/Filters/Core/Cutter.js +134 -146
- package/Filters/Core/PolyDataNormals.js +44 -50
- package/Filters/Core.js +2 -2
- package/Filters/Cornerstone/ImageDataToCornerstoneImage.js +45 -33
- package/Filters/Cornerstone.js +1 -1
- package/Filters/General/AppendPolyData.js +84 -100
- package/Filters/General/Calculator.js +95 -163
- package/Filters/General/ClipClosedSurface/Constants.js +2 -2
- package/Filters/General/ClipClosedSurface.js +341 -416
- package/Filters/General/ClosedPolyLineToSurfaceFilter.js +141 -156
- package/Filters/General/ContourTriangulator/Constants.js +2 -2
- package/Filters/General/ContourTriangulator/helper.js +684 -812
- package/Filters/General/ContourTriangulator.js +92 -89
- package/Filters/General/ImageCropFilter.js +77 -78
- package/Filters/General/ImageDataOutlineFilter.js +42 -36
- package/Filters/General/ImageMarchingCubes/caseTable.js +9 -521
- package/Filters/General/ImageMarchingCubes.js +99 -112
- package/Filters/General/ImageMarchingSquares/caseTable.js +9 -41
- package/Filters/General/ImageMarchingSquares.js +93 -118
- package/Filters/General/ImageOutlineFilter.js +53 -54
- package/Filters/General/ImageSliceFilter.js +39 -30
- package/Filters/General/ImageStreamline.js +107 -124
- package/Filters/General/LineFilter.js +26 -15
- package/Filters/General/MoleculeToRepresentation.js +136 -149
- package/Filters/General/OBBTree/OBBNode.js +36 -34
- package/Filters/General/OBBTree/helper.js +19 -24
- package/Filters/General/OBBTree.js +396 -488
- package/Filters/General/OutlineFilter.js +52 -34
- package/Filters/General/PaintFilter/PaintFilter.worker.js +93 -130
- package/Filters/General/PaintFilter.js +150 -162
- package/Filters/General/ScalarToRGBA.js +38 -33
- package/Filters/General/TriangleFilter.js +65 -62
- package/Filters/General/TubeFilter/Constants.js +4 -4
- package/Filters/General/TubeFilter.js +376 -496
- package/Filters/General/WarpScalar.js +58 -60
- package/Filters/General/WindowedSincPolyDataFilter.js +258 -330
- package/Filters/General.js +21 -21
- package/Filters/Sources/Arrow2DSource/Constants.js +2 -2
- package/Filters/Sources/Arrow2DSource.js +56 -56
- package/Filters/Sources/ArrowSource.js +39 -29
- package/Filters/Sources/CircleSource.js +43 -43
- package/Filters/Sources/ConcentricCylinderSource.js +151 -174
- package/Filters/Sources/ConeSource.js +51 -42
- package/Filters/Sources/CubeSource.js +75 -96
- package/Filters/Sources/Cursor3D.js +94 -109
- package/Filters/Sources/CylinderSource.js +90 -90
- package/Filters/Sources/ImageGridSource.js +43 -43
- package/Filters/Sources/LineSource.js +49 -39
- package/Filters/Sources/PlaneSource.js +97 -104
- package/Filters/Sources/PointSource.js +46 -37
- package/Filters/Sources/RTAnalyticSource.js +50 -48
- package/Filters/Sources/SLICSource.js +63 -73
- package/Filters/Sources/SphereSource.js +88 -78
- package/Filters/Sources/ViewFinderSource.js +26 -23
- package/Filters/Sources.js +14 -14
- package/Filters/Texture/TextureMapToPlane.js +95 -97
- package/Filters/Texture/TextureMapToSphere.js +46 -54
- package/Filters/Texture.js +2 -2
- package/Filters/index.js +5 -5
- package/IO/Core/BinaryHelper.js +12 -18
- package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +43 -59
- package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +76 -113
- package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +62 -112
- package/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.js +76 -113
- package/IO/Core/DataAccessHelper.js +6 -6
- package/IO/Core/HttpDataSetReader.js +136 -139
- package/IO/Core/HttpDataSetSeriesReader.js +64 -75
- package/IO/Core/HttpSceneLoader.js +130 -179
- package/IO/Core/ImageStream/DefaultProtocol.js +29 -43
- package/IO/Core/ImageStream/ViewStream.js +100 -103
- package/IO/Core/ImageStream.js +62 -54
- package/IO/Core/ResourceLoader.js +10 -9
- package/IO/Core/Serializer/ArraySerializer.js +40 -40
- package/IO/Core/Serializer/FieldDataSerializer.js +18 -28
- package/IO/Core/Serializer/ImageDataSerializer.js +22 -23
- package/IO/Core/Serializer/PolyDataSerializer.js +17 -21
- package/IO/Core/Serializer.js +6 -13
- package/IO/Core/WSLinkClient.js +90 -76
- package/IO/Core/ZipMultiDataSetReader.js +46 -44
- package/IO/Core/ZipMultiDataSetWriter.js +43 -34
- package/IO/Core.js +7 -7
- package/IO/Geometry/DracoReader.js +118 -121
- package/IO/Geometry/PLYReader.js +163 -223
- package/IO/Geometry/PLYWriter/Constants.js +5 -5
- package/IO/Geometry/PLYWriter.js +139 -154
- package/IO/Geometry/STLReader.js +123 -146
- package/IO/Geometry/STLWriter/Constants.js +2 -2
- package/IO/Geometry/STLWriter.js +83 -82
- package/IO/Geometry.js +5 -5
- package/IO/Legacy/LegacyAsciiParser.js +78 -139
- package/IO/Legacy/PolyDataReader.js +48 -36
- package/IO/Legacy.js +2 -2
- package/IO/Misc/ElevationReader.js +67 -60
- package/IO/Misc/HttpDataSetLODsLoader.js +41 -38
- package/IO/Misc/ITKImageReader.js +58 -45
- package/IO/Misc/ITKPolyDataReader.js +50 -38
- package/IO/Misc/JSONNucleoReader.js +49 -42
- package/IO/Misc/JSONReader.js +38 -33
- package/IO/Misc/MTLReader.js +74 -119
- package/IO/Misc/OBJReader.js +153 -206
- package/IO/Misc/PDBReader.js +70 -68
- package/IO/Misc/SkyboxReader.js +77 -82
- package/IO/Misc.js +9 -9
- package/IO/XML/XMLImageDataReader.js +36 -38
- package/IO/XML/XMLImageDataWriter.js +28 -21
- package/IO/XML/XMLPolyDataReader.js +49 -46
- package/IO/XML/XMLPolyDataWriter.js +43 -42
- package/IO/XML/XMLReader.js +262 -304
- package/IO/XML/XMLWriter/Constants.js +3 -3
- package/IO/XML/XMLWriter.js +70 -84
- package/IO/XML.js +6 -6
- package/IO/index.js +5 -5
- package/Imaging/Core/AbstractImageInterpolator/Constants.js +4 -4
- package/Imaging/Core/AbstractImageInterpolator/InterpolationInfo.js +30 -27
- package/Imaging/Core/AbstractImageInterpolator.js +74 -87
- package/Imaging/Core/ImageInterpolator.js +201 -252
- package/Imaging/Core/ImagePointDataIterator.js +96 -122
- package/Imaging/Core/ImageReslice/Constants.js +2 -2
- package/Imaging/Core/ImageReslice.js +327 -464
- package/Imaging/Core.js +4 -4
- package/Imaging/Hybrid/SampleFunction.js +58 -51
- package/Imaging/Hybrid.js +1 -1
- package/Imaging/index.js +2 -2
- package/Interaction/Animations/TimeStepBasedAnimationHandler.js +39 -54
- package/Interaction/Manipulators/CompositeCameraManipulator.js +22 -13
- package/Interaction/Manipulators/CompositeGestureManipulator.js +31 -43
- package/Interaction/Manipulators/CompositeKeyboardManipulator.js +15 -11
- package/Interaction/Manipulators/CompositeMouseManipulator.js +27 -33
- package/Interaction/Manipulators/CompositeVRManipulator.js +22 -15
- package/Interaction/Manipulators/GestureCameraManipulator.js +54 -36
- package/Interaction/Manipulators/KeyboardCameraManipulator.js +95 -97
- package/Interaction/Manipulators/MouseBoxSelectorManipulator.js +70 -89
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +67 -54
- package/Interaction/Manipulators/MouseCameraSliceManipulator.js +40 -38
- package/Interaction/Manipulators/MouseCameraTrackballFirstPersonManipulator.js +83 -68
- package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.js +32 -28
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +47 -40
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +55 -43
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +56 -46
- package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.js +41 -46
- package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.js +29 -27
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +123 -146
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +144 -166
- package/Interaction/Manipulators/MouseRangeManipulator.js +127 -132
- package/Interaction/Manipulators/VRButtonPanManipulator.js +33 -23
- package/Interaction/Manipulators.js +21 -21
- package/Interaction/Misc/DeviceOrientationToCamera.js +25 -47
- package/Interaction/Misc.js +1 -1
- package/Interaction/Style/InteractorStyleImage.js +101 -121
- package/Interaction/Style/InteractorStyleMPRSlice.js +111 -128
- package/Interaction/Style/InteractorStyleManipulator/Presets.js +9 -17
- package/Interaction/Style/InteractorStyleManipulator.js +254 -329
- package/Interaction/Style/InteractorStyleRemoteMouse.js +195 -180
- package/Interaction/Style/InteractorStyleTrackballCamera.js +154 -157
- package/Interaction/Style/InteractorStyleUnicam.js +30 -38
- package/Interaction/Style.js +5 -5
- package/Interaction/UI/CornerAnnotation/CornerAnnotation.module.css.js +1 -1
- package/Interaction/UI/CornerAnnotation.js +65 -48
- package/Interaction/UI/FPSMonitor.js +104 -105
- package/Interaction/UI/Icons.js +1 -1
- package/Interaction/UI/Slider/Constants.js +2 -2
- package/Interaction/UI/Slider.js +78 -95
- package/Interaction/UI/VolumeController.js +104 -97
- package/Interaction/UI.js +5 -5
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.js +2 -2
- package/Interaction/Widgets/OrientationMarkerWidget.js +90 -135
- package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +0 -3
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +381 -498
- package/Interaction/Widgets.js +2 -2
- package/Interaction/index.js +5 -5
- package/Proxy/Animation/AbstractAnimationProxy.js +22 -15
- package/Proxy/Animation/AnimationProxyManager.js +43 -51
- package/Proxy/Animation/TimeStepBasedAnimationHandlerProxy.js +26 -19
- package/Proxy/Core/AbstractRepresentationProxy.js +97 -151
- package/Proxy/Core/LookupTableProxy/Constants.js +4 -4
- package/Proxy/Core/LookupTableProxy.js +49 -52
- package/Proxy/Core/PiecewiseFunctionProxy/Constants.js +4 -4
- package/Proxy/Core/PiecewiseFunctionProxy.js +63 -72
- package/Proxy/Core/ProxyManager/core.js +83 -106
- package/Proxy/Core/ProxyManager/properties.js +53 -76
- package/Proxy/Core/ProxyManager/state.js +100 -110
- package/Proxy/Core/ProxyManager/view.js +45 -55
- package/Proxy/Core/ProxyManager.js +16 -8
- package/Proxy/Core/SourceProxy.js +41 -38
- package/Proxy/Core/View2DProxy.js +143 -199
- package/Proxy/Core/ViewProxy.js +223 -269
- package/Proxy/Core.js +7 -7
- package/Proxy/Representations/GeometryRepresentationProxy.js +34 -20
- package/Proxy/Representations/GlyphRepresentationProxy.js +42 -41
- package/Proxy/Representations/MoleculeRepresentationProxy.js +32 -22
- package/Proxy/Representations/ResliceRepresentationProxy.js +48 -32
- package/Proxy/Representations/SkyboxRepresentationProxy.js +30 -29
- package/Proxy/Representations/SliceRepresentationProxy.js +93 -112
- package/Proxy/Representations/SlicedGeometryRepresentationProxy.js +46 -42
- package/Proxy/Representations/VolumeRepresentationProxy.js +108 -133
- package/Proxy/Representations.js +7 -7
- package/Proxy/index.js +2 -2
- package/README.md +1 -1
- package/Rendering/Core/AbstractImageMapper/helper.js +44 -49
- package/Rendering/Core/AbstractImageMapper.js +18 -19
- package/Rendering/Core/AbstractMapper.js +39 -55
- package/Rendering/Core/AbstractMapper3D.js +26 -31
- package/Rendering/Core/AbstractPicker.js +25 -21
- package/Rendering/Core/Actor.js +71 -93
- package/Rendering/Core/Actor2D.js +64 -78
- package/Rendering/Core/AnnotatedCubeActor/Presets.js +5 -11
- package/Rendering/Core/AnnotatedCubeActor.js +94 -79
- package/Rendering/Core/AxesActor.js +65 -87
- package/Rendering/Core/Camera.js +246 -271
- package/Rendering/Core/CellPicker.js +125 -148
- package/Rendering/Core/ColorTransferFunction/ColorMaps.js +20 -21
- package/Rendering/Core/ColorTransferFunction/ColorMapsLite.js +20 -21
- package/Rendering/Core/ColorTransferFunction/Constants.js +4 -4
- package/Rendering/Core/ColorTransferFunction.js +460 -546
- package/Rendering/Core/Coordinate/Constants.js +2 -2
- package/Rendering/Core/Coordinate.js +119 -198
- package/Rendering/Core/CubeAxesActor.js +294 -320
- package/Rendering/Core/Follower.js +46 -45
- package/Rendering/Core/Glyph3DMapper/Constants.js +4 -4
- package/Rendering/Core/Glyph3DMapper.js +96 -148
- package/Rendering/Core/HardwareSelector.js +36 -69
- package/Rendering/Core/ImageArrayMapper.js +87 -126
- package/Rendering/Core/ImageCPRMapper.js +134 -209
- package/Rendering/Core/ImageMapper/Constants.js +2 -2
- package/Rendering/Core/ImageMapper.js +85 -144
- package/Rendering/Core/ImageProperty/Constants.js +2 -2
- package/Rendering/Core/ImageProperty.js +66 -81
- package/Rendering/Core/ImageResliceMapper/Constants.js +2 -2
- package/Rendering/Core/ImageResliceMapper.js +36 -29
- package/Rendering/Core/ImageSlice.js +85 -127
- package/Rendering/Core/InteractorObserver.js +82 -73
- package/Rendering/Core/InteractorStyle/Constants.js +2 -2
- package/Rendering/Core/InteractorStyle.js +56 -58
- package/Rendering/Core/Light.js +43 -49
- package/Rendering/Core/Mapper/CoincidentTopologyHelper.js +37 -48
- package/Rendering/Core/Mapper/Constants.js +6 -6
- package/Rendering/Core/Mapper/Static.js +15 -12
- package/Rendering/Core/Mapper.js +194 -259
- package/Rendering/Core/Mapper2D.js +61 -100
- package/Rendering/Core/Picker.js +124 -143
- package/Rendering/Core/PixelSpaceCallbackMapper.js +40 -37
- package/Rendering/Core/PointPicker.js +68 -79
- package/Rendering/Core/Prop/Constants.js +2 -2
- package/Rendering/Core/Prop.js +58 -106
- package/Rendering/Core/Prop3D.js +54 -83
- package/Rendering/Core/Property/Constants.js +6 -6
- package/Rendering/Core/Property.js +45 -74
- package/Rendering/Core/Property2D/Constants.js +2 -2
- package/Rendering/Core/Property2D.js +33 -42
- package/Rendering/Core/RenderWindow.js +70 -82
- package/Rendering/Core/RenderWindowInteractor/Constants.js +7 -7
- package/Rendering/Core/RenderWindowInteractor.js +324 -439
- package/Rendering/Core/Renderer.js +192 -256
- package/Rendering/Core/ScalarBarActor.js +267 -272
- package/Rendering/Core/Skybox.js +26 -24
- package/Rendering/Core/SphereMapper.js +22 -12
- package/Rendering/Core/StickMapper.js +22 -12
- package/Rendering/Core/SurfaceLICInterface/Constants.js +6 -6
- package/Rendering/Core/SurfaceLICInterface.js +13 -9
- package/Rendering/Core/SurfaceLICMapper.js +23 -15
- package/Rendering/Core/Texture.js +99 -141
- package/Rendering/Core/Viewport.js +60 -88
- package/Rendering/Core/Volume.js +55 -77
- package/Rendering/Core/VolumeMapper/Constants.js +4 -4
- package/Rendering/Core/VolumeMapper.js +59 -91
- package/Rendering/Core/VolumeProperty/Constants.js +4 -4
- package/Rendering/Core/VolumeProperty.js +78 -115
- package/Rendering/Core.js +47 -49
- package/Rendering/Misc/CanvasView.js +62 -61
- package/Rendering/Misc/FullScreenRenderWindow.js +60 -62
- package/Rendering/Misc/GenericRenderWindow.js +48 -37
- package/Rendering/Misc/RemoteView.js +86 -80
- package/Rendering/Misc/RenderWindowWithControlBar.js +54 -48
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +43 -51
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +52 -82
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +258 -308
- package/Rendering/Misc/SynchronizableRenderWindow.js +133 -163
- package/Rendering/Misc/TextureLODsDownloader.js +72 -74
- package/Rendering/Misc.js +7 -7
- package/Rendering/OpenGL/Actor.js +57 -68
- package/Rendering/OpenGL/Actor2D.js +56 -56
- package/Rendering/OpenGL/BufferObject/Constants.js +2 -2
- package/Rendering/OpenGL/BufferObject.js +50 -65
- package/Rendering/OpenGL/Camera.js +35 -29
- package/Rendering/OpenGL/CellArrayBufferObject.js +119 -149
- package/Rendering/OpenGL/Convolution2DPass.js +87 -81
- package/Rendering/OpenGL/CubeAxesActor.js +28 -21
- package/Rendering/OpenGL/ForwardPass.js +53 -64
- package/Rendering/OpenGL/Framebuffer.js +61 -101
- package/Rendering/OpenGL/Glyph3DMapper.js +165 -196
- package/Rendering/OpenGL/HardwareSelector/Constants.js +2 -2
- package/Rendering/OpenGL/HardwareSelector.js +272 -397
- package/Rendering/OpenGL/Helper.js +58 -73
- package/Rendering/OpenGL/ImageCPRMapper.js +339 -421
- package/Rendering/OpenGL/ImageMapper.js +268 -361
- package/Rendering/OpenGL/ImageResliceMapper.js +306 -438
- package/Rendering/OpenGL/ImageSlice.js +48 -54
- package/Rendering/OpenGL/OrderIndependentTranslucentPass.js +102 -84
- package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +43 -42
- package/Rendering/OpenGL/PolyDataMapper.js +358 -492
- package/Rendering/OpenGL/PolyDataMapper2D.js +153 -205
- package/Rendering/OpenGL/RadialDistortionPass.js +86 -89
- package/Rendering/OpenGL/RenderWindow/Constants.js +2 -2
- package/Rendering/OpenGL/RenderWindow/ContextProxy.js +20 -29
- package/Rendering/OpenGL/RenderWindow.js +356 -510
- package/Rendering/OpenGL/Renderer.js +77 -89
- package/Rendering/OpenGL/ReplacementShaderMapper.js +28 -46
- package/Rendering/OpenGL/ScalarBarActor.js +28 -21
- package/Rendering/OpenGL/Shader.js +37 -31
- package/Rendering/OpenGL/ShaderCache.js +67 -74
- package/Rendering/OpenGL/ShaderProgram.js +136 -248
- package/Rendering/OpenGL/Skybox.js +99 -60
- package/Rendering/OpenGL/SphereMapper.js +94 -108
- package/Rendering/OpenGL/StickMapper.js +110 -114
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +91 -157
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +142 -151
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +142 -216
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +79 -100
- package/Rendering/OpenGL/SurfaceLIC.js +2 -2
- package/Rendering/OpenGL/Texture/Constants.js +4 -4
- package/Rendering/OpenGL/Texture.js +443 -608
- package/Rendering/OpenGL/TextureUnitManager.js +47 -43
- package/Rendering/OpenGL/VertexArrayObject.js +92 -131
- package/Rendering/OpenGL/ViewNodeFactory.js +25 -13
- package/Rendering/OpenGL/Volume.js +38 -34
- package/Rendering/OpenGL/VolumeMapper.js +437 -547
- package/Rendering/OpenGL.js +28 -28
- package/Rendering/SceneGraph/RenderPass.js +34 -31
- package/Rendering/SceneGraph/RenderWindowViewNode.js +68 -94
- package/Rendering/SceneGraph/ViewNode.js +82 -111
- package/Rendering/SceneGraph/ViewNodeFactory.js +31 -26
- package/Rendering/SceneGraph.js +4 -4
- package/Rendering/WebGPU/Actor.js +49 -49
- package/Rendering/WebGPU/Actor2D.js +45 -44
- package/Rendering/WebGPU/BindGroup.js +43 -50
- package/Rendering/WebGPU/Buffer.js +41 -50
- package/Rendering/WebGPU/BufferManager/Constants.js +4 -4
- package/Rendering/WebGPU/BufferManager.js +111 -141
- package/Rendering/WebGPU/Camera.js +65 -67
- package/Rendering/WebGPU/CellArrayMapper.js +621 -388
- package/Rendering/WebGPU/CubeAxesActor.js +28 -19
- package/Rendering/WebGPU/Device.js +78 -133
- package/Rendering/WebGPU/ForwardPass.js +75 -72
- package/Rendering/WebGPU/FullScreenQuad.js +25 -18
- package/Rendering/WebGPU/Glyph3DMapper.js +62 -74
- package/Rendering/WebGPU/HardwareSelectionPass.js +45 -38
- package/Rendering/WebGPU/HardwareSelector.js +200 -276
- package/Rendering/WebGPU/ImageMapper.js +180 -171
- package/Rendering/WebGPU/ImageSlice.js +45 -44
- package/Rendering/WebGPU/IndexBuffer.js +166 -200
- package/Rendering/WebGPU/OpaquePass.js +37 -36
- package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +72 -45
- package/Rendering/WebGPU/Pipeline.js +37 -51
- package/Rendering/WebGPU/PixelSpaceCallbackMapper.js +27 -19
- package/Rendering/WebGPU/PolyDataMapper.js +50 -53
- package/Rendering/WebGPU/PolyDataMapper2D.js +39 -39
- package/Rendering/WebGPU/RenderEncoder.js +68 -88
- package/Rendering/WebGPU/RenderWindow.js +262 -376
- package/Rendering/WebGPU/Renderer.js +224 -208
- package/Rendering/WebGPU/Sampler.js +27 -21
- package/Rendering/WebGPU/ScalarBarActor.js +28 -19
- package/Rendering/WebGPU/ShaderCache.js +43 -41
- package/Rendering/WebGPU/ShaderDescription.js +52 -59
- package/Rendering/WebGPU/ShaderModule.js +26 -17
- package/Rendering/WebGPU/SimpleMapper.js +185 -121
- package/Rendering/WebGPU/SphereMapper.js +200 -130
- package/Rendering/WebGPU/StickMapper.js +289 -152
- package/Rendering/WebGPU/StorageBuffer.js +100 -115
- package/Rendering/WebGPU/Texture.js +79 -99
- package/Rendering/WebGPU/TextureManager.js +52 -54
- package/Rendering/WebGPU/TextureView.js +40 -43
- package/Rendering/WebGPU/Types.js +53 -70
- package/Rendering/WebGPU/UniformBuffer.js +158 -184
- package/Rendering/WebGPU/VertexInput.js +64 -90
- package/Rendering/WebGPU/ViewNodeFactory.js +25 -13
- package/Rendering/WebGPU/Volume.js +52 -51
- package/Rendering/WebGPU/VolumePass.js +218 -239
- package/Rendering/WebGPU/VolumePassFSQ.js +625 -306
- package/Rendering/WebGPU.js +1 -1
- package/Rendering/index.js +5 -5
- package/Widgets/Core/AbstractWidget/Constants.js +2 -2
- package/Widgets/Core/AbstractWidget.js +49 -58
- package/Widgets/Core/AbstractWidgetFactory.js +101 -122
- package/Widgets/Core/StateBuilder/boundsMixin.js +23 -28
- package/Widgets/Core/StateBuilder/color3Mixin.js +10 -7
- package/Widgets/Core/StateBuilder/colorMixin.js +10 -6
- package/Widgets/Core/StateBuilder/cornerMixin.js +16 -15
- package/Widgets/Core/StateBuilder/directionMixin.js +20 -18
- package/Widgets/Core/StateBuilder/manipulatorMixin.js +26 -18
- package/Widgets/Core/StateBuilder/nameMixin.js +10 -6
- package/Widgets/Core/StateBuilder/orientationMixin.js +19 -16
- package/Widgets/Core/StateBuilder/originMixin.js +25 -32
- package/Widgets/Core/StateBuilder/scale1Mixin.js +10 -6
- package/Widgets/Core/StateBuilder/scale3Mixin.js +10 -6
- package/Widgets/Core/StateBuilder/shapeMixin.js +12 -6
- package/Widgets/Core/StateBuilder/textMixin.js +10 -6
- package/Widgets/Core/StateBuilder/visibleMixin.js +10 -6
- package/Widgets/Core/StateBuilder.js +120 -149
- package/Widgets/Core/WidgetManager/Constants.js +7 -7
- package/Widgets/Core/WidgetManager.js +249 -421
- package/Widgets/Core/WidgetState.js +48 -57
- package/Widgets/Core.js +5 -5
- package/Widgets/Manipulators/AbstractManipulator.js +20 -14
- package/Widgets/Manipulators/CPRManipulator.js +55 -71
- package/Widgets/Manipulators/LineManipulator.js +31 -28
- package/Widgets/Manipulators/PickerManipulator.d.ts +48 -0
- package/Widgets/Manipulators/PickerManipulator.js +65 -0
- package/Widgets/Manipulators/PlaneManipulator.js +26 -23
- package/Widgets/Manipulators/TrackballManipulator.js +39 -35
- package/Widgets/Manipulators.js +4 -2
- package/Widgets/Representations/ArrowHandleRepresentation.js +148 -162
- package/Widgets/Representations/CircleContextRepresentation.js +44 -38
- package/Widgets/Representations/ContextRepresentation.js +17 -14
- package/Widgets/Representations/ConvexFaceContextRepresentation.js +50 -47
- package/Widgets/Representations/CroppingOutlineRepresentation.js +38 -27
- package/Widgets/Representations/CubeHandleRepresentation.js +21 -18
- package/Widgets/Representations/GlyphRepresentation.js +107 -152
- package/Widgets/Representations/HandleRepresentation.js +17 -14
- package/Widgets/Representations/ImplicitPlaneRepresentation.js +97 -91
- package/Widgets/Representations/LineHandleRepresentation.js +44 -41
- package/Widgets/Representations/OutlineContextRepresentation.js +42 -36
- package/Widgets/Representations/PolyLineRepresentation.js +60 -75
- package/Widgets/Representations/RectangleContextRepresentation.js +42 -37
- package/Widgets/Representations/SphereContextRepresentation.js +19 -27
- package/Widgets/Representations/SphereHandleRepresentation.js +31 -27
- package/Widgets/Representations/SplineContextRepresentation.js +46 -70
- package/Widgets/Representations/WidgetRepresentation/Constants.js +2 -2
- package/Widgets/Representations/WidgetRepresentation.js +99 -134
- package/Widgets/Representations.js +13 -13
- package/Widgets/Widgets3D/AngleWidget/behavior.js +41 -63
- package/Widgets/Widgets3D/AngleWidget.js +40 -38
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +40 -61
- package/Widgets/Widgets3D/DistanceWidget.js +38 -36
- package/Widgets/Widgets3D/EllipseWidget/behavior.js +14 -19
- package/Widgets/Widgets3D/EllipseWidget/state.js +4 -2
- package/Widgets/Widgets3D/EllipseWidget.js +37 -26
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +26 -56
- package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +14 -17
- package/Widgets/Widgets3D/ImageCroppingWidget/state.js +20 -16
- package/Widgets/Widgets3D/ImageCroppingWidget.js +80 -98
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +55 -77
- package/Widgets/Widgets3D/InteractiveOrientationWidget/behavior.js +17 -18
- package/Widgets/Widgets3D/InteractiveOrientationWidget/state.js +15 -7
- package/Widgets/Widgets3D/InteractiveOrientationWidget.js +30 -29
- package/Widgets/Widgets3D/LabelWidget/behavior.js +37 -62
- package/Widgets/Widgets3D/LabelWidget.js +31 -25
- package/Widgets/Widgets3D/LineWidget/Constants.js +8 -8
- package/Widgets/Widgets3D/LineWidget/behavior.js +77 -114
- package/Widgets/Widgets3D/LineWidget/helpers.js +13 -20
- package/Widgets/Widgets3D/LineWidget/state.js +2 -1
- package/Widgets/Widgets3D/LineWidget.js +39 -35
- package/Widgets/Widgets3D/PaintWidget/behavior.js +24 -59
- package/Widgets/Widgets3D/PaintWidget.js +39 -37
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +44 -68
- package/Widgets/Widgets3D/PolyLineWidget.js +36 -31
- package/Widgets/Widgets3D/RectangleWidget/behavior.js +6 -11
- package/Widgets/Widgets3D/RectangleWidget/state.js +4 -2
- package/Widgets/Widgets3D/RectangleWidget.js +37 -25
- package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +35 -21
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +133 -209
- package/Widgets/Widgets3D/ResliceCursorWidget/cprBehavior.js +26 -41
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +89 -116
- package/Widgets/Widgets3D/ResliceCursorWidget/state.js +33 -40
- package/Widgets/Widgets3D/ResliceCursorWidget.js +186 -227
- package/Widgets/Widgets3D/SeedWidget/behavior.js +82 -0
- package/Widgets/Widgets3D/SeedWidget/state.js +18 -0
- package/Widgets/Widgets3D/SeedWidget.d.ts +44 -0
- package/Widgets/Widgets3D/SeedWidget.js +43 -0
- package/Widgets/Widgets3D/ShapeWidget/Constants.js +19 -19
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +150 -252
- package/Widgets/Widgets3D/ShapeWidget.js +24 -27
- package/Widgets/Widgets3D/SphereWidget/behavior.js +35 -69
- package/Widgets/Widgets3D/SphereWidget/state.js +9 -5
- package/Widgets/Widgets3D/SphereWidget.js +34 -44
- package/Widgets/Widgets3D/SplineWidget/behavior.js +85 -120
- package/Widgets/Widgets3D/SplineWidget.js +43 -39
- package/Widgets/Widgets3D.js +15 -15
- package/Widgets/index.js +4 -4
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +95 -207
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +0 -3
- package/favicon.js +5 -6
- package/index.d.ts +4 -2
- package/index.js +4 -3
- package/macros.js +4 -1931
- package/macros2.js +1684 -0
- package/package.json +6 -6
- 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 '../../
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
51
|
-
}
|
|
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
|
-
};
|
|
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
|
-
|
|
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);
|
|
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);
|
|
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);
|
|
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
|
-
}
|
|
106
|
-
// convert anchor point to View Coords
|
|
107
|
-
|
|
97
|
+
}
|
|
108
98
|
|
|
109
|
-
|
|
110
|
-
|
|
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];
|
|
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++;
|
|
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
|
-
};
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
177
|
+
const results = {
|
|
185
178
|
ptIdx: 0,
|
|
186
179
|
cellIdx: 0,
|
|
187
|
-
polys
|
|
188
|
-
points
|
|
189
|
-
tcoords
|
|
180
|
+
polys,
|
|
181
|
+
points,
|
|
182
|
+
tcoords
|
|
190
183
|
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
-
|
|
209
|
-
normalize2D(dir);
|
|
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++;
|
|
206
|
+
textIdx++;
|
|
214
207
|
|
|
215
|
-
|
|
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
|
-
|
|
247
|
-
|
|
238
|
+
// compute bounds for label quads whenever the camera changes
|
|
248
239
|
publicAPI.updateTexturePolyData();
|
|
249
240
|
};
|
|
250
241
|
}
|
|
251
|
-
|
|
252
|
-
|
|
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);
|
|
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];
|
|
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
|
-
};
|
|
306
|
-
// return true if the list of faces to draw has changed
|
|
307
|
-
|
|
291
|
+
};
|
|
308
292
|
|
|
309
|
-
|
|
310
|
-
|
|
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
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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);
|
|
332
|
-
|
|
333
|
-
drawit = tmpv3[2] > faceDot;
|
|
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
|
-
};
|
|
349
|
-
|
|
331
|
+
};
|
|
350
332
|
|
|
351
|
-
|
|
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
|
-
|
|
354
|
-
|
|
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
|
-
|
|
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
|
-
|
|
367
|
-
|
|
349
|
+
// add values for gridlines
|
|
368
350
|
if (model.gridLines) {
|
|
369
|
-
for (
|
|
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
|
-
}
|
|
376
|
-
|
|
357
|
+
}
|
|
377
358
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
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
|
-
|
|
384
|
-
|
|
385
|
-
|
|
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
|
-
}
|
|
393
|
-
|
|
375
|
+
}
|
|
394
376
|
|
|
395
|
-
|
|
396
|
-
|
|
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[
|
|
399
|
-
lines[lineIdx * 3 + 2] = edgePoints[
|
|
381
|
+
lines[lineIdx * 3 + 1] = edgePoints[e][0];
|
|
382
|
+
lines[lineIdx * 3 + 2] = edgePoints[e][1];
|
|
400
383
|
lineIdx++;
|
|
401
384
|
}
|
|
402
|
-
}
|
|
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 (
|
|
411
|
-
if (facesToDraw[
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
points[ptIdx * 3 +
|
|
417
|
-
points[ptIdx * 3 + faceAxes[
|
|
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[
|
|
421
|
-
points[ptIdx * 3 + faceAxes[
|
|
422
|
-
points[ptIdx * 3 + faceAxes[
|
|
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
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
points[ptIdx * 3 +
|
|
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[
|
|
438
|
-
points[ptIdx * 3 + faceAxes[
|
|
439
|
-
points[ptIdx * 3 + faceAxes[
|
|
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
|
-
};
|
|
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
|
-
|
|
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
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
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 (
|
|
480
|
-
|
|
481
|
-
|
|
456
|
+
for (let e = 0; e < 4; e++) {
|
|
457
|
+
const edgeIdx = faceEdges[f][e];
|
|
482
458
|
if (edgesToDraw[edgeIdx] === 1) {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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++;
|
|
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++;
|
|
498
|
-
|
|
473
|
+
ptIdx++;
|
|
474
|
+
// set the text
|
|
499
475
|
model.textValues[textIdx] = model.axisLabels[edgeAxis];
|
|
500
|
-
textIdx++;
|
|
476
|
+
textIdx++;
|
|
501
477
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
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++;
|
|
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
|
-
};
|
|
527
|
-
// and changes to key members
|
|
528
|
-
|
|
500
|
+
};
|
|
529
501
|
|
|
530
|
-
|
|
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
|
-
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
var facesChanged = publicAPI.computeFacesToDraw();
|
|
538
|
-
var facesToDraw = model.lastFacesToDraw; // have the bounds changed?
|
|
508
|
+
}
|
|
539
509
|
|
|
540
|
-
|
|
510
|
+
// compute what faces to draw
|
|
511
|
+
const facesChanged = publicAPI.computeFacesToDraw();
|
|
512
|
+
const facesToDraw = model.lastFacesToDraw;
|
|
541
513
|
|
|
542
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
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 (
|
|
530
|
+
for (let e = 0; e < 4; e++) {
|
|
558
531
|
edgesToDraw[faceEdges[f][e]]++;
|
|
559
532
|
}
|
|
560
533
|
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
var ticks = [];
|
|
565
|
-
var tickStrings = [];
|
|
534
|
+
}
|
|
566
535
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
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
|
-
|
|
549
|
+
// compute label world coords and text
|
|
550
|
+
publicAPI.updateTextData(facesToDraw, edgesToDraw, ticks, tickStrings);
|
|
576
551
|
|
|
577
|
-
|
|
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
|
-
};
|
|
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';
|
|
569
|
+
model.tmContext.textAlign = 'left';
|
|
596
570
|
|
|
571
|
+
// first the three labels
|
|
597
572
|
model._tmAtlas.clear();
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
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
|
-
|
|
606
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
628
|
-
|
|
629
|
-
|
|
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:
|
|
599
|
+
width: metrics.width + 2,
|
|
633
600
|
textStyle: model.tickTextStyle
|
|
634
601
|
};
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
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
|
-
}
|
|
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);
|
|
614
|
+
totalHeight = nearestPowerOfTwo(totalHeight);
|
|
651
615
|
|
|
652
|
-
|
|
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
|
-
});
|
|
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);
|
|
626
|
+
model.tmContext.clearRect(0, 0, maxWidth, totalHeight);
|
|
662
627
|
|
|
663
|
-
|
|
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
|
-
};
|
|
671
|
-
|
|
635
|
+
};
|
|
672
636
|
|
|
673
|
-
|
|
637
|
+
// Make sure the data is correct
|
|
638
|
+
publicAPI.onModified(() => {
|
|
674
639
|
model.forceUpdate = true;
|
|
675
640
|
publicAPI.update();
|
|
676
641
|
});
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
642
|
+
publicAPI.setTickTextStyle = tickStyle => {
|
|
643
|
+
model.tickTextStyle = {
|
|
644
|
+
...model.tickTextStyle,
|
|
645
|
+
...tickStyle
|
|
646
|
+
};
|
|
680
647
|
publicAPI.modified();
|
|
681
648
|
};
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
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
|
-
|
|
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
|
-
};
|
|
702
|
-
|
|
667
|
+
};
|
|
703
668
|
|
|
704
|
-
|
|
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
|
-
|
|
707
|
-
return _setProp(p)[0];
|
|
708
|
-
};
|
|
709
|
-
} // ----------------------------------------------------------------------------
|
|
674
|
+
// ----------------------------------------------------------------------------
|
|
710
675
|
// Object factory
|
|
711
676
|
// ----------------------------------------------------------------------------
|
|
712
677
|
|
|
713
|
-
|
|
714
678
|
function defaultValues(initialValues) {
|
|
715
|
-
return
|
|
679
|
+
return {
|
|
716
680
|
boundsScaleFactor: 1.3,
|
|
717
681
|
camera: null,
|
|
718
|
-
dataBounds:
|
|
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
|
-
|
|
737
|
-
}
|
|
699
|
+
},
|
|
700
|
+
...initialValues
|
|
701
|
+
};
|
|
702
|
+
}
|
|
738
703
|
|
|
704
|
+
// ----------------------------------------------------------------------------
|
|
739
705
|
|
|
740
706
|
function extend(publicAPI, model) {
|
|
741
|
-
|
|
742
|
-
Object.assign(model, defaultValues(initialValues));
|
|
707
|
+
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
708
|
+
Object.assign(model, defaultValues(initialValues));
|
|
743
709
|
|
|
744
|
-
|
|
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();
|
|
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']);
|
|
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
|
-
|
|
745
|
+
// ----------------------------------------------------------------------------
|
|
746
|
+
|
|
747
|
+
const newInstance = macro.newInstance(extend, 'vtkCubeAxesActor');
|
|
748
|
+
|
|
749
|
+
// ----------------------------------------------------------------------------
|
|
776
750
|
|
|
777
751
|
var vtkCubeAxesActor$1 = {
|
|
778
|
-
newInstance
|
|
779
|
-
extend
|
|
780
|
-
newCubeAxesActorHelper
|
|
752
|
+
newInstance,
|
|
753
|
+
extend,
|
|
754
|
+
newCubeAxesActorHelper
|
|
781
755
|
};
|
|
782
756
|
|
|
783
757
|
export { vtkCubeAxesActor$1 as default, extend, newInstance };
|