chiark / gitweb /
Change the way intersection warnings are reported, so we actually know where they...
authordaid <daid303@gmail.com>
Tue, 20 Mar 2012 17:00:53 +0000 (18:00 +0100)
committerdaid <daid303@gmail.com>
Tue, 20 Mar 2012 17:00:53 +0000 (18:00 +0100)
SkeinPyPy/fabmetheus_utilities/geometry/solids/triangle_mesh.py

index a738c41f999805ca18d88cc5fb117f7f50cabc73..9bf210d457f1e28eb13362ae4d7f4442e994996e 100644 (file)
@@ -441,11 +441,18 @@ def getLoopsFromCorrectMesh( edges, faces, vertexes, z ):
        loops = []
        while isPathAdded( edges, faces, loops, remainingEdgeTable, vertexes, z ):
                pass
-       if euclidean.isLoopListIntersecting(loops):
-               print('Warning, the triangle mesh slice intersects itself in getLoopsFromCorrectMesh in triangle_mesh.')
-               print('Something will still be printed, but there is no guarantee that it will be the correct shape.')
-               print('Once the gcode is saved, you should check over the layer with a z of:')
-               print(z)
+       
+       warning = False
+       for idx in xrange(0, len(loops)-1):
+               loop = loops[idx]
+               p0 = loop[-1]
+               for p1 in loop:
+                       if euclidean.isLineIntersectingLoops(loops[idx+1:], p0, p1):
+                               print('Warning, the triangle mesh slice intersects itself in getLoopsFromCorrectMesh in triangle_mesh.')
+                               print('Model error(intersect): (%f, %f, %f) (%f, %f, %f)' % (p0.real, p0.imag, z, p1.real, p1.imag, z))
+                               warning = True
+                       p0 = p1
+       if warning:
                return []
        return loops
 #      untouchables = []