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…

CPP – Partial Sort Algorithm

We need not sort all elements sometimes. Here are a few simple examples of STL algorithms partial_sort, nth_element, and partition. partial_sort For example, find the 5 biggest ones in 10 random numbers. #include <iostream> #include <vector> #include <cstdlib> #include <ctime> #include <algorithm> using namespace std; int main() { vector<int> values; Read more…

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

X