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…

Open File By Browser & Set Mouse Position By VTK

Open File By Browser The FileReader object lets web applications asynchronously read the contents of file. You can feel the effect at: https://www.weiy.city/web-test/open-file/ <!doctype html> <html lang=”en”> <head> <title>Test</title> </head> <body> <input type=”file” id=”file-input” /> <h3>Contents of the file:</h3> <pre id=”file-content”></pre> <script> function displayContents(contents) { var element = document.getElementById(‘file-content’); element.textContent Read more…

VTK – Calculate Distance Between Two 3D Models

The post shows a way to calculate unsigned distance Between Two 3D Models. The models can’t have too low resolution because the result that vtkDistancePolyDataFilter computes will not be accurate. #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> Read more…

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

X