def getIsIntersectingWithinList( loop, loopList ): "Determine if the loop is intersecting or is within the loop list." leftPoint = euclidean.getLeftPoint( loop ) for otherLoop in loopList: if euclidean.getNumberOfIntersectionsToLeft( otherLoop, leftPoint ) % 2 == 1: return True return euclidean.isLoopIntersectingLoops( loop, loopList )
def isIntersectingWithinList( loop, loopList ): "Determine if the loop is intersecting or is within the loop list." if euclidean.isLoopIntersectingLoops( loop, loopList ): return True totalNumberOfIntersections = 0 for otherLoop in loopList: leftPoint = euclidean.getLeftPoint( otherLoop ) totalNumberOfIntersections += euclidean.getNumberOfIntersectionsToLeft( leftPoint, loop ) return totalNumberOfIntersections % 2 == 1
def isIntersectingWithinList(loop, loopList): "Determine if the loop is intersecting or is within the loop list." if euclidean.isLoopIntersectingLoops(loop, loopList): return True totalNumberOfIntersections = 0 for otherLoop in loopList: leftPoint = euclidean.getLeftPoint(otherLoop) totalNumberOfIntersections += euclidean.getNumberOfIntersectionsToLeft( leftPoint, loop) return totalNumberOfIntersections % 2 == 1
def getLoopsFromCorrectMesh( edges, faces, vertices, z ): "Get loops from a carve of a correct mesh." remainingEdgeTable = getRemainingEdgeTable( edges, vertices, z ) remainingValues = remainingEdgeTable.values() for edge in remainingValues: if len( edge.faceIndexes ) < 2: print( 'This should never happen, there is a hole in the triangle mesh, each edge should have two faces.' ) print( edge ) 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 ) return [] loops = [] while isPathAdded( edges, faces, loops, remainingEdgeTable, vertices, z ): pass for loopIndex in xrange( len( loops ) - 1 ): loop = loops[ loopIndex ] if euclidean.isLoopIntersectingLoops( loop, loops[ loopIndex + 1 : ] ): print( 'This should never happen, the triangle mesh slice intersects itself.' ) 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 ) return [] return loops