コード例 #1
0
 def addPathBetween(self, betweenFirst, betweenSecond, loopFirst):
     "Add a path between the perimeter and the fill."
     clockwisePath = [betweenFirst]
     widdershinsPath = [betweenFirst]
     nearestFirstDistanceIndex = euclidean.getNearestDistanceSquaredIndex(
         betweenFirst, loopFirst)
     nearestSecondDistanceIndex = euclidean.getNearestDistanceSquaredIndex(
         betweenSecond, loopFirst)
     firstBeginIndex = (int(nearestFirstDistanceIndex.imag) +
                        1) % len(loopFirst)
     secondBeginIndex = (int(nearestSecondDistanceIndex.imag) +
                         1) % len(loopFirst)
     widdershinsLoop = euclidean.getAroundLoop(firstBeginIndex,
                                               secondBeginIndex, loopFirst)
     widdershinsPath += widdershinsLoop
     clockwiseLoop = euclidean.getAroundLoop(secondBeginIndex,
                                             firstBeginIndex, loopFirst)
     clockwiseLoop.reverse()
     clockwisePath += clockwiseLoop
     clockwisePath.append(betweenSecond)
     widdershinsPath.append(betweenSecond)
     if euclidean.getPathLength(widdershinsPath) > euclidean.getPathLength(
             clockwisePath):
         widdershinsPath = clockwisePath
     widdershinsPath = euclidean.getAwayPath(widdershinsPath,
                                             0.2 * self.layerFillInset)
     for point in widdershinsPath:
         self.addGcodeMovement(point)
コード例 #2
0
ファイル: comb.py プロジェクト: brendanjerwin/emcrepstrap
	def addPathBetween( self, betweenFirst, betweenSecond, loopFirst ):
		"Add a path between the perimeter and the fill."
		clockwisePath = [ betweenFirst ]
		widdershinsPath = [ betweenFirst ]
		nearestFirstDistanceIndex = euclidean.getNearestDistanceSquaredIndex( betweenFirst, loopFirst )
		nearestSecondDistanceIndex = euclidean.getNearestDistanceSquaredIndex( betweenSecond, loopFirst )
		firstBeginIndex = ( int( nearestFirstDistanceIndex.imag ) + 1 ) % len( loopFirst )
		secondBeginIndex = ( int( nearestSecondDistanceIndex.imag ) + 1 ) % len( loopFirst )
		widdershinsLoop = euclidean.getAroundLoop( firstBeginIndex, secondBeginIndex, loopFirst )
		widdershinsPath += widdershinsLoop
		clockwiseLoop = euclidean.getAroundLoop( secondBeginIndex, firstBeginIndex, loopFirst )
		clockwiseLoop.reverse()
		clockwisePath += clockwiseLoop
		clockwisePath.append( betweenSecond )
		widdershinsPath.append( betweenSecond )
		if euclidean.getPathLength( widdershinsPath ) > euclidean.getPathLength( clockwisePath ):
			widdershinsPath = clockwisePath
		widdershinsPath = euclidean.getAwayPath( widdershinsPath, 0.2 * self.layerFillInset )
		for point in widdershinsPath:
			self.addGcodeMovement( point )
コード例 #3
0
ファイル: fill.py プロジェクト: syky27/emcrepstrap
def getWithLeastLength(path, point):
    "Insert a point into a path, at the index at which the path would be shortest."
    shortestPointIndex = None
    shortestPathLength = 999999999999999999.0
    for pointIndex in range(len(path) + 1):
        concatenation = path[:]
        concatenation.insert(pointIndex, point)
        concatenationLength = euclidean.getPathLength(concatenation)
        if concatenationLength < shortestPathLength:
            shortestPathLength = concatenationLength
            shortestPointIndex = pointIndex
    return shortestPointIndex
コード例 #4
0
ファイル: fill.py プロジェクト: brendanjerwin/emcrepstrap
def getWithLeastLength( path, point ):
	"Insert a point into a path, at the index at which the path would be shortest."
	shortestPointIndex = None
	shortestPathLength = 999999999999999999.0
	for pointIndex in range( len( path ) + 1 ):
		concatenation = path[ : ]
		concatenation.insert( pointIndex, point )
		concatenationLength = euclidean.getPathLength( concatenation )
		if concatenationLength < shortestPathLength:
			shortestPathLength = concatenationLength
			shortestPointIndex = pointIndex
	return shortestPointIndex