VTK – How To Show Bounding Box For A 3D Model

It’s a simple job for us to make bounding box visible in traditional VTK render window. We can SetCurrentRenderer for renderWindowInteractor->GetInteractorStyle() and press P to show it. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> #include <vtkActor.h> #include <vtkConeSource.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkPolyDataMapper.h> #include <vtkProperty.h> #include <vtkRenderWindowInteractor.h> #include <vtkLight.h> #include Read more…

VTK – Saving High-Resolution Image

The article describes method Tiled Rendering refers to VTKUsersGuide The class vtkRenderLargeImage breaks up the whole rendering into separated parts. The different pieces are handled and combined into a final large image. The interface SetMagnification of vtkRenderLargeImage control how much to larger the original image. vtkRenderLargeImage renderLarge renderLarge SetInput ren Read more…

VTK – Import And Export 3D Model

The instance of vtkImporter contains vtkRenderWindow and vtkRenderer objects. It supports to recover original scene including lights, cameras, actors, etc. Here is a simple example which imports 3D studio file and shows the whole scene. import vtk DataRoot = “/Users/weiyang/Downloads/VTKData” importer = vtk.vtk3DSImporter() importer.ComputeNormalsOn() importer.SetFileName( DataRoot + “/Data/iflamigm.3ds” ) importer.Read() Read more…

VTK – Reverse PolyData’s Normals

vtkReverseSense can help us to reverse the direction of point normals and cell normals. The following code shows a simple example which display vertexes’ normals by cones in a sphere. Here is its original geometric states. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> #include <vtkActor.h> #include <vtkConeSource.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> Read more…

VTK – Update Different Views When Selections Changed

The article shows how to use vtkViewUpdater to update different views when the selections changed. Relevant development environment: VTK-8.1.1; Qt 5.11.2 (x86_64-little_endian-lp64 shared (dynamic) release build; Clang 8.1.0 (clang-802.0.42) (Apple)) on “cocoa”; macOS 10.14 [darwin version 18.5.0]; #include <QApplication> #include <qsurfaceformat.h> #include <QVTKOpenGLWidget.h> #include <vtkRandomGraphSource.h> #include <vtkDataObjectToTable.h> #include <vtkQtTableView.h> #include Read more…

Use vtkAxesActor To Show Three Axes In The World Coordinate System

I wanted to explore vtkPlaneSource’s interfaces SetPoint1 and SetPoint2 with visible 3D Axes. It’s awkward to find that it’s difficult to control plane’s shape by interfaces SetPoint1 and SetPoint2 directly. So I used vtkAxesActor to show three axes in the world coordinate system. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> #include Read more…

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X