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…

Explore Interaction Of vtkAbstractWidget By vtkHandleWidget Example

vtkAbstractWidget has its mechanism to handle interactive events. Here is a simple demo indicates the differences between the responses of widget and vtkInteractorStyleTrackballCamera. Example Code: int main() { vtkSmartPointer<vtkConeSource> cone = vtkSmartPointer<vtkConeSource>::New(); cone->Update(); vtkSmartPointer<vtkPolyDataMapper> coneMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); coneMapper->SetInputData( cone->GetOutput() ); coneMapper->Update(); vtkSmartPointer<vtkActor> coneActor = vtkSmartPointer<vtkActor>::New(); coneActor->SetMapper( coneMapper ); vtkSmartPointer<vtkPointHandleRepresentation3D> handleRep 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…

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

X