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…

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…

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

X