Example #1
0
	def addArc( self, afterCenterDifferenceAngle, afterPoint, beforeCenterSegment, beforePoint, center ):
		"Add arc segments to the filleted skein."
		absoluteDifferenceAngle = abs( afterCenterDifferenceAngle )
#		steps = int( math.ceil( absoluteDifferenceAngle * 1.5 ) )
		steps = int( math.ceil( min( absoluteDifferenceAngle * 1.5, absoluteDifferenceAngle * abs( beforeCenterSegment ) / self.curveSection ) ) )
		stepPlaneAngle = euclidean.getWiddershinsUnitPolar( afterCenterDifferenceAngle / steps )
		for step in xrange( 1, steps ):
			beforeCenterSegment = euclidean.getRoundZAxisByPlaneAngle( stepPlaneAngle, beforeCenterSegment )
			arcPoint = center + beforeCenterSegment
			self.addLinearMovePoint( self.getCornerFeedRate(), arcPoint )
		self.addLinearMovePoint( self.getCornerFeedRate(), afterPoint )
Example #2
0
	def addArc( self, afterCenterDifferenceAngle, afterPoint, beforeCenterSegment, beforePoint, center ):
		"Add arc segments to the filleted skein."
		absoluteDifferenceAngle = abs( afterCenterDifferenceAngle )
#		steps = int( math.ceil( absoluteDifferenceAngle * 1.5 ) )
		steps = int( math.ceil( min( absoluteDifferenceAngle * 1.5, absoluteDifferenceAngle * abs( beforeCenterSegment ) / self.curveSection ) ) )
		stepPlaneAngle = euclidean.getWiddershinsUnitPolar( afterCenterDifferenceAngle / steps )
		for step in xrange( 1, steps ):
			beforeCenterSegment = euclidean.getRoundZAxisByPlaneAngle( stepPlaneAngle, beforeCenterSegment )
			arcPoint = center + beforeCenterSegment
			self.addLinearMovePoint( self.getCornerFeedRate(), arcPoint )
		self.addLinearMovePoint( self.getCornerFeedRate(), afterPoint )
Example #3
0
 def helicalMove(self, isCounterclockwise, splitLine):
     "Get statistics for a helical move."
     if self.oldLocation == None:
         return
     location = self.getLocationSetFeedRateToSplitLine(splitLine)
     location += self.oldLocation
     center = self.oldLocation.copy()
     indexOfR = gcodec.getIndexOfStartingWithSecond("R", splitLine)
     if indexOfR > 0:
         radius = gcodec.getDoubleAfterFirstLetter(splitLine[indexOfR])
         halfLocationMinusOld = location - self.oldLocation
         halfLocationMinusOld *= 0.5
         halfLocationMinusOldLength = halfLocationMinusOld.magnitude()
         centerMidpointDistanceSquared = radius * radius - halfLocationMinusOldLength * halfLocationMinusOldLength
         centerMidpointDistance = math.sqrt(
             max(centerMidpointDistanceSquared, 0.0))
         centerMinusMidpoint = euclidean.getRotatedWiddershinsQuarterAroundZAxis(
             halfLocationMinusOld)
         centerMinusMidpoint.normalize()
         centerMinusMidpoint *= centerMidpointDistance
         if isCounterclockwise:
             center.setToVector3(halfLocationMinusOld + centerMinusMidpoint)
         else:
             center.setToVector3(halfLocationMinusOld - centerMinusMidpoint)
     else:
         center.x = gcodec.getDoubleForLetter("I", splitLine)
         center.y = gcodec.getDoubleForLetter("J", splitLine)
     curveSection = 0.5
     center += self.oldLocation
     afterCenterSegment = location - center
     beforeCenterSegment = self.oldLocation - center
     afterCenterDifferenceAngle = euclidean.getAngleAroundZAxisDifference(
         afterCenterSegment, beforeCenterSegment)
     absoluteDifferenceAngle = abs(afterCenterDifferenceAngle)
     steps = int(
         round(0.5 + max(
             absoluteDifferenceAngle * 2.4,
             absoluteDifferenceAngle * beforeCenterSegment.magnitude() /
             curveSection)))
     stepPlaneAngle = euclidean.getWiddershinsUnitPolar(
         afterCenterDifferenceAngle / steps)
     zIncrement = (afterCenterSegment.z -
                   beforeCenterSegment.z) / float(steps)
     for step in xrange(1, steps):
         beforeCenterSegment = euclidean.getRoundZAxisByPlaneAngle(
             stepPlaneAngle, beforeCenterSegment)
         beforeCenterSegment.z += zIncrement
         arcPoint = center + beforeCenterSegment
         self.addToPath(arcPoint)
     self.addToPath(location)
Example #4
0
 def helicalMove(self, isCounterclockwise, splitLine):
     "Get statistics for a helical move."
     if self.oldLocation == None:
         return
     location = self.getLocationSetFeedRateToSplitLine(splitLine)
     location += self.oldLocation
     center = self.oldLocation.copy()
     indexOfR = gcodec.indexOfStartingWithSecond("R", splitLine)
     if indexOfR > 0:
         radius = gcodec.getDoubleAfterFirstLetter(splitLine[indexOfR])
         halfLocationMinusOld = location - self.oldLocation
         halfLocationMinusOld *= 0.5
         halfLocationMinusOldLength = halfLocationMinusOld.magnitude()
         centerMidpointDistanceSquared = radius * radius - halfLocationMinusOldLength * halfLocationMinusOldLength
         centerMidpointDistance = math.sqrt(max(centerMidpointDistanceSquared, 0.0))
         centerMinusMidpoint = euclidean.getRotatedWiddershinsQuarterAroundZAxis(halfLocationMinusOld)
         centerMinusMidpoint.normalize()
         centerMinusMidpoint *= centerMidpointDistance
         if isCounterclockwise:
             center.setToVector3(halfLocationMinusOld + centerMinusMidpoint)
         else:
             center.setToVector3(halfLocationMinusOld - centerMinusMidpoint)
     else:
         center.x = gcodec.getDoubleForLetter("I", splitLine)
         center.y = gcodec.getDoubleForLetter("J", splitLine)
     curveSection = 0.5
     center += self.oldLocation
     afterCenterSegment = location - center
     beforeCenterSegment = self.oldLocation - center
     afterCenterDifferenceAngle = euclidean.getAngleAroundZAxisDifference(afterCenterSegment, beforeCenterSegment)
     absoluteDifferenceAngle = abs(afterCenterDifferenceAngle)
     steps = int(
         round(
             0.5
             + max(
                 absoluteDifferenceAngle * 2.4,
                 absoluteDifferenceAngle * beforeCenterSegment.magnitude() / curveSection,
             )
         )
     )
     stepPlaneAngle = euclidean.getWiddershinsUnitPolar(afterCenterDifferenceAngle / steps)
     zIncrement = (afterCenterSegment.z - beforeCenterSegment.z) / float(steps)
     for step in xrange(1, steps):
         beforeCenterSegment = euclidean.getRoundZAxisByPlaneAngle(stepPlaneAngle, beforeCenterSegment)
         beforeCenterSegment.z += zIncrement
         arcPoint = center + beforeCenterSegment
         self.addToPath(arcPoint)
     self.addToPath(location)