Explore Scale A Plane And Keep Position

The article shows a way to enlarge a plane and keep its original position, scale it and translate it back. #include <iostream> #include <vtkSmartPointer.h> #include <vtkProperty.h> #include <vtkPolyData.h> #include <vtkTriangleFilter.h> #include <vtkRegularPolygonSource.h> #include <vtkPolyDataMapper.h> #include <vtkActor.h> #include <vtkRenderWindow.h> #include <vtkRenderer.h> #include <vtkRenderWindowInteractor.h> #include <vtkInteractorStyleTrackballCamera.h> #include <vtkCamera.h> #include <vtkNamedColors.h> #include <vtkImageActor.h> Read more…

Explore How To Rotate Object And Keep It Facing Camera

The following code comes from vtkFollower, we used it to make the original axes always face the camera. #include <iostream> #include <vtkSmartPointer.h> #include <vtkProperty.h> #include <vtkPolyData.h> #include <vtkTriangleFilter.h> #include <vtkRegularPolygonSource.h> #include <vtkPolyDataMapper.h> #include <vtkActor.h> #include <vtkRenderWindow.h> #include <vtkRenderer.h> #include <vtkRenderWindowInteractor.h> #include <vtkInteractorStyleTrackballCamera.h> #include <vtkCamera.h> #include <vtkNamedColors.h> #include <vtkImageActor.h> #include <vtkImageViewer2.h> Read more…

Explore The Orientation Of 3D Object

The algorithm vtkOBBTree::ComputeOBB can help us to calculate the three axes defining the orientation of the OBB(oriented bounding box). It is very useful for us to get the model’s spatial features. #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 Read more…

Use vtkObjectBase’s Function Delete To Free Object

Explore what will happen when we use delete on vtkSmartPointer<vtkActor> object. vtkSmartPointer<vtkActor> leftActor = vtkSmartPointer<vtkActor>::New(); leftActor->SetMapper( mapper ); //… void *ptr = leftActor.Get(); leftActor->GetProperty()->SetColor( 1, 0, 0 ); rightActor->GetProperty()->SetColor( 0, 1, 0 ); leftActor->Delete(); cout << “leftActor: ” << (void *)leftActor.Get() << endl; cout << “leftActor reference count: ” << Read more…

The Example About vtkPolyDataNormals

The algorithm class vtkPolyDataNormals can be used to calculate normals of points and cells in polydata. The following example shows how to use it. Cube Create a cube in which every cell is a single square. All information can be found in polydata, we use vtkPolyDataNormals to handle it and Read more…

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

X