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…

Two Ways To Add Data Object For vtkView

Two ways to add data object for a vtkView. 1) Create a representation object, set the inputs for it by calling SetInputConnection() or SetInput(), then add representation for the view. 2) Use AddRepresentationFromInputConnection or AddRepresentationFromInput to create representation automatically. 1) Python from vtk import * surfaceRepresentation = vtkRenderedSurfaceRepresentation() sphere = Read more…

Example: vtkGraphLayoutView And vtkGraphToGlyphs

vtkGraphLayoutView is a subclass of vtkGraphLayoutView which has own renderer, renderWindow, command observer, actor and etc. The following code shows how to use it to display a 2D image. from vtk import * def main(): # create a random graph source = vtkRandomGraphSource() source.SetNumberOfVertices(100) source.SetNumberOfEdges(110) source.StartWithTreeOn() source.Update() arcParallelStrategy = vtkArcParallelEdgeStrategy() Read more…

XML To JSON
: Input your strings, the tool can convert XML to JSON for you.

X