예제 #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
	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
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