Use Timer In vtkRenderWindowInteractor To Do Task
We can create an timer in vtkRenderWindowInteractor object, then register timerEvent for it to trigger task. Here is simple example about rotating a cone automatically. Result:
We can create an timer in vtkRenderWindowInteractor object, then register timerEvent for it to trigger task. Here is simple example about rotating a cone automatically. Result:
My old CPlusPlus project which uses VTK to display 3D scene worked on web page as wasm file. But after upgrading emsdk and compiling the multithreaded version of VTK, I always get the following error on the web page. I test VTK example at vtk/src/Examples/Emscripten/Cxx/Cone from GitHub. But the similar Read more…
We can export a CPlusPlus function in wasm for JS to control the time of invoking vtkRenderWindowInteractor::Start. But after the exported function called, we can’t run the following JS code due to the event loop caused the blockage. Read the code in VTK to find the way to give JS Read more…
Here is a simple example which use vtkMarchingCubes to take iossurface from volume. We use vtkVoxelModeller to create an image data which has scalar data to mark where is inside and outside. Output:
Environment: VTK8.2.0 + Qt 5.12.2. I have tried vtkImageActor, vtkActor2D and vtkButtonWidget to make 2D button in different scenes. After comparing them, I think vtkActor2D is the most convenient and the safest solution. Here is an example using vtkButtonWidget, Use vtkButtonWidget To Create 2D Button. vtkImageActor is a 3D actor, we need Read more…
As we know, vtkTransformFilter can change points’ positions and rewrite data. Then we use vtkTransform object to do linear transform for 3D model. This process is not equal to the multiplication of these two matrices. We can deduce the event in our online tool: 3D Model Editor.Open module linear transform tester. We Read more…
Here is a simple demo project which draws an ITK RGBA image and show it in vtkRenderer. We will read DICOM data and put the ITK image above vtkImageData. CMakeLists.txt ULabelImage.h ULabelImage.cpp main.cpp
This article is a sequel to the previous one https://www.weiy.city/2023/04/draw-a-circle-around-mouse-postion-on-screen/. Let’s check if the vertex of cone is inside the red circle when we move mouse. CustomIteractorStyle.cpp UPaintBrush.cpp UPaintBrush.h Output:
The example draws a red circle around mouse position by vtkContextItem, vtkContext2D and vtkContextActor. When moving mouse, the red circle following it. CMakeLists.txt CustomIteractorStyle.h: CustomIteractorStyle.cpp UPaintBrush.h UPaintBrush.cpp main.cpp