DesignEngrLab / TVGL

Tessellation and Voxelization Geometry Library
http://designengrlab.github.io/TVGL/
MIT License
58 stars 17 forks source link

Any improvement for fast slicing? #12

Closed esacape3d closed 7 years ago

esacape3d commented 8 years ago

Thanks for this great project. It works great for my application, but I'd like to know any improvement is possible to make slice the model fast? I tried different STL files from thingiverse.com and it takes about 70 sec to load a model with 1.3M faces and another 60 sec to get a single slice. I hope I'd contribute this project, but I'm still learning C#.

Thanks!

massonib commented 8 years ago

The first step is to run a profiler and see where TVGL is spending the most time. I have a few guesses at improvement areas, but the profiler can help pin point time intensive functions. Look especially for what fraction of the time is spend in the TriangulatePolygon function and the TesselatedSolid constructors. Post the results and try to give you some additional direction.

micampbell commented 8 years ago

Our approach is more complicated and time-consuming since the resulting solids are "water-tight" after division. If this is not what you need, then a quicker function can be created. If you need to 2D shape at the slice, then you should use the
Slice.GetContactData(TessellatedSolid ts, Flat plane, out ContactData contactData) method.

esacape3d commented 8 years ago

Thanks for your advice. I'll try Slice.GetContactData and report how it works.