def getClippedAtEndLoopPath(clip, loopPath):
 if (clip <= 0.0):
  return loopPath
 loopPathLength = getPathLength(loopPath)
 clip = min(clip, (0.3 * loopPathLength))
 lastLength = 0.0
 pointIndex = 0
 totalLength = 0.0
 clippedLength = (loopPathLength - clip)
 while ((totalLength < clippedLength) and (pointIndex < (len(loopPath) - 1))):
  firstPoint = loopPath[pointIndex]
  secondPoint = loopPath[(pointIndex + 1)]
  pointIndex += 1
  lastLength = totalLength
  totalLength += abs((firstPoint - secondPoint))
 remainingLength = (clippedLength - lastLength)
 clippedLoopPath = loopPath[:pointIndex]
 ultimateClippedPoint = loopPath[pointIndex]
 penultimateClippedPoint = clippedLoopPath[(-1)]
 segment = (ultimateClippedPoint - penultimateClippedPoint)
 segmentLength = abs(segment)
 if (segmentLength <= 0.0):
  return clippedLoopPath
 newUltimatePoint = (penultimateClippedPoint + ((segment * remainingLength) / segmentLength))
 return (clippedLoopPath + [newUltimatePoint])

def getClippedAtEndLoopPath ( clip , loopPath ) : if ( clip <= 0.0 ) : return loopPath loopPathLength = getPathLength ( loopPath ) clip = min ( clip , ( 0.3 * loopPathLength ) ) lastLength = 0.0 pointIndex = 0 totalLength = 0.0 clippedLength = ( loopPathLength - clip ) while ( ( totalLength < clippedLength ) and ( pointIndex < ( len ( loopPath ) - 1 ) ) ) : firstPoint = loopPath [ pointIndex ] secondPoint = loopPath [ ( pointIndex + 1 ) ] pointIndex += 1 lastLength = totalLength totalLength += abs ( ( firstPoint - secondPoint ) ) remainingLength = ( clippedLength - lastLength ) clippedLoopPath = loopPath [ : pointIndex ] ultimateClippedPoint = loopPath [ pointIndex ] penultimateClippedPoint = clippedLoopPath [ ( - 1 ) ] segment = ( ultimateClippedPoint - penultimateClippedPoint ) segmentLength = abs ( segment ) if ( segmentLength <= 0.0 ) : return clippedLoopPath newUltimatePoint = ( penultimateClippedPoint + ( ( segment * remainingLength ) / segmentLength ) ) return ( clippedLoopPath + [ newUltimatePoint ] )
get a clipped loop path .