VTK – Make Interpolation Spline Curve Smoother

Here are a few points like the following picture. The source code: #include <iostream> #include <vector> #include <iostream> #include <vtkPolyData.h> #include <vtkProperty.h> #include <vtkPolyDataMapper.h> #include <vtkActor.h> #include <vtkPlane.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h> #include <vtkPoints.h> #include <vtkInteractorStyleTrackballCamera.h> #include “./point.hpp” #include <vtkPlane.h> #include <vtkPlaneSource.h> #include <vtkTransform.h> #define vtkSPtr vtkSmartPointer #define Read more…

Use Singular Value Decomposition In VTK

Affine transformation can be decomposed to translation, rotation, and scale. As we know, the transformation can be represented by matrix.     Related post: https://www.weiy.city/2021/11/the-releationship-between-local-transform-and-pose-transform/ It can be computed by translate matrix and rotate & scale matrix.     Example: I try to do decomposition for a matrix.     Read more…

3D – Rotate Axis System To The Special Orientation

The post is based on https://www.weiy.city/2021/11/vtk-rotate-vector-to-special-direction/. We will rotate the three axes of the world coordinate system to particular directions. #include <iostream> #include <vtkSmartPointer.h> #include <vtkTransform.h> #include <vtkActor.h> #include <vtkConeSource.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkPolyDataMapper.h> #include <vtkRenderWindowInteractor.h> #include <vtkAxesActor.h> #include “../point.hpp” using namespace std; double AngleBeteewnTwoVector( Point vec0, Point 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…

The Stability Of Sorting Algorithm

If two numbers are equal and the relative positions are not changed after sorting, we think the sorting algorithm is stable. Stable sort algorithm: bubble sort, insert sort and merge sort. Unstable sort algorithm: quick sort, heap sort. Introduce an unstable sort algorithm quick sort. Its core thought is divide Read more…

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

X