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…

VTK – Debug And Print VTK Object

Print debug info by vtk macro How to show vtk object’s debug information? I introduce how to show vtk object’s debug information by the custom class which inherits vtkPolyDataAlgorithm, relevant article: 【VTK】Create source class which is derived from vtkPolyDataAlgorithm We just need to Star->DebugOn() and use vtkDebugMacro as std::cout. vtkDebugMacro( Read more…

VTK – Decimate Polydata With Scalar

How to decimate a PolyData without changing pointData’s scalar’s position? Two classes vtkQuadricDecimation and vtkDecimatePro are worth discussing. vtkQuadricDecimation can decimate pointdata’s scalar. We have to set AttributeErrorMetric true to handle 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> Read more…

Content Summary
: Input your strings, the tool can get a brief summary of the content for you.

X