import '@kitware/vtk.js/favicon';
import '@kitware/vtk.js/Rendering/Profiles/Geometry'; import '@kitware/vtk.js/Rendering/Profiles/Glyph';
import vtkFullScreenRenderWindow from '@kitware/vtk.js/Rendering/Misc/FullScreenRenderWindow'; import vtkImplicitPlaneWidget from '@kitware/vtk.js/Widgets/Widgets3D/ImplicitPlaneWidget'; import vtkWidgetManager from '@kitware/vtk.js/Widgets/Core/WidgetManager';
import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor'; import vtkConeSource from '@kitware/vtk.js/Filters/Sources/ConeSource'; import vtkMapper from '@kitware/vtk.js/Rendering/Core/Mapper';
const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance({ background: [0, 0, 0], }); const renderer = fullScreenRenderer.getRenderer();
const cone = vtkConeSource.newInstance(); const mapper = vtkMapper.newInstance(); const actor = vtkActor.newInstance({ pickable: false });
actor.setMapper(mapper); mapper.setInputConnection(cone.getOutputPort()); actor.getProperty().setOpacity(0.5); renderer.addActor(actor);
const widgetManager = vtkWidgetManager.newInstance(); widgetManager.setRenderer(renderer);
const widget = vtkImplicitPlaneWidget.newInstance(); widget.getWidgetState().setNormal(0, 0, 1); widget.placeWidget(cone.getOutputData().getBounds()); widget.setPlaceFactor(3);
widgetManager.addWidget(widget);
renderer.resetCamera(); widgetManager.enablePicking();
|