def isWithinChannel(channelRadius, pointIndex, loop):
 point = loop[pointIndex]
 behindSegmentComplex = (loop[(((pointIndex + len(loop)) - 1) % len(loop))] - point)
 behindSegmentComplexLength = abs(behindSegmentComplex)
 if (behindSegmentComplexLength < channelRadius):
  return True
 aheadSegmentComplex = (loop[((pointIndex + 1) % len(loop))] - point)
 aheadSegmentComplexLength = abs(aheadSegmentComplex)
 if (aheadSegmentComplexLength < channelRadius):
  return True
 behindSegmentComplex /= behindSegmentComplexLength
 aheadSegmentComplex /= aheadSegmentComplexLength
 absoluteZ = getDotProductPlusOne(aheadSegmentComplex, behindSegmentComplex)
 if ((behindSegmentComplexLength * absoluteZ) < channelRadius):
  return True
 return ((aheadSegmentComplexLength * absoluteZ) < channelRadius)

def isWithinChannel ( channelRadius , pointIndex , loop ) : point = loop [ pointIndex ] behindSegmentComplex = ( loop [ ( ( ( pointIndex + len ( loop ) ) - 1 ) % len ( loop ) ) ] - point ) behindSegmentComplexLength = abs ( behindSegmentComplex ) if ( behindSegmentComplexLength < channelRadius ) : return True aheadSegmentComplex = ( loop [ ( ( pointIndex + 1 ) % len ( loop ) ) ] - point ) aheadSegmentComplexLength = abs ( aheadSegmentComplex ) if ( aheadSegmentComplexLength < channelRadius ) : return True behindSegmentComplex /= behindSegmentComplexLength aheadSegmentComplex /= aheadSegmentComplexLength absoluteZ = getDotProductPlusOne ( aheadSegmentComplex , behindSegmentComplex ) if ( ( behindSegmentComplexLength * absoluteZ ) < channelRadius ) : return True return ( ( aheadSegmentComplexLength * absoluteZ ) < channelRadius )
determine if the the point is within the channel between two adjacent points .