Surface-Reconstruction-Toolbox
Download latest released binaries:
https://github.com/LuigiGiaccari/Surface-Reconstruction-Toolbox/releases/latest
Introduction
This tool was mainly coded during my master thesis. It offers several algorithms to triangulate 3d scattered points for 3d scanning applications. After finding it again on a old hard disk I thought that github could give it a fresh restart.
During the thesis, in collaboration with Luca Di angelo and Paolo Di Stefano 3 papers were published
Description
The toolbox features at the moment 4 main algorithms:
- SCBMesher Fast adv front without Delaunay triangulation support. Can easly generate .5 M trias/secs on a laptop- Based on:
A new mesh-growing algorithm for fast surface reconstruction. Computer-Aided Design 43(6): 639-650 (2011)
- RobustCrust Based on the Powercrust always return a watertight surface therefore only supports closed shell-like surfaces
- BallPivoting Simulates a ball rolling on the surface, absed on the paper from Fausto Bernardini.
- QuickTerrain to triangula surface in the z=f(x,y) form, usually called "terrain".
Tools are designed to be used both interactively and from command prompt:
- scbmesher.exe -in bunny.dat –out bunny.stl
- robustcrust.exe –in bunny.dat –out bunny.stl
- ballpivoting.exe –in inputfile –out outputfile -r 1.0
- quickterrain.exe –in inputfile –out output file
All tools uses the -in and -out switch for I/O. The Ball Pivoting also asks for the ball radius.
Input/Output
Input file formats
- .dat (binary)
The file starts with an “int” typeindicating the number of points, next data are a list of doubles indicating the coordinates.
Points are stored this way: X1,Y1,Z1,X2,Y2,Z2…….
These are the Matlab commands to generate such file:
fid=fopen("filename.dat",'wb');%open input file
fwrite(fid, size(p,1), 'int');%first data=the numbers of points;
fwrite(fid,p','double');%points;
fclose(fid);%close the file
And this are the C++ ones:
pFile =fopen("Input.dat", "wb");//open input file
nwritten=fwrite(&N, sizeof(int), 1, pFile);//first line (the number of points)
nwritten=fwrite(&p, sizeof(double), N*3, pFile);//Write the points coordinate
fclose(pFile);//close the file
- .cgo ( ASCII)
The first line contains the number of points, the followings the list of 3D coordinates. Coordinates are separted by space, the decimal separator can be a comma or a point.
Example:
6
0,060649 0,011160 0,059552
0,060351 0,012167 0,058159
0,060749 0,012164 0,059571
0,060267 0,011162 0,058137
0,060278 0,013168 0,058137
0,060653 0,013164 0,059557
Output File
- Stl(binary)
Standard binary stl file.
Acknowledgements
Many thanks to:
- We used the robust predicates from Jonathan Richard Shewchuk
- Amenta's directory of computational geometry software. We found great ideas in the Power Crust Paper.
- Fausto Bernardini. Our Ball Pivoting implementation is based on his paper.
- Thanks to the Meshlab team for their software
- tetgen http://wias-berlin.de/software/tetgen/ saved a lot of time
Contacts
For bugs, suggestions, questions refer to: giaccariluigi@msn.com
Feel free to open issues or pull requests.
Development
Build
Astyle formatting
./Astyle.exe --options=astyle_options.txt ./.cpp ./.h ./*.c