def addTwistPortions(interpolationTwist, remainderPortionDirection, twistPrecision):
 lastPortionDirection = interpolationTwist.portionDirections[(-1)]
 if (remainderPortionDirection.portion == lastPortionDirection.portion):
  return
 lastTwist = interpolationTwist.getYByPortion(lastPortionDirection)
 remainderTwist = interpolationTwist.getYByPortion(remainderPortionDirection)
 twistSegments = int(math.floor((abs((remainderTwist - lastTwist)) / twistPrecision)))
 if (twistSegments < 1):
  return
 portionDifference = (remainderPortionDirection.portion - lastPortionDirection.portion)
 twistSegmentsPlusOne = float((twistSegments + 1))
 for twistSegment in xrange(twistSegments):
  additionalPortion = ((portionDifference * float((twistSegment + 1))) / twistSegmentsPlusOne)
  portionDirection = PortionDirection((lastPortionDirection.portion + additionalPortion))
  interpolationTwist.portionDirections.append(portionDirection)

def addTwistPortions ( interpolationTwist , remainderPortionDirection , twistPrecision ) : lastPortionDirection = interpolationTwist . portionDirections [ ( - 1 ) ] if ( remainderPortionDirection . portion == lastPortionDirection . portion ) : return lastTwist = interpolationTwist . getYByPortion ( lastPortionDirection ) remainderTwist = interpolationTwist . getYByPortion ( remainderPortionDirection ) twistSegments = int ( math . floor ( ( abs ( ( remainderTwist - lastTwist ) ) / twistPrecision ) ) ) if ( twistSegments < 1 ) : return portionDifference = ( remainderPortionDirection . portion - lastPortionDirection . portion ) twistSegmentsPlusOne = float ( ( twistSegments + 1 ) ) for twistSegment in xrange ( twistSegments ) : additionalPortion = ( ( portionDifference * float ( ( twistSegment + 1 ) ) ) / twistSegmentsPlusOne ) portionDirection = PortionDirection ( ( lastPortionDirection . portion + additionalPortion ) ) interpolationTwist . portionDirections . append ( portionDirection )
add twist portions .