VTK – Rotate Vector To Special Direction

I take notes about how to rotate vector to a special direction. #include “./tool.h” #define vtkSPtr vtkSmartPointer #define vtkSPtrNew(Var, Type) vtkSPtr<Type> Var = vtkSPtr<Type>::New(); int main(int, char *[]) { PointStruct vec0( 1, 1, 0 ); PointStruct vec1( -1, 1, 0 ); PointStruct vecZ( 0, 0, 1 ); double radian = Read more…

Learn VTK By Python Script On Mac

The post introduces how to create an environment for learning VTK by Python. The basic conditions on my computer: VTK-8.1.1 macOS Mojave 10.14 Python 2.7.10 Write a bash script and run it. cmake ./ -G “Unix Makefiles” \ -DVTK_USE_QVTK:BOOL=ON \ -DCMAKE_INSTALL_PREFIX=/usr/local \ -DVTK_USE_GUISUPPORT:BOOL=ON \ -DVTK_QT_VERSION=5 \ -DModule_vtkGUISupportQt:BOOL=ON \ -DModule_vtkGUISupportQtOpenGL:BOOL=ON \ Read more…

VTK – Separating Meshe By Connectivity

I export scene from ParaView to get a mesh like the following image. Let’s take edge lists from different parts and form two independent meshes. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> #include <vtkActor.h> #include <vtkConeSource.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkPolyDataMapper.h> #include <vtkRenderWindowInteractor.h> #include <vtkCellData.h> #include <vtkNamedColors.h> #include <vtkColorTransferFunction.h> #include Read more…

VTK – Set Position For vtkTextActor

The article discuss an issue about set position for vtkTextActor object. The class vtkTextActor provides interface SetPosition, its parameter controls object’s left-bottom coordinate. /** * Get the PositionCoordinate instance of vtkCoordinate. * This is used for for complicated or relative positioning. * The position variable controls the lower left corner Read more…

VTK Boolean operation – The Notes About Logic Subtraction For Mesh

We often subtract mesh by other object to get the result we want. The scene looks like the following image. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> #include <vtkActor.h> #include <vtkConeSource.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkPolyDataMapper.h> #include <vtkRenderWindowInteractor.h> #include <vtkClipPolyData.h> #include <vtkImplicitBoolean.h> #include <vtkPlanes.h> #include <vtkDataArray.h> #include <vtkDoubleArray.h> #include <vtkProperty.h> Read more…

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

X