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…

vtkCutter Find The Intersections Between Bounding Box Plane And Polydata

Create a simple cone and plane. #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 <vtkCamera.h> #include <vtkOBBTree.h> #include <vtkActor2D.h> #include <vtkMath.h> #include <vtkTransform.h> #include <vtkTransformFilter.h> #include <vtkMatrix4x4.h> #include <vtkInteractorObserver.h> #include <vtkPolyDataNormals.h> #include <vtkOutlineFilter.h> #include <vtkPlaneSource.h> Read more…

VTK – Use vtkOBBTree To Find Axes Of 3D Model

I will show how to use vtkOBBTree to calculate X, Y and Z axis of the 3D model in the article. Create a simple cone. #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 <vtkCamera.h> #include Read more…

VTK – Area Layouts Of Graph Visualizations

There are three examples using views displaying relations of vtk classes. The article learned from VTKUsersGuide vtkTreeRingView Python #!/usr/bin/env python from vtk import * def main(): datapath = “/Users/weiyang/Downloads/VTKData” #vtk.util.misc.vtkGetDataRoot() reader1 = vtkXMLTreeReader() reader1.SetFileName(datapath + “/Data/Infovis/XML/vtkclasses.xml”) reader1.SetEdgePedigreeIdArrayName(“tree edge”) reader1.GenerateVertexPedigreeIdsOff(); reader1.SetVertexPedigreeIdArrayName(“id”); reader2 = vtkXMLTreeReader() reader2.SetFileName(datapath + “/Data/Infovis/XML/vtklibrary.xml”) reader2.SetEdgePedigreeIdArrayName(“graph edge”) reader2.GenerateVertexPedigreeIdsOff(); reader2.SetVertexPedigreeIdArrayName(“id”); Read more…

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

X