VTK – Use AddInputConnection

AddInputConnection is a public interface provided by vtkAlgorithm. We can use it to combine multiple input sources to get a final 3D model with some special algorithm class. The following example has two VTK algorithm classes which show us the multiple source connections. int main() { vtkSmartPointer<vtkSphereSource> sphereSource = vtkSmartPointer<vtkSphereSource>::New(); Read more…

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…

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

X