def getCircleNodesFromPoints( pointComplexes, radius ): "Get the circle nodes from a path." circleNodes = [] pointComplexes = euclidean.getAwayPoints( pointComplexes, 0.001 * radius ) for pointComplex in pointComplexes: circleNodes.append( CircleNode( pointComplex, len( circleNodes ), radius ) ) return circleNodes
def getCircleNodesFromPoints( pointComplexes, radius ): "Get the circle nodes from a path." circleNodesComplex = [] pointComplexes = euclidean.getAwayPoints( pointComplexes, 0.001 * radius ) for pointComplex in pointComplexes: circleNodesComplex.append( CircleNode( pointComplex, len( circleNodesComplex ), radius ) ) return circleNodesComplex
def addPathBeforeEnd( self, aroundBetweenPath, location, loop ): "Add the path before the end of the loop." halfFillInset = 0.5 * self.fillInset if self.arrivalInsetFollowDistance < halfFillInset: return locationComplex = location.dropAxis( 2 ) closestInset = None closestDistanceIndex = euclidean.DistanceIndex( 999999999999999999.0, - 1 ) loop = euclidean.getAwayPoints( loop, self.extrusionWidth ) circleNodes = intercircle.getCircleNodesFromLoop( loop, self.fillInset ) centers = [] centers = intercircle.getCentersFromCircleNodes( circleNodes ) for center in centers: inset = intercircle.getInsetFromClockwiseLoop( center, halfFillInset ) if euclidean.isLargeSameDirection( inset, center, self.fillInset ): if euclidean.isPathInsideLoop( loop, inset ) == euclidean.isWiddershins( loop ): distanceIndex = euclidean.getNearestDistanceIndex( locationComplex, inset ) if distanceIndex.distance < closestDistanceIndex.distance: closestInset = inset closestDistanceIndex = distanceIndex if closestInset == None: return extrusionHalfWidth = 0.5 * self.extrusionWidth closestInset = euclidean.getLoopStartingNearest( extrusionHalfWidth, locationComplex, closestInset ) if euclidean.getPolygonLength( closestInset ) < 0.2 * self.arrivalInsetFollowDistance: return closestInset.append( closestInset[ 0 ] ) closestInset = euclidean.getSimplifiedPath( closestInset, self.extrusionWidth ) closestInset.reverse() pathBeforeArrival = euclidean.getClippedAtEndLoopPath( self.arrivalInsetFollowDistance, closestInset ) pointBeforeArrival = pathBeforeArrival[ - 1 ] aroundBetweenPath.append( pointBeforeArrival ) if self.arrivalInsetFollowDistance <= halfFillInset: return aroundBetweenPath += euclidean.getClippedAtEndLoopPath( halfFillInset, closestInset )[ len( pathBeforeArrival ) - 1 : ]
def getCircleNodesFromPoints( points, radius ): "Get the circle nodes from a path." circleNodes = [] oneOverRadius = 1.0 / radius points = euclidean.getAwayPoints( points, 0.001 * radius ) for point in points: circleNodes.append( CircleNode( point * oneOverRadius, len( circleNodes ) ) ) return circleNodes
def getCircleNodesFromPoints(points, radius): "Get the circle nodes from a path." circleNodes = [] oneOverRadius = 1.0 / radius points = euclidean.getAwayPoints(points, 0.001 * radius) for point in points: circleNodes.append(CircleNode(point * oneOverRadius, len(circleNodes))) return circleNodes
def addTailoredLoopPath( self ): "Add a clipped and jittered loop path." loop = self.loopPath.path[ : - 1 ] if self.beforeLoopLocation != None: perimeterHalfWidth = 0.5 * self.perimeterWidth loop = euclidean.getLoopStartingNearest( perimeterHalfWidth, self.beforeLoopLocation, loop ) if self.layerJitter != 0.0: loop = self.getJitteredLoop( self.layerJitter, loop ) loop = euclidean.getAwayPoints( loop, 0.2 * self.perimeterWidth ) self.loopPath.path = loop + [ loop[ 0 ] ] self.addGcodeFromThreadZ( self.loopPath.path, self.loopPath.z ) self.loopPath = None
def addTailoredLoopPath( self ): "Add a clipped and jittered loop path." loop = self.loopPath.path[ : - 1 ] jitterDistance = self.layerJitter + self.arrivalInsetFollowDistance if self.beforeLoopLocation != None: extrusionHalfWidth = 0.5 * self.extrusionWidth loop = euclidean.getLoopStartingNearest( extrusionHalfWidth, self.beforeLoopLocation, loop ) if jitterDistance != 0.0: loop = self.getJitteredLoop( jitterDistance, loop ) loop = euclidean.getAwayPoints( loop, 0.2 * self.fillInset ) self.loopPath.path = loop + [ loop[ 0 ] ] self.addGcodeFromThreadZ( self.loopPath.path, self.loopPath.z ) self.loopPath = None
def addTailoredLoopPath(self): "Add a clipped and jittered loop path." loop = self.loopPath.path[:-1] jitterDistance = self.layerJitter + self.arrivalInsetFollowDistance if self.beforeLoopLocation != None: extrusionHalfWidth = 0.5 * self.extrusionWidth loop = euclidean.getLoopStartingNearest(extrusionHalfWidth, self.beforeLoopLocation, loop) if jitterDistance != 0.0: loop = self.getJitteredLoop(jitterDistance, loop) loop = euclidean.getAwayPoints(loop, 0.2 * self.fillInset) self.loopPath.path = loop + [loop[0]] self.addGcodeFromThreadZ(self.loopPath.path, self.loopPath.z) self.loopPath = None
def addTailoredLoopPath( self ): "Add a clipped and jittered loop path." loop = self.loopPath.path[ : - 1 ] if self.beforeLoopLocation != None: if self.oldLoopLocationComplex != None: self.beforeLoopLocation = self.oldLoopLocationComplex perimeterHalfWidth = 0.5 * self.perimeterWidth loop = euclidean.getLoopStartingNearest( perimeterHalfWidth, self.beforeLoopLocation, loop ) if self.layerJitter != 0.0 and self.oldLoopLocationComplex == None: loop = getJitteredLoop( self.layerJitter, loop ) loop = euclidean.getAwayPoints( loop, 0.2 * self.perimeterWidth ) self.loopPath.path = loop + [ loop[ 0 ] ] self.addGcodeFromThreadZ( self.loopPath.path, self.loopPath.z ) self.oldLoopLocationComplex = loop[ 0 ] self.loopPath = None
def addPathBeforeEnd(self, aroundBetweenPath, location, loop): "Add the path before the end of the loop." halfFillInset = 0.5 * self.fillInset if self.arrivalInsetFollowDistance < halfFillInset: return locationComplex = location.dropAxis(2) closestInset = None closestDistanceIndex = euclidean.DistanceIndex(999999999999999999.0, -1) loop = euclidean.getAwayPoints(loop, self.extrusionWidth) circleNodes = intercircle.getCircleNodesFromLoop(loop, self.fillInset) centers = [] centers = intercircle.getCentersFromCircleNodes(circleNodes) for center in centers: inset = intercircle.getInsetFromClockwiseLoop( center, halfFillInset) if euclidean.isLargeSameDirection(inset, center, self.fillInset): if euclidean.isPathInsideLoop( loop, inset) == euclidean.isWiddershins(loop): distanceIndex = euclidean.getNearestDistanceIndex( locationComplex, inset) if distanceIndex.distance < closestDistanceIndex.distance: closestInset = inset closestDistanceIndex = distanceIndex if closestInset == None: return extrusionHalfWidth = 0.5 * self.extrusionWidth closestInset = euclidean.getLoopStartingNearest( extrusionHalfWidth, locationComplex, closestInset) if euclidean.getPolygonLength( closestInset) < 0.2 * self.arrivalInsetFollowDistance: return closestInset.append(closestInset[0]) closestInset = euclidean.getSimplifiedPath(closestInset, self.extrusionWidth) closestInset.reverse() pathBeforeArrival = euclidean.getClippedAtEndLoopPath( self.arrivalInsetFollowDistance, closestInset) pointBeforeArrival = pathBeforeArrival[-1] aroundBetweenPath.append(pointBeforeArrival) if self.arrivalInsetFollowDistance <= halfFillInset: return aroundBetweenPath += euclidean.getClippedAtEndLoopPath( halfFillInset, closestInset)[len(pathBeforeArrival) - 1:]