VTK – Import And Export 3D Model

The instance of vtkImporter contains vtkRenderWindow and vtkRenderer objects. It supports to recover original scene including lights, cameras, actors, etc. Here is a simple example which imports 3D studio file and shows the whole scene. import vtk DataRoot = “/Users/weiyang/Downloads/VTKData” importer = vtk.vtk3DSImporter() importer.ComputeNormalsOn() importer.SetFileName( DataRoot + “/Data/iflamigm.3ds” ) importer.Read() Read more…

CPP – Partial Sort Algorithm

We need not sort all elements sometimes. Here are a few simple examples of STL algorithms partial_sort, nth_element, and partition. partial_sort For example, find the 5 biggest ones in 10 random numbers. #include <iostream> #include <vector> #include <cstdlib> #include <ctime> #include <algorithm> using namespace std; int main() { vector<int> values; Read more…

VTK – Reverse PolyData’s Normals

vtkReverseSense can help us to reverse the direction of point normals and cell normals. The following code shows a simple example which display vertexes’ normals by cones in a sphere. Here is its original geometric states. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> #include <vtkActor.h> #include <vtkConeSource.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> Read more…

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

X