Beispiel #1
0
	def addSupportSegmentTable( self, layerIndex ):
		"Add support segments from the boundary layers."
		aboveLayer = self.boundaryLayers[ layerIndex + 1 ]
		if len( aboveLayer.loops ) < 1:
			self.supportSegmentTables.append( {} )
			return
		aboveLoops = self.supportLoops[ layerIndex + 1 ]
		horizontalSegmentTable = {}
		rise = aboveLayer.z - self.boundaryLayers[ layerIndex ].z
		outsetSupportLayer = intercircle.getInsetLoops( - self.minimumSupportRatio * rise, self.supportLoops[ layerIndex ] )
		numberOfSubSteps = 10
		subStepSize = self.interfaceStep / float( numberOfSubSteps )
		for y in self.interfaceStepsUntilEnd:
			xTotalIntersectionIndexList = []
			for subStepIndex in xrange( 2 * numberOfSubSteps + 1 ):
				ySubStep = y + ( subStepIndex - numberOfSubSteps ) * subStepSize
				xIntersectionIndexList = []
				euclidean.addXIntersectionIndexesFromLoops( aboveLoops, - 1, xIntersectionIndexList, ySubStep )
				euclidean.addXIntersectionIndexesFromLoops( outsetSupportLayer, 0, xIntersectionIndexList, ySubStep )
				xIntersections = euclidean.getXIntersectionsFromIntersections( xIntersectionIndexList )
				for xIntersection in xIntersections:
					xTotalIntersectionIndexList.append( euclidean.XIntersectionIndex( subStepIndex, xIntersection ) )
			xTotalIntersections = getJoinOfXIntersectionIndexes( xTotalIntersectionIndexList )
			lineSegments = euclidean.getSegmentsFromXIntersections( xTotalIntersections, y )
			if len( lineSegments ) > 0:
				horizontalSegmentTable[ y ] = lineSegments
		self.supportSegmentTables.append( horizontalSegmentTable )
Beispiel #2
0
	def extendSegments( self, loops, radius, supportSegmentTableIndex ):
		"Extend the support segments."
		supportSegmentTable = self.supportSegmentTables[ supportSegmentTableIndex ]
		supportLayerKeys = supportSegmentTable.keys()
		horizontalSegmentSegmentTable = {}
		for supportLayerKey in supportLayerKeys:
			lineSegments = supportSegmentTable[ supportLayerKey ]
			xIntersectionIndexList = []
			loopXIntersections = []
			euclidean.addXIntersectionsFromLoops( loops, loopXIntersections, supportLayerKey )
			for lineSegmentIndex in xrange( len( lineSegments ) ):
				lineSegment = lineSegments[ lineSegmentIndex ]
				extendedLineSegment = getExtendedLineSegment( radius, lineSegment, loopXIntersections )
				if extendedLineSegment != None:
					addXIntersectionsFromSegment( lineSegmentIndex, extendedLineSegment, xIntersectionIndexList )
			xIntersections = getJoinOfXIntersectionIndexes( xIntersectionIndexList )
			for xIntersectionIndex in xrange( len( xIntersections ) ):
				xIntersection = xIntersections[ xIntersectionIndex ]
				xIntersection = max( xIntersection, self.interfaceBeginX )
				xIntersection = min( xIntersection, self.interfaceEndX )
				xIntersections[ xIntersectionIndex ] = xIntersection
			if len( xIntersections ) > 0:
				extendedLineSegments = euclidean.getSegmentsFromXIntersections( xIntersections, supportLayerKey )
				supportSegmentTable[ supportLayerKey ] = extendedLineSegments
			else:
				del supportSegmentTable[ supportLayerKey ]
Beispiel #3
0
	def getHorizontalSegmentTableForXIntersectionsTable( self, xIntersectionsTable ):
		"Get the horizontal segment table from the xIntersectionsTable."
		horizontalSegmentTable = {}
		xIntersectionsTableKeys = xIntersectionsTable.keys()
		xIntersectionsTableKeys.sort()
		for xIntersectionsTableKey in xIntersectionsTableKeys:
			xIntersections = xIntersectionsTable[ xIntersectionsTableKey ]
			segments = euclidean.getSegmentsFromXIntersections( xIntersections, xIntersectionsTableKey * self.millWidth )
			horizontalSegmentTable[ xIntersectionsTableKey ] = segments
		return horizontalSegmentTable
Beispiel #4
0
 def getHorizontalSegmentTableForXIntersectionsTable(
         self, xIntersectionsTable):
     "Get the horizontal segment table from the xIntersectionsTable."
     horizontalSegmentTable = {}
     xIntersectionsTableKeys = xIntersectionsTable.keys()
     xIntersectionsTableKeys.sort()
     for xIntersectionsTableKey in xIntersectionsTableKeys:
         xIntersections = xIntersectionsTable[xIntersectionsTableKey]
         segments = euclidean.getSegmentsFromXIntersections(
             xIntersections, xIntersectionsTableKey * self.millWidth)
         horizontalSegmentTable[xIntersectionsTableKey] = segments
     return horizontalSegmentTable
Beispiel #5
0
	def getVerticalSegmentTableForXIntersectionsTable( self, xIntersectionsTable ):
		"Get the vertical segment table from the xIntersectionsTable which has the x and y swapped."
		verticalSegmentTable = {}
		xIntersectionsTableKeys = xIntersectionsTable.keys()
		xIntersectionsTableKeys.sort()
		for xIntersectionsTableKey in xIntersectionsTableKeys:
			xIntersections = xIntersectionsTable[ xIntersectionsTableKey ]
			segments = euclidean.getSegmentsFromXIntersections( xIntersections, xIntersectionsTableKey * self.millWidth )
			for segment in segments:
				for endpoint in segment:
					endpoint.point = complex( endpoint.point.imag, endpoint.point.real )
			verticalSegmentTable[ xIntersectionsTableKey ] = segments
		return verticalSegmentTable
Beispiel #6
0
	def addToFillXIntersectionIndexTables( self, fillXIntersectionIndexTables, layerIndex ):
		"Add fill segments from the boundary layers."
		supportLoops = self.supportLoops[ layerIndex ]
		if len( supportLoops ) < 1:
			fillXIntersectionIndexTables.append( {} )
			return
		fillXIntersectionIndexTable = {}
		for y in self.interfaceStepsUntilEnd:
			xIntersectionIndexes = getFillXIntersectionIndexes( supportLoops, y )
			if len( xIntersectionIndexes ) > 0:
				xIntersections = getJoinOfXIntersectionIndexes( xIntersectionIndexes )
				lineSegments = euclidean.getSegmentsFromXIntersections( xIntersections, y )
				fillXIntersectionIndexTable[ y ] = lineSegments
		fillXIntersectionIndexTables.append( fillXIntersectionIndexTable )
Beispiel #7
0
 def getVerticalSegmentTableForXIntersectionsTable(self,
                                                   xIntersectionsTable):
     "Get the vertical segment table from the xIntersectionsTable which has the x and y swapped."
     verticalSegmentTable = {}
     xIntersectionsTableKeys = xIntersectionsTable.keys()
     xIntersectionsTableKeys.sort()
     for xIntersectionsTableKey in xIntersectionsTableKeys:
         xIntersections = xIntersectionsTable[xIntersectionsTableKey]
         segments = euclidean.getSegmentsFromXIntersections(
             xIntersections, xIntersectionsTableKey * self.millWidth)
         for segment in segments:
             for endpoint in segment:
                 endpoint.point = complex(endpoint.point.imag,
                                          endpoint.point.real)
         verticalSegmentTable[xIntersectionsTableKey] = segments
     return verticalSegmentTable
Beispiel #8
0
	def extendSegments( self, supportSegmentTable ):
		"Extend the support segments."
		supportLayerKeys = supportSegmentTable.keys()
		horizontalSegmentSegmentTable = {}
		for supportLayerKey in supportLayerKeys:
			lineSegments = supportSegmentTable[ supportLayerKey ]
			xIntersectionIndexList = []
			for lineSegmentIndex in xrange( len( lineSegments ) ):
				lineSegment = lineSegments[ lineSegmentIndex ]
				extendedLineSegment = getExtendedLineSegment( self.raftOutsetRadius, lineSegment )
				if extendedLineSegment != None:
					addXIntersectionsFromSegment( lineSegmentIndex, extendedLineSegment, xIntersectionIndexList )
			xIntersections = getJoinOfXIntersectionIndexes( xIntersectionIndexList )
			for xIntersectionIndex in xrange( len( xIntersections ) ):
				xIntersection = xIntersections[ xIntersectionIndex ]
				xIntersection = max( xIntersection, self.interfaceBeginX )
				xIntersection = min( xIntersection, self.interfaceEndX )
				xIntersections[ xIntersectionIndex ] = xIntersection
			if len( xIntersections ) > 0:
				extendedLineSegments = euclidean.getSegmentsFromXIntersections( xIntersections, supportLayerKey )
				supportSegmentTable[ supportLayerKey ] = extendedLineSegments
			else:
				del supportSegmentTable[ supportLayerKey ]
Beispiel #9
0
def joinSegmentTables( fromTable, intoTable ):
	"Join both segment tables and put the join into the intoTable."
	intoTableKeys = intoTable.keys()
	fromTableKeys = fromTable.keys()
	joinedKeyTable = {}
	concatenatedSegmentTableKeys = intoTableKeys + fromTableKeys
	for concatenatedSegmentTableKey in concatenatedSegmentTableKeys:
		joinedKeyTable[ concatenatedSegmentTableKey ] = None
	joinedKeys = joinedKeyTable.keys()
	joinedKeys.sort()
	joinedSegmentTable = {}
	for joinedKey in joinedKeys:
		xIntersectionIndexList = []
		if joinedKey in intoTable:
			addXIntersectionsFromSegments( 0, intoTable[ joinedKey ], xIntersectionIndexList )
		if joinedKey in fromTable:
			addXIntersectionsFromSegments( 1, fromTable[ joinedKey ], xIntersectionIndexList )
		xIntersections = getJoinOfXIntersectionIndexes( xIntersectionIndexList )
		lineSegments = euclidean.getSegmentsFromXIntersections( xIntersections, joinedKey )
		if len( lineSegments ) > 0:
			intoTable[ joinedKey ] = lineSegments
		else:
			print( "This should never happen, there are no line segments in joinSegments in raft." )
Beispiel #10
0
	def addToFillXIntersectionIndexTables( self, fillXIntersectionIndexTables, layerIndex ):
		"Add fill segments from the boundary layers."
		supportLoops = self.supportLayers[ layerIndex ]
		if len( supportLoops ) < 1 or len( self.interfaceStepsUntilEnd ) < 1:
			fillXIntersectionIndexTables.append( {} )
			return
		front = self.interfaceStepsUntilEnd[ 0 ]
		width = 987654321.0
		if len( self.interfaceStepsUntilEnd ) > 1:
			width = self.interfaceStepsUntilEnd[ 1 ] - self.interfaceStepsUntilEnd[ 0 ]
		xIntersectionIndexLists = []
		yList = []
		frontOverWidth = euclidean.getFrontOverWidthAddYList( front, len( self.interfaceStepsUntilEnd ), xIntersectionIndexLists, width, yList )
		euclidean.addXIntersectionIndexesFromLoops( frontOverWidth, supportLoops, 0, xIntersectionIndexLists, width, yList )
		fillXIntersectionIndexTable = {}
		for interfaceStepIndex in xrange( len( self.interfaceStepsUntilEnd ) ):
			y = self.interfaceStepsUntilEnd[ interfaceStepIndex ]
			xIntersectionIndexes = xIntersectionIndexLists[ interfaceStepIndex ]
#			xIntersectionIndexes = getFillXIntersectionIndexes( supportLoops, y )
			if len( xIntersectionIndexes ) > 0:
				xIntersections = getJoinOfXIntersectionIndexes( xIntersectionIndexes )
				lineSegments = euclidean.getSegmentsFromXIntersections( xIntersections, y )
				fillXIntersectionIndexTable[ y ] = lineSegments
		fillXIntersectionIndexTables.append( fillXIntersectionIndexTable )