VTK – Create Spiral By Rigonometric Function

Let’s describe a 3D parametric curve by the form. The value s is in [0, 1]. It is a circle when s is zero, in the other situations it represents a spiral. #include <vtkPointData.h> #include <vtkSmartPointer.h> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h> #include <vtkRenderer.h> #include <vtkPolyData.h> #include <vtkProperty.h> #include <vtkSphereSource.h> #include <vtkPolyDataMapper.h> Read more…

VTK – Cut Image Data By Plane

The post shows how to cut image by a plane smoothly. Header And Macros #include <vtkVersion.h> #include <vtkImageData.h> #include <vtkImageMapper3D.h> #include <vtkImageStencil.h> #include <vtkImageStencilData.h> #include <vtkImageToImageStencil.h> #include <vtkJPEGReader.h> #include <vtkPointData.h> #include <vtkSmartPointer.h> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h> #include <vtkInteractorStyleImage.h> #include <vtkRenderer.h> #include <vtkImageActor.h> #include <vtkPolyDataToImageStencil.h> #include <vtkPolyData.h> #include <vtkSTLReader.h> #include <vtkProperty.h> Read more…

Fix Crash Bug About vtkCellPicker::~vtkCellPicker And vtkCollection::DeleteElement

Here is dump log which shows the stack information. The class CBase has OpenModule and CloseModule interfaces, they can be called multible times. exe caused an Access Violation at location 00007FFA62174327 in module vtkCommonCore-8.2.dll Reading from location 0000000000000DA4. AddrPC Params 00007FFA62174327 0000000000000001 00007FFA9011F05B 0000013DF642A190 vtkCommonCore-8.2.dll!vtkCollection::DeleteElement 00007FFA62174155 0000000000000001 00007FFA622D3BFF 0000013DF6429290 vtkCommonCore-8.2.dll!vtkCollection::~vtkCollection Read more…

Show Point List By Line And Points

The article describe a simple way to display point id list on the original model. We use VTK to draw and show all scenes. vtkSmartPointer<vtkPolyData> UShowData::ShowListByPoints(vtkSmartPointer<vtkPolyData> polyData, vtkSmartPointer<vtkIdList> list) { vSPNew( result, vtkPolyData ); vSPNew( resultPts, vtkPoints ); vSPNew( resultVerts, vtkCellArray ); for( int i = 0; i < list->GetNumberOfIds(); Read more…

VTK – Combine Two Mesh Objects To One

The article shows how to combine two mesh objects to one based on VTK. The code snippet is in the following part. #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> #define vtkPtr( var, className ) vtkSmartPointer<className> var = \ vtkSmartPointer<className>::New() Read more…

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

X