示例#1
0
	def getConnectionIsCloseWithoutOverlap( self, location, path ):
		"Determine if the connection is close enough and does not overlap another thread."
		if len( path ) < 1:
			return False
		locationComplex = location.dropAxis( 2 )
		segment = locationComplex - path[ - 1 ]
		segmentLength = abs( segment )
		if segmentLength <= 0.0:
			return True
		segment /= segmentLength
		distance = self.connectingStepLength
		segmentEndLength = segmentLength - self.connectingStepLength
		while distance < segmentEndLength:
			alongPoint = distance * segment + path[ - 1 ]
			if not euclidean.isPointInsideLoops( self.boundaryLoops, alongPoint ):
				return False
			distance += self.connectingStepLength
		removedLayerPixelTable = self.layerPixelTable.copy()
		if self.oldLocation in self.maskPixelTableTable:
			euclidean.removePixelTableFromPixelTable( self.maskPixelTableTable[ self.oldLocation ], removedLayerPixelTable )
		euclidean.addPathToPixelTable( path[ : - 2 ], removedLayerPixelTable, None, self.layerPixelWidth )
		segmentTable = {}
		euclidean.addValueSegmentToPixelTable( path[ - 1 ], locationComplex, segmentTable, None, self.layerPixelWidth )
		maskPixelTable = {}
		if location in self.maskPixelTableTable:
			maskPixelTable = self.maskPixelTableTable[ location ]
		if euclidean.isPixelTableIntersecting( removedLayerPixelTable, segmentTable, maskPixelTable ):
			return False
		euclidean.addPixelTableToPixelTable( segmentTable, self.layerPixelTable )
		return True
示例#2
0
	def addSegmentToPixelTables( self, location, maskPixelTable, oldLocation ):
		"Add the segment to the layer and mask table."
		segmentTable = {}
		euclidean.addValueSegmentToPixelTable( oldLocation.dropAxis( 2 ), location.dropAxis( 2 ), segmentTable, None, self.layerPixelWidth )
		euclidean.addPixelTableToPixelTable( segmentTable, self.layerPixelTable )
		euclidean.addPixelTableToPixelTable( segmentTable, maskPixelTable )
		self.maskPixelTableTable[ location ] = maskPixelTable
		self.maskPixelTableTable[ oldLocation ] = maskPixelTable
示例#3
0
 def addSegmentToPixelTables(self, location, maskPixelTable, oldLocation):
     "Add the segment to the layer and mask table."
     segmentTable = {}
     euclidean.addValueSegmentToPixelTable(oldLocation.dropAxis(2),
                                           location.dropAxis(2),
                                           segmentTable, None,
                                           self.layerPixelWidth)
     euclidean.addPixelTableToPixelTable(segmentTable, self.layerPixelTable)
     euclidean.addPixelTableToPixelTable(segmentTable, maskPixelTable)
     self.maskPixelTableTable[location] = maskPixelTable
     self.maskPixelTableTable[oldLocation] = maskPixelTable
示例#4
0
 def getConnectionIsCloseWithoutOverlap(self, location, path):
     "Determine if the connection is close enough and does not overlap another thread."
     if len(path) < 1:
         return False
     locationComplex = location.dropAxis(2)
     segment = locationComplex - path[-1]
     segmentLength = abs(segment)
     if segmentLength <= 0.0:
         return True
     segment /= segmentLength
     distance = self.connectingStepLength
     segmentEndLength = segmentLength - self.connectingStepLength
     while distance < segmentEndLength:
         alongPoint = distance * segment + path[-1]
         if not euclidean.isPointInsideLoops(self.boundaryLoops,
                                             alongPoint):
             return False
         distance += self.connectingStepLength
     removedLayerPixelTable = self.layerPixelTable.copy()
     if self.oldLocation in self.maskPixelTableTable:
         euclidean.removePixelTableFromPixelTable(
             self.maskPixelTableTable[self.oldLocation],
             removedLayerPixelTable)
     euclidean.addPathToPixelTable(path[:-2], removedLayerPixelTable, None,
                                   self.layerPixelWidth)
     segmentTable = {}
     euclidean.addValueSegmentToPixelTable(path[-1], locationComplex,
                                           segmentTable, None,
                                           self.layerPixelWidth)
     maskPixelTable = {}
     if location in self.maskPixelTableTable:
         maskPixelTable = self.maskPixelTableTable[location]
     if euclidean.isPixelTableIntersecting(removedLayerPixelTable,
                                           segmentTable, maskPixelTable):
         return False
     euclidean.addPixelTableToPixelTable(segmentTable, self.layerPixelTable)
     return True