From 3ca5462fb8877710059aa4bb26dbd87c706de903 Mon Sep 17 00:00:00 2001 From: daid Date: Tue, 20 Mar 2012 18:00:53 +0100 Subject: [PATCH] Change the way intersection warnings are reported, so we actually know where they happened and so we can show them. --- .../geometry/solids/triangle_mesh.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/SkeinPyPy/fabmetheus_utilities/geometry/solids/triangle_mesh.py b/SkeinPyPy/fabmetheus_utilities/geometry/solids/triangle_mesh.py index a738c41f..9bf210d4 100644 --- a/SkeinPyPy/fabmetheus_utilities/geometry/solids/triangle_mesh.py +++ b/SkeinPyPy/fabmetheus_utilities/geometry/solids/triangle_mesh.py @@ -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 = [] -- 2.30.2