<p>I am writing my own slicer and wonder if there is a mathematical proof that proves that the intersection of the slicing plane with the STL file will only produce closed-loop polygons for every given slicing plane?</p>

<p>Thanks!</p>

[{'answer_id': 5141, 'author': 'Tom van der Zanden', 'author_id': 26, 'author_profile': 'https://3dprinting.stackexchange.com/users/26', 'pm_score': 4, 'selected': True, 'text': '<p>You can\'t prove that because it isn\'t true. An STL file is just a collection of triangles. There is no guarantee that an intersection with the slicing plane will consist of closed-loop polygons. To be suitable for 3D printing an STL file should represent one or more closed, disjoint polyhedra (which would yield closed-loop polygons) but this is not always the case. Many slicers have heuristics to try and "fix" bad STL files on a best-effort basis. Especially considering the possibility of rounding errors, it is important to at least detect polygons that are almost (but not quite) closed and connect their endpoints together.</p>\n'}, {'answer_id': 5143, 'author': 'user802599', 'author_id': 1476, 'author_profile': 'https://3dprinting.stackexchange.com/users/1476', 'pm_score': 2, 'selected': False, 'text': '<p>I am also trying to write my own slicer and so I would just like to offer some additional information. </p>\n\n<p>What you will find is that .stl files just store triangles and don\'t validate that the triangles assemble to create a printable model so a lot if not most .stl files are going to have data that isn\'t exactly what you want it to be. So you will want to have additional steps before you get to slicing, to fix up the data you get from the stl file. </p>\n\n<p>A lot of stl models are designed for 3d graphics where intersecting other triangles and not being manifold isn\'t an issue. So you will probably want to write some code to test your models before trying to slice them. </p>\n\n<p>For example if you just sliced the layers of the <a href="https://www.thingiverse.com/thing:821" rel="nofollow noreferrer">Utah Teapot</a>\n <a href="https://i.stack.imgur.com/d7qm0.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d7qm0.gif" alt="Teapot"></a> and don\'t repair the model for 3D printing first you will get two different types of errors. The handle of the teapot does not actually attach to the teapot and is a separate model. And the spout of the teapot is a separate model that intersects the teapot. Both the handle and spout are also open at the ends and not water tight.</p>\n'}]
['https://3dprinting.stackexchange.com/questions/5139', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/1414/']