Esempio n. 1
0
	def addGcodeFromRemainingLoop( self, loop, loopLists, radius, z ):
		"Add the remainder of the loop which does not overlap the alreadyFilledArounds loops."
		boundary = intercircle.getLargestInsetLoopFromLoopNoMatterWhat( loop, - radius )
		euclidean.addSurroundingLoopBeginning( self.distanceFeedRate, boundary, z )
		self.addGcodePerimeterBlockFromRemainingLoop( loop, loopLists, radius, z )
		self.distanceFeedRate.addLine( '(</boundaryPerimeter>)' )
		self.distanceFeedRate.addLine( '(</surroundingLoop>)' )
Esempio n. 2
0
	def addGcodeFromRemainingLoop( self, loop, radius, z ):
		"Add the remainder of the loop."
		boundary = intercircle.getLargestInsetLoopFromLoopNoMatterWhat( loop, radius )
		euclidean.addSurroundingLoopBeginning( self.distanceFeedRate, boundary, z )
		self.distanceFeedRate.addPerimeterBlock( loop, z )
		self.distanceFeedRate.addLine( '(</boundaryPerimeter>)' )
		self.distanceFeedRate.addLine( '(</surroundingLoop>)' )
Esempio n. 3
0
 def addGcodeFromRemainingLoop(self, loop, radius, z):
     "Add the remainder of the loop."
     boundary = intercircle.getLargestInsetLoopFromLoopNoMatterWhat(
         loop, radius)
     euclidean.addSurroundingLoopBeginning(self.distanceFeedRate, boundary,
                                           z)
     self.distanceFeedRate.addPerimeterBlock(loop, z)
     self.distanceFeedRate.addLine('(</boundaryPerimeter>)')
     self.distanceFeedRate.addLine('(</surroundingLoop>)')
Esempio n. 4
0
 def addGcodeFromRemainingLoop(self, loop, loopLists, radius, z):
     "Add the remainder of the loop which does not overlap the alreadyFilledArounds loops."
     boundary = intercircle.getLargestInsetLoopFromLoopNoMatterWhat(
         loop, -radius)
     euclidean.addSurroundingLoopBeginning(self.distanceFeedRate, boundary,
                                           z)
     self.addGcodePerimeterBlockFromRemainingLoop(loop, loopLists, radius,
                                                  z)
     self.distanceFeedRate.addLine('(</boundaryPerimeter>)')
     self.distanceFeedRate.addLine('(</surroundingLoop>)')
Esempio n. 5
0
 def getPathBetween(self, betweenFirst, betweenSecond, isLeavingPerimeter,
                    loopFirst):
     "Add a path between the perimeter and the fill."
     loopFirst = intercircle.getLargestInsetLoopFromLoopNoMatterWhat(
         loopFirst, self.combInset)
     nearestFirstDistanceIndex = euclidean.getNearestDistanceIndex(
         betweenFirst, loopFirst)
     nearestSecondDistanceIndex = euclidean.getNearestDistanceIndex(
         betweenSecond, loopFirst)
     firstBeginIndex = (nearestFirstDistanceIndex.index +
                        1) % len(loopFirst)
     secondBeginIndex = (nearestSecondDistanceIndex.index +
                         1) % len(loopFirst)
     nearestFirst = euclidean.getNearestPointOnSegment(
         loopFirst[nearestFirstDistanceIndex.index],
         loopFirst[firstBeginIndex], betweenFirst)
     nearestSecond = euclidean.getNearestPointOnSegment(
         loopFirst[nearestSecondDistanceIndex.index],
         loopFirst[secondBeginIndex], betweenSecond)
     clockwisePath = [nearestFirst]
     widdershinsPath = [nearestFirst]
     loopBeforeLeaving = euclidean.getAroundLoop(firstBeginIndex,
                                                 firstBeginIndex, loopFirst)
     if nearestFirstDistanceIndex.index == nearestSecondDistanceIndex.index:
         if euclidean.getPathLength(
                 widdershinsPath) < self.minimumDepartureDistance:
             widdershinsPath = [nearestFirst] + loopBeforeLeaving
             reversedLoop = loopBeforeLeaving[:]
             reversedLoop.reverse()
             clockwisePath = [nearestFirst] + reversedLoop
     else:
         widdershinsLoop = euclidean.getAroundLoop(firstBeginIndex,
                                                   secondBeginIndex,
                                                   loopFirst)
         widdershinsPath += widdershinsLoop
         clockwiseLoop = euclidean.getAroundLoop(secondBeginIndex,
                                                 firstBeginIndex, loopFirst)
         clockwiseLoop.reverse()
         clockwisePath += clockwiseLoop
     clockwisePath.append(nearestSecond)
     widdershinsPath.append(nearestSecond)
     if euclidean.getPathLength(widdershinsPath) > euclidean.getPathLength(
             clockwisePath):
         loopBeforeLeaving.reverse()
         widdershinsPath = clockwisePath
     if isLeavingPerimeter:
         totalDistance = euclidean.getPathLength(widdershinsPath)
         loopLength = euclidean.getPolygonLength(loopBeforeLeaving)
         while totalDistance < self.minimumDepartureDistance:
             widdershinsPath = [nearestFirst
                                ] + loopBeforeLeaving + widdershinsPath[1:]
             totalDistance += loopLength
     return widdershinsPath
Esempio n. 6
0
	def getPathBetween( self, loop, points ):
		"Add a path between the perimeter and the fill."
		paths = getPathsByIntersectedLoop( points[ 1 ], points[ 2 ], loop )
		shortestPath = paths[ int( euclidean.getPathLength( paths[ 1 ] ) < euclidean.getPathLength( paths[ 0 ] ) ) ]
		if not euclidean.isWiddershins( shortestPath ):
			shortestPath.reverse()
		loopAround = intercircle.getLargestInsetLoopFromLoopNoMatterWhat( shortestPath, - self.combInset )
		endMinusBegin = points[ 3 ] - points[ 0 ]
		endMinusBegin = 1.3 * self.combInset * euclidean.getNormalized( endMinusBegin )
		aroundPaths = getPathsByIntersectedLoop( points[ 0 ] - endMinusBegin, points[ 3 ] + endMinusBegin, loopAround )
		insidePath = aroundPaths[ int( getInsideness( aroundPaths[ 1 ], loop ) > getInsideness( aroundPaths[ 0 ], loop ) ) ]
		pathBetween = []
		for point in insidePath:
			if euclidean.isPointInsideLoop( loop, point ):
				pathBetween.append(point )
		return pathBetween
Esempio n. 7
0
 def addRunningJumpPath(self, end, loop, pathAround):
     "Get the running jump path from the perimeter to the intersection or running jump space."
     if self.combRepository.runningJumpSpaceOverPerimeterWidth.value < 1.0:
         return
     if len(pathAround) < 2:
         return
     loop = intercircle.getLargestInsetLoopFromLoopNoMatterWhat(
         loop, self.combInset)
     penultimatePoint = pathAround[-2]
     lastPoint = pathAround[-1]
     nearestEndDistanceIndex = euclidean.getNearestDistanceIndex(end, loop)
     nearestEndIndex = (nearestEndDistanceIndex.index + 1) % len(loop)
     nearestEnd = euclidean.getNearestPointOnSegment(
         loop[nearestEndDistanceIndex.index], loop[nearestEndIndex], end)
     nearestEndMinusLast = nearestEnd - lastPoint
     nearestEndMinusLastLength = abs(nearestEndMinusLast)
     if nearestEndMinusLastLength <= 0.0:
         return
     nearestEndMinusLastSegment = nearestEndMinusLast / nearestEndMinusLastLength
     betweens = self.getBetweens()
     if self.getIsRunningJumpPathAdded(betweens, end, lastPoint,
                                       nearestEndMinusLastSegment,
                                       pathAround, penultimatePoint,
                                       self.runningJumpSpace):
         return
     doubleCombInset = 2.0 * self.combInset
     shortJumpSpace = 0.5 * self.runningJumpSpace
     if shortJumpSpace < doubleCombInset:
         return
     if self.getIsRunningJumpPathAdded(betweens, end, lastPoint,
                                       nearestEndMinusLastSegment,
                                       pathAround, penultimatePoint,
                                       shortJumpSpace):
         return
     shortJumpSpace = 0.25 * self.runningJumpSpace
     if shortJumpSpace < doubleCombInset:
         return
     self.getIsRunningJumpPathAdded(betweens, end, lastPoint,
                                    nearestEndMinusLastSegment, pathAround,
                                    penultimatePoint, shortJumpSpace)
Esempio n. 8
0
 def getPathBetween(self, betweenFirst, betweenSecond, isLeavingPerimeter, loopFirst):
     "Add a path between the perimeter and the fill."
     loopFirst = intercircle.getLargestInsetLoopFromLoopNoMatterWhat(loopFirst, self.combInset)
     nearestFirstDistanceIndex = euclidean.getNearestDistanceIndex(betweenFirst, loopFirst)
     nearestSecondDistanceIndex = euclidean.getNearestDistanceIndex(betweenSecond, loopFirst)
     firstBeginIndex = (nearestFirstDistanceIndex.index + 1) % len(loopFirst)
     secondBeginIndex = (nearestSecondDistanceIndex.index + 1) % len(loopFirst)
     nearestFirst = euclidean.getNearestPointOnSegment(
         loopFirst[nearestFirstDistanceIndex.index], loopFirst[firstBeginIndex], betweenFirst
     )
     nearestSecond = euclidean.getNearestPointOnSegment(
         loopFirst[nearestSecondDistanceIndex.index], loopFirst[secondBeginIndex], betweenSecond
     )
     clockwisePath = [nearestFirst]
     widdershinsPath = [nearestFirst]
     loopBeforeLeaving = euclidean.getAroundLoop(firstBeginIndex, firstBeginIndex, loopFirst)
     if nearestFirstDistanceIndex.index == nearestSecondDistanceIndex.index:
         if euclidean.getPathLength(widdershinsPath) < self.minimumDepartureDistance:
             widdershinsPath = [nearestFirst] + loopBeforeLeaving
             reversedLoop = loopBeforeLeaving[:]
             reversedLoop.reverse()
             clockwisePath = [nearestFirst] + reversedLoop
     else:
         widdershinsLoop = euclidean.getAroundLoop(firstBeginIndex, secondBeginIndex, loopFirst)
         widdershinsPath += widdershinsLoop
         clockwiseLoop = euclidean.getAroundLoop(secondBeginIndex, firstBeginIndex, loopFirst)
         clockwiseLoop.reverse()
         clockwisePath += clockwiseLoop
     clockwisePath.append(nearestSecond)
     widdershinsPath.append(nearestSecond)
     if euclidean.getPathLength(widdershinsPath) > euclidean.getPathLength(clockwisePath):
         loopBeforeLeaving.reverse()
         widdershinsPath = clockwisePath
     if isLeavingPerimeter:
         totalDistance = euclidean.getPathLength(widdershinsPath)
         loopLength = euclidean.getPolygonLength(loopBeforeLeaving)
         while totalDistance < self.minimumDepartureDistance:
             widdershinsPath = [nearestFirst] + loopBeforeLeaving + widdershinsPath[1:]
             totalDistance += loopLength
     return widdershinsPath
Esempio n. 9
0
 def getPathBetween(self, loop, points):
     "Add a path between the perimeter and the fill."
     paths = getPathsByIntersectedLoop(points[1], points[2], loop)
     shortestPath = paths[int(
         euclidean.getPathLength(paths[1]) < euclidean.getPathLength(
             paths[0]))]
     if not euclidean.isWiddershins(shortestPath):
         shortestPath.reverse()
     loopAround = intercircle.getLargestInsetLoopFromLoopNoMatterWhat(
         shortestPath, -self.combInset)
     endMinusBegin = points[3] - points[0]
     endMinusBegin = 1.3 * self.combInset * euclidean.getNormalized(
         endMinusBegin)
     aroundPaths = getPathsByIntersectedLoop(points[0] - endMinusBegin,
                                             points[3] + endMinusBegin,
                                             loopAround)
     insidePath = aroundPaths[int(
         getInsideness(aroundPaths[1], loop) > getInsideness(
             aroundPaths[0], loop))]
     pathBetween = []
     for point in insidePath:
         if euclidean.isPointInsideLoop(loop, point):
             pathBetween.append(point)
     return pathBetween
Esempio n. 10
0
 def addRunningJumpPath(self, end, loop, pathAround):
     "Get the running jump path from the perimeter to the intersection or running jump space."
     if self.combRepository.runningJumpSpaceOverPerimeterWidth.value < 1.0:
         return
     if len(pathAround) < 2:
         return
     loop = intercircle.getLargestInsetLoopFromLoopNoMatterWhat(loop, self.combInset)
     penultimatePoint = pathAround[-2]
     lastPoint = pathAround[-1]
     nearestEndDistanceIndex = euclidean.getNearestDistanceIndex(end, loop)
     nearestEndIndex = (nearestEndDistanceIndex.index + 1) % len(loop)
     nearestEnd = euclidean.getNearestPointOnSegment(loop[nearestEndDistanceIndex.index], loop[nearestEndIndex], end)
     nearestEndMinusLast = nearestEnd - lastPoint
     nearestEndMinusLastLength = abs(nearestEndMinusLast)
     if nearestEndMinusLastLength <= 0.0:
         return
     nearestEndMinusLastSegment = nearestEndMinusLast / nearestEndMinusLastLength
     betweens = self.getBetweens()
     if self.getIsRunningJumpPathAdded(
         betweens, end, lastPoint, nearestEndMinusLastSegment, pathAround, penultimatePoint, self.runningJumpSpace
     ):
         return
     doubleCombInset = 2.0 * self.combInset
     shortJumpSpace = 0.5 * self.runningJumpSpace
     if shortJumpSpace < doubleCombInset:
         return
     if self.getIsRunningJumpPathAdded(
         betweens, end, lastPoint, nearestEndMinusLastSegment, pathAround, penultimatePoint, shortJumpSpace
     ):
         return
     shortJumpSpace = 0.25 * self.runningJumpSpace
     if shortJumpSpace < doubleCombInset:
         return
     self.getIsRunningJumpPathAdded(
         betweens, end, lastPoint, nearestEndMinusLastSegment, pathAround, penultimatePoint, shortJumpSpace
     )