def addSegmentTableLoops( self, boundaryLayerIndex ): "Add the segment tables and loops to the boundary." boundaryLayer = self.boundaryLayers[ boundaryLayerIndex ] euclidean.subtractXIntersectionsTable( boundaryLayer.outerHorizontalTable, boundaryLayer.innerHorizontalTable ) euclidean.subtractXIntersectionsTable( boundaryLayer.outerVerticalTable, boundaryLayer.innerVerticalTable ) boundaryLayer.horizontalSegmentTable = self.getHorizontalSegmentTableForXIntersectionsTable( boundaryLayer.outerHorizontalTable ) boundaryLayer.verticalSegmentTable = self.getVerticalSegmentTableForXIntersectionsTable( boundaryLayer.outerVerticalTable ) innerHorizontalSegmentTable = self.getHorizontalSegmentTableForXIntersectionsTable( boundaryLayer.innerHorizontalTable ) innerVerticalSegmentTable = self.getVerticalSegmentTableForXIntersectionsTable( boundaryLayer.innerVerticalTable ) betweenPoints = getPointsFromSegmentTable( boundaryLayer.horizontalSegmentTable ) betweenPoints += getPointsFromSegmentTable( boundaryLayer.verticalSegmentTable ) innerPoints = getPointsFromSegmentTable( innerHorizontalSegmentTable ) innerPoints += getPointsFromSegmentTable( innerVerticalSegmentTable ) innerPointTable = {} for innerPoint in innerPoints: innerPointTable[ innerPoint ] = None boundaryLayer.innerLoops = [] boundaryLayer.outerLoops = [] millRadius = 0.75 * self.millWidth loops = trianglemesh.getDescendingAreaLoops(betweenPoints, betweenPoints, millRadius) for loop in loops: if isPointOfTableInLoop( loop, innerPointTable ): boundaryLayer.innerLoops.append(loop) else: boundaryLayer.outerLoops.append(loop) if self.repository.crossHatch.value and boundaryLayerIndex % 2 == 1: boundaryLayer.segmentTable = boundaryLayer.verticalSegmentTable else: boundaryLayer.segmentTable = boundaryLayer.horizontalSegmentTable
def getLoopsIntersectionByPair( importRadius, loopsFirst, loopsLast ): "Get intersection loops for a pair of loop lists." radiusSide = 0.01 * importRadius corners = getLoopsListsIntersections( [ loopsFirst, loopsLast ] ) corners += getInsetPointsByInsetLoops( loopsFirst, True, loopsLast, radiusSide ) corners += getInsetPointsByInsetLoops( loopsLast, True, loopsFirst, radiusSide ) allPoints = corners[:] allPoints += getInsetPointsByInsetLoops( getInBetweenLoopsFromLoops( importRadius, loopsFirst ), True, loopsLast, radiusSide ) allPoints += getInsetPointsByInsetLoops( getInBetweenLoopsFromLoops( importRadius, loopsLast ), True, loopsFirst, radiusSide ) return trianglemesh.getDescendingAreaLoops(allPoints, corners, importRadius)
def getLoopsIntersectionByPair(importRadius, loopsFirst, loopsLast): 'Get intersection loops for a pair of loop lists.' halfImportRadius = 0.5 * importRadius # so that there are no misses on shallow angles radiusSide = 0.01 * importRadius corners = [] corners += getInsetPointsByInsetLoops(loopsFirst, True, loopsLast, radiusSide) corners += getInsetPointsByInsetLoops(loopsLast, True, loopsFirst, radiusSide) allPoints = corners[:] allPoints += getInsetPointsByInsetLoops(getInBetweenLoopsFromLoops(loopsFirst, halfImportRadius), True, loopsLast, radiusSide) allPoints += getInsetPointsByInsetLoops(getInBetweenLoopsFromLoops(loopsLast, halfImportRadius), True, loopsFirst, radiusSide) return trianglemesh.getDescendingAreaLoops(allPoints, corners, importRadius)
def getLoopsUnified( importRadius, loopLists ): "Get joined loops sliced through shape." allPoints = [] corners = getLoopsListsIntersections(loopLists) radiusSide = 0.01 * importRadius intercircle.directLoopLists( True, loopLists ) for loopListIndex in xrange( len(loopLists) ): insetLoops = loopLists[ loopListIndex ] inBetweenInsetLoops = getInBetweenLoopsFromLoops( importRadius, insetLoops ) otherLoops = euclidean.getConcatenatedList( loopLists[ : loopListIndex ] + loopLists[ loopListIndex + 1 : ] ) corners += getInsetPointsByInsetLoops( insetLoops, False, otherLoops, radiusSide ) allPoints += getInsetPointsByInsetLoops( inBetweenInsetLoops, False, otherLoops, radiusSide ) allPoints += corners[:] return trianglemesh.getDescendingAreaLoops(allPoints, corners, importRadius)
def getLoopsDifference(importRadius, loopLists): "Get difference loops." negativeLoops = getLoopsUnified(importRadius, loopLists[1 :]) intercircle.directLoops(False, negativeLoops) positiveLoops = loopLists[0] intercircle.directLoops(True, positiveLoops) radiusSide = 0.01 * importRadius corners = getLoopsListsIntersections(loopLists) corners += getInsetPointsByInsetLoops(negativeLoops, True, positiveLoops, radiusSide) corners += getInsetPointsByInsetLoops(positiveLoops, False, negativeLoops, radiusSide) allPoints = corners[:] allPoints += getInsetPointsByInsetLoops(getInBetweenLoopsFromLoops(importRadius, negativeLoops), True, positiveLoops, radiusSide) allPoints += getInsetPointsByInsetLoops(getInBetweenLoopsFromLoops(importRadius, positiveLoops), False, negativeLoops, radiusSide) return trianglemesh.getDescendingAreaLoops( allPoints, corners, importRadius)
def getLoopsDifference(importRadius, loopLists): 'Get difference loops.' halfImportRadius = 0.5 * importRadius # so that there are no misses on shallow angles radiusSide = 0.01 * importRadius negativeLoops = getLoopsUnified(importRadius, loopLists[1 :]) intercircle.directLoops(False, negativeLoops) positiveLoops = loopLists[0] intercircle.directLoops(True, positiveLoops) corners = getInsetPointsByInsetLoops(negativeLoops, True, positiveLoops, radiusSide) corners += getInsetPointsByInsetLoops(positiveLoops, False, negativeLoops, radiusSide) allPoints = corners[:] allPoints += getInsetPointsByInsetLoops(getInBetweenLoopsFromLoops(negativeLoops, halfImportRadius), True, positiveLoops, radiusSide) allPoints += getInsetPointsByInsetLoops(getInBetweenLoopsFromLoops(positiveLoops, halfImportRadius), False, negativeLoops, radiusSide) return trianglemesh.getDescendingAreaLoops(allPoints, corners, importRadius)
def getLoopsIntersectionByPair(importRadius, loopsFirst, loopsLast): "Get intersection loops for a pair of loop lists." halfImportRadius = 0.5 * importRadius # so that there are no misses on shallow angles radiusSide = 0.01 * importRadius corners = [] corners += getInsetPointsByInsetLoops(loopsFirst, True, loopsLast, radiusSide) corners += getInsetPointsByInsetLoops(loopsLast, True, loopsFirst, radiusSide) allPoints = corners[:] allPoints += getInsetPointsByInsetLoops( getInBetweenLoopsFromLoops(loopsFirst, halfImportRadius), True, loopsLast, radiusSide ) allPoints += getInsetPointsByInsetLoops( getInBetweenLoopsFromLoops(loopsLast, halfImportRadius), True, loopsFirst, radiusSide ) return trianglemesh.getDescendingAreaLoops(allPoints, corners, importRadius)
def getLoopsUnified(importRadius, loopLists): 'Get joined loops sliced through shape.' allPoints = [] corners = getLoopsListsIntersections(loopLists) radiusSide = 0.01 * importRadius radiusSideNegative = -radiusSide intercircle.directLoopLists(True, loopLists) for loopListIndex in xrange(len(loopLists)): insetLoops = loopLists[ loopListIndex ] inBetweenInsetLoops = getInBetweenLoopsFromLoops(insetLoops, importRadius) otherLoops = euclidean.getConcatenatedList(loopLists[: loopListIndex] + loopLists[loopListIndex + 1 :]) corners += getInsetPointsByInsetLoops(insetLoops, False, otherLoops, radiusSide) allPoints += getInsetPointsByInsetLoops(inBetweenInsetLoops, False, otherLoops, radiusSideNegative) allPoints += corners[:] return trianglemesh.getDescendingAreaLoops(allPoints, corners, importRadius)
def getLoopsIntersectionByPair(importRadius, loopsFirst, loopsLast): "Get intersection loops for a pair of loop lists." radiusSide = 0.01 * importRadius corners = getLoopsListsIntersections([loopsFirst, loopsLast]) corners += getInsetPointsByInsetLoops(loopsFirst, True, loopsLast, radiusSide) corners += getInsetPointsByInsetLoops(loopsLast, True, loopsFirst, radiusSide) allPoints = corners[:] allPoints += getInsetPointsByInsetLoops( getInBetweenLoopsFromLoops(importRadius, loopsFirst), True, loopsLast, radiusSide) allPoints += getInsetPointsByInsetLoops( getInBetweenLoopsFromLoops(importRadius, loopsLast), True, loopsFirst, radiusSide) return trianglemesh.getDescendingAreaLoops(allPoints, corners, importRadius)
def getLoopsDifference(importRadius, loopLists): "Get difference loops." halfImportRadius = 0.5 * importRadius # so that there are no misses on shallow angles radiusSide = 0.01 * importRadius negativeLoops = getLoopsUnified(importRadius, loopLists[1:]) intercircle.directLoops(False, negativeLoops) positiveLoops = loopLists[0] intercircle.directLoops(True, positiveLoops) corners = getInsetPointsByInsetLoops(negativeLoops, True, positiveLoops, radiusSide) corners += getInsetPointsByInsetLoops(positiveLoops, False, negativeLoops, radiusSide) allPoints = corners[:] allPoints += getInsetPointsByInsetLoops( getInBetweenLoopsFromLoops(negativeLoops, halfImportRadius), True, positiveLoops, radiusSide ) allPoints += getInsetPointsByInsetLoops( getInBetweenLoopsFromLoops(positiveLoops, halfImportRadius), False, negativeLoops, radiusSide ) return trianglemesh.getDescendingAreaLoops(allPoints, corners, importRadius)
def getLoopsDifference(importRadius, loopLists): "Get difference loops." negativeLoops = getLoopsUnified(importRadius, loopLists[1:]) intercircle.directLoops(False, negativeLoops) positiveLoops = loopLists[0] intercircle.directLoops(True, positiveLoops) radiusSide = 0.01 * importRadius corners = getLoopsListsIntersections(loopLists) corners += getInsetPointsByInsetLoops(negativeLoops, True, positiveLoops, radiusSide) corners += getInsetPointsByInsetLoops(positiveLoops, False, negativeLoops, radiusSide) allPoints = corners[:] allPoints += getInsetPointsByInsetLoops( getInBetweenLoopsFromLoops(importRadius, negativeLoops), True, positiveLoops, radiusSide) allPoints += getInsetPointsByInsetLoops( getInBetweenLoopsFromLoops(importRadius, positiveLoops), False, negativeLoops, radiusSide) return trianglemesh.getDescendingAreaLoops(allPoints, corners, importRadius)