Scale vtkTextActor When We Zoom In/Out
I will show how to scale the string to follow the 3D model cone in the renderer by the following example.
Create class customIteractorStyle which inherited vtkInteractorStyleTrackballCamera
I will show how to scale the string to follow the 3D model cone in the renderer by the following example.
Create class customIteractorStyle which inherited vtkInteractorStyleTrackballCamera
The article shows a few tips in VTK development. There are simple tasks for most developers but the functions can be used in many situations. Convert the length value in the display coordinate system to the new value in the world coordinate system. double DisplayLenToWorldLen(const double &length) { Point p0( Read more…
Let’s add three items to the render window. Draw a rectangle and pick all actors in the rectangle. The class vtkAreaPicker can help us to find these picked actors. I will show how to do it in the following code snippet. main.cpp CustomIteractorStyle.h CustomIteractorStyle.cpp But how to find the actors Read more…
I had tried to show display coordinate bounds of the 3D model in the article VTK: Show Display Bounds. But the result is not good enough because the process that transforms the world coordinate point to display the coordinate point can generate error as we rotate the camera. So I Read more…
Here is a curve in the 3D scene, the sphere represents its center. I want to find the axes of the 3D model just as vtkOBBTree, relative article: Explore The Orientation Of 3D Object. But all points on the curve are in the same plane, so neither vtkOBBTree nor vtkHull Read more…
I planed to show the 3D model’s bounds in the display coordinate and update it if the user rotates and zooms in/out in real-time. I’m curious about if the display bounds touch with the 3D model. The display bounds are shown as a red rectangle in the render window, our Read more…
We often use vtkPropPicker to judge which 2D actor had been picked, but the solution doesn’t work in the Mac software Parallels. So we have to create a new method to found the 2D actor which had been picked. There are two situations in my problem. The actor2D takes vtkImageMapper Read more…
We have a vtkTextActor object in the render window now. How to put it at the right-top corner or the left-bottom corner in the render window according to the render and text rectangle’s size? The following code snippet shows the different scenes described above. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> Read more…
We will got the following left part’s effect when zoom in and zoom out in VTK render window. How to keep the same display size for the 3D model cube when zoom in or zoom out? VTK changes camera’s status in the interfaces vtkInteractorStyleTrackballCamera::OnMouseWheelForward and vtkInteractorStyleTrackballCamera::OnMouseWheelBackward, the action Dolly moves Read more…