def getSimplifiedLoop(loop, radius):
 if (len(loop) < 2):
  return loop
 simplificationMultiplication = 256
 simplificationRadius = (radius / float(simplificationMultiplication))
 maximumIndex = (len(loop) * simplificationMultiplication)
 pointIndex = 1
 while (pointIndex < maximumIndex):
  oldLoopLength = len(loop)
  loop = getHalfSimplifiedLoop(loop, simplificationRadius, 0)
  loop = getHalfSimplifiedLoop(loop, simplificationRadius, 1)
  simplificationRadius += simplificationRadius
  if (oldLoopLength == len(loop)):
   if (simplificationRadius > radius):
    return getAwayPoints(loop, radius)
   else:
    simplificationRadius *= 1.5
  simplificationRadius = min(simplificationRadius, radius)
  pointIndex += pointIndex
 return getAwayPoints(loop, radius)

def getSimplifiedLoop ( loop , radius ) : if ( len ( loop ) < 2 ) : return loop simplificationMultiplication = 256 simplificationRadius = ( radius / float ( simplificationMultiplication ) ) maximumIndex = ( len ( loop ) * simplificationMultiplication ) pointIndex = 1 while ( pointIndex < maximumIndex ) : oldLoopLength = len ( loop ) loop = getHalfSimplifiedLoop ( loop , simplificationRadius , 0 ) loop = getHalfSimplifiedLoop ( loop , simplificationRadius , 1 ) simplificationRadius += simplificationRadius if ( oldLoopLength == len ( loop ) ) : if ( simplificationRadius > radius ) : return getAwayPoints ( loop , radius ) else : simplificationRadius *= 1.5 simplificationRadius = min ( simplificationRadius , radius ) pointIndex += pointIndex return getAwayPoints ( loop , radius )
get loop with points inside the channel removed .