## Find The Center Of Discrete Points & Get Projected Vector On Direction

I want to find the central point, not mass center, between a few points like the following image. The points are on the same plane. Find the longest axis and the orthogonal axis for the points set firstly. Compute the positive farthest point and negative farthest point for every axis. Read more…

## 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…

## Find Closest Plane Between Points In 3D By Covariance Matrix

The post is similar to Find Closest Plane Between Points In 3D By Levmar Algorithm. The vtkPlane in vtk9.0.2 or the newer version provides a way to calculate the fitting plane for a few points. static bool ComputeBestFittingPlane(vtkPoints* pts, double* origin, double* normal);. The origin will be the centroid of 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…

## Overview Of GJK Algorithm

Here is a convex object and an origin point outside it. is an arbitrary point in the boundary. Find the farthest point on the boundary along the vector . Name the farthest point . We get a new vector to find the farthest point on the boundary along the direction 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…

## Smooth Model Suface To Plane

We have a model looks like in the following scene. It has been cut by a plane but the shape changed after that. So its surface become not flat. I got the cut plane information and planed to project all points on the cut part to the plane. The code Read more…

XOR Strings
: Input your strings, the tool can encrypt and decrypt them.

X