Esempio n. 1
0
 def addCoolOrbits(self, remainingOrbitTime):
     "Add the minimum radius cool orbits."
     if len(self.boundaryLayer.loops) < 1:
         return
     insetBoundaryLoops = intercircle.getInsetLoopsFromLoops(
         self.perimeterWidth, self.boundaryLayer.loops)
     if len(insetBoundaryLoops) < 1:
         insetBoundaryLoops = self.boundaryLayer.loops
     largestLoop = euclidean.getLargestLoop(insetBoundaryLoops)
     loopArea = abs(euclidean.getPolygonArea(largestLoop))
     if loopArea < self.minimumArea:
         center = 0.5 * (euclidean.getMaximumFromPoints(largestLoop) +
                         euclidean.getMinimumFromPoints(largestLoop))
         centerXBounded = max(center.real,
                              self.boundingRectangle.cornerMinimum.real)
         centerXBounded = min(centerXBounded,
                              self.boundingRectangle.cornerMaximum.real)
         centerYBounded = max(center.imag,
                              self.boundingRectangle.cornerMinimum.imag)
         centerYBounded = min(centerYBounded,
                              self.boundingRectangle.cornerMaximum.imag)
         center = complex(centerXBounded, centerYBounded)
         maximumCorner = center + self.halfCorner
         minimumCorner = center - self.halfCorner
         largestLoop = euclidean.getSquareLoop(minimumCorner, maximumCorner)
     pointComplex = euclidean.getXYComplexFromVector3(self.oldLocation)
     if pointComplex != None:
         largestLoop = euclidean.getLoopStartingNearest(
             self.perimeterWidth, pointComplex, largestLoop)
     intercircle.addOrbitsIfLarge(self.distanceFeedRate, largestLoop,
                                  self.orbitalFeedRatePerSecond,
                                  remainingOrbitTime, self.highestZ)
Esempio n. 2
0
def getLargestCenterOutsetLoopFromLoop( loop, radius, thresholdRatio = 0.9 ):
	"Get the largest circle outset loop from the loop."
	radius = abs(radius)
	slightlyGreaterThanRadius = 1.01 * radius
	points = getPointsFromLoop( loop, slightlyGreaterThanRadius, thresholdRatio )
	centers = getCentersFromPoints( points, radius )
	largestCenterOutset = None
	largestOutsetArea = - 999999999.0
	for center in centers:
		outset = getSimplifiedInsetFromClockwiseLoop( center, radius )
		if isLargeSameDirection( outset, center, radius ):
			if euclidean.isPathInsideLoop( loop, outset ) != euclidean.isWiddershins(loop):
				centerOutset = CenterOutset( center, outset )
				outsetArea = abs( euclidean.getPolygonArea( outset ) )
				if outsetArea > largestOutsetArea:
					outsetArea = largestOutsetArea
					largestCenterOutset = centerOutset
	if largestCenterOutset == None:
		return None
	largestCenterOutset.center = euclidean.getSimplifiedLoop( largestCenterOutset.center, radius )
	return largestCenterOutset
Esempio n. 3
0
	def addCoolOrbits( self, remainingOrbitTime ):
		"Add the minimum radius cool orbits."
		if len( self.boundaryLayer.loops ) < 1:
			return
		insetBoundaryLoops = intercircle.getInsetLoopsFromLoops( self.perimeterWidth, self.boundaryLayer.loops )
		if len( insetBoundaryLoops ) < 1:
			insetBoundaryLoops = self.boundaryLayer.loops
		largestLoop = euclidean.getLargestLoop( insetBoundaryLoops )
		loopArea = abs( euclidean.getPolygonArea( largestLoop ) )
		if loopArea < self.minimumArea:
			center = 0.5 * ( euclidean.getMaximumFromPoints( largestLoop ) + euclidean.getMinimumFromPoints( largestLoop ) )
			centerXBounded = max( center.real, self.boundingRectangle.cornerMinimum.real )
			centerXBounded = min( centerXBounded, self.boundingRectangle.cornerMaximum.real )
			centerYBounded = max( center.imag, self.boundingRectangle.cornerMinimum.imag )
			centerYBounded = min( centerYBounded, self.boundingRectangle.cornerMaximum.imag )
			center = complex( centerXBounded, centerYBounded )
			maximumCorner = center + self.halfCorner
			minimumCorner = center - self.halfCorner
			largestLoop = euclidean.getSquareLoop( minimumCorner, maximumCorner )
		pointComplex = euclidean.getXYComplexFromVector3( self.oldLocation )
		if pointComplex != None:
			largestLoop = euclidean.getLoopStartingNearest( self.perimeterWidth, pointComplex, largestLoop )
		intercircle.addOrbitsIfLarge( self.distanceFeedRate, largestLoop, self.orbitalFeedRatePerSecond, remainingOrbitTime, self.highestZ )
Esempio n. 4
0
	def __init__( self, loop ):
		self.area = abs( euclidean.getPolygonArea( loop ) )
		self.loop = loop
Esempio n. 5
0
 def __init__(self, loop):
     self.area = abs(euclidean.getPolygonArea(loop))
     self.loop = loop