STL Slicer is a console application that slices a given .stl file into slices of 5 microns (0,005MM / 0.196.. Inch).

The full project contains more functionality but this functionality won't be displayed because of NDA reasons.



The steps the application goes through to slice the .stl file:
1: Load STL file.
2: Center STL model.
3: Rescale STL model so the bounding box fits on the specified resolution.
4: Create slices and create images.

How does the slicing work (A rough explanation):
An STL model consists mainly of triangles, these triangles are sorted from the lowest placed triangles to the highest placed triangles.
With these triangles, we can calculate a bounding box that we use to calculate the number of slices we need to make(and much more). Besides the number of slices, we also calculate how much we have to increment the slicing position every iteration.

When we know where to slice we look up which triangles are intersecting the current slicing position. Once a triangle intersects with the slicing line it will always have 2 points intersecting the slicing position. Those 2 points are combined as a line and stored for later use. All the triangles that are below the current slicing position are deleted for efficiency.

Once all the lines have been collected, the application will pass them to a bitmap drawer which draws them on a bitmap and fills the hollow parts with black pixels.

Additional Info

> Team size: 1
> Language: C++