The content of this article, for bloggers in the online to see the summary of the integration of information
Introduction of STL Format
The. stl file is a file format used in a computer graphics application system to represent a closed polygon or body that represents a triangular mesh. The abbreviation for stereo lithography, developed by 3D Systems in 1987, uses triangular discrete approximation to represent three-dimensional models and has become a widely used document format and interface standard in rapid prototyping technology in recent years.
An STL file coordinate must be positive, no proportional information, and the unit is arbitrary.
Second, STL file format
STL files are available in ASCII plaintext format and binary format.
The STL structure in ASCII format is as follows:
1Solid Filename.stl//file path and file name2Facet normal x Y x//the outer normal vector of triangular slices3Vertex x y Z//first vertex4Vertex x y Z//a second vertex5Vertex x y Z//a third vertex6 End Loop7 Endfacet8 .9 .Ten . OneEndsolid
An example of a fragment running a generated STL file for me
A triangular piece contains the outer normal vector of the triangle and three vertices arranged by the right-hand spiral rule.
Because the ASCII format can be very large, there is a binary format
The STL structure in binary format is as follows:
1UINT8//File Header2UINT32//number of triangular slices3 foreachTriangle4real32[3]//normal vector5real32[3]//Vertex One6real32[3]//Vertex two7real32[3]//Vertex three8UINT16//file attribute Statistics9End
Iii.. stl file export and display tools
Here I use VTK to write. stl files, and then use MeshLab to open files for display
The export code is as follows:
1 //VTK2 ......3#include"VtkSTLWriter.h"4 5 intMainintargcChar*argv[])6{//ARGC indicates the number of arguments passed into the main function, Argv0 represents the name of the program, and contains the full path where the Cheng is located7 8 .......9Vtkstlwriter *writer = Vtkstlwriter::new ();//Stereo lithography files only contain triangles. If polygons with more than 3 vertices is present, only the first 3 vertices is written.TenWriter->setinputconnection (skinstripper->Getoutputport ()); OneWriter->setfilename ("D:/dataout/poly2procs.stl"); AWriter->Update (); -Writer->Write (); - theSystem"Pause"); - - return 0; -}
C + + STL Self-study summary, for reference only