Flip Item – Mirror Symmetry

As we know, we can create a linear transform to change model to the special orientation and position. Refer to The Releationship Between Local Transform And Pose Transform. Let’s define orientation and position by three axis and point. , , and origin = . The matrix for the linear transform Read more…

vtkAbstractTransform::DeepCopy May Fail

Here is a example that vtkTransform object failed to deep copy the other one. #include <iostream> #include <vtkSmartPointer.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkTransform.h> #define vtkSPtr vtkSmartPointer #define vtkSPtrNew(Var, Type) vtkSPtr<Type> Var = vtkSPtr<Type>::New(); int main() { setbuf( stdout, nullptr ); vtkSPtrNew( trans, vtkTransform ); auto matrix = trans->GetMatrix(); matrix->SetElement( Read more…

The Process Of Rotating Object Around Special Point

Original Status The initial scene looks like the following image. I will rotate cone around point (1, 0, 0) and direction (0, 0, 1). Code #include <vtkActor.h> #include <vtkCleanPolyData.h> #include <vtkDistancePolyDataFilter.h> #include <vtkNamedColors.h> #include <vtkNew.h> #include <vtkPointData.h> #include <vtkPolyDataMapper.h> #include <vtkPolyDataReader.h> #include <vtkProperty.h> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h> #include <vtkRenderer.h> #include Read more…

A Simple WebAssembly Example About VTK

The article shows how to create a simple vtk render window project and show it in the web browser. We need emscripten tool and the visualization toolkit installed. emscripten : https://emscripten.org/docs/getting_started/downloads.html VTK: https://vtk.org/ Build the VTK source to get JS library before our coding. This example uses C plus plus Read more…

Make Model Always On Top II

We had introduced a way to keep a few special models awalys on the top layer in 3D scene. The relative post: https://www.weiy.city/2020/03/make-model-always-on-top/. But it will fail to shift polygons, lines, and points sometimes, eg. when we are in the WebAssembly environment (wasm) for web page.Let’s use an another method Read more…

Rewrite File To Move 3D Model To Origin Point

The post shows a way to move 3D model to the original point in world coordinate system. The file CMakeLists.txt is similar to https://www.weiy.city/2021/12/find-closest-plane-between-points-in-3d-by-covariance-matrix/. The included file point.hpp can be found in https://www.weiy.city/2020/09/project-point-on-line-and-plane-by-special-direction/. #include <iostream> #include <vtkPolyData.h> #include <vtkActor.h> #include <vtkTransformFilter.h> #include “./point.hpp” #include <vtkTransform.h> #include <vtkSTLReader.h> #include <vtkSTLWriter.h> #define Read more…

Content Summary
: Input your strings, the tool can get a brief summary of the content for you.

X