Beispiel #1
0
	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.getInclusiveLoops( betweenPoints, betweenPoints, millRadius )
		loops = euclidean.getSimplifiedLoops( loops, 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
Beispiel #2
0
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.getInclusiveLoops( allPoints, corners, importRadius, True )
Beispiel #3
0
def getLoopsUnified( importRadius, loopLists ):
	"Get joined loops sliced through shape."
	allPoints = []
	corners = getLoopsListsIntersections( loopLists )
	radiusSide = 0.01 * importRadius
	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.getInclusiveLoops( allPoints, corners, importRadius, True )
Beispiel #4
0
def getLoopsDifference( importRadius, loopLists ):
	"Get difference loops."
	negativeLoops = getLoopsUnified( importRadius, loopLists[ 1 : ] )
	directLoops( False, negativeLoops )
	positiveLoops = loopLists[0]
	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.getInclusiveLoops( allPoints, corners, importRadius, True )
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.getInclusiveLoops(allPoints, corners, importRadius,
                                          True)
def getLoopsUnified(importRadius, loopLists):
    "Get joined loops sliced through shape."
    allPoints = []
    corners = getLoopsListsIntersections(loopLists)
    radiusSide = 0.01 * importRadius
    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.getInclusiveLoops(allPoints, corners, importRadius,
                                          True)
def getLoopsDifference(importRadius, loopLists):
    "Get difference loops."
    negativeLoops = getLoopsUnified(importRadius, loopLists[1:])
    directLoops(False, negativeLoops)
    positiveLoops = loopLists[0]
    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.getInclusiveLoops(allPoints, corners, importRadius,
                                          True)