def getWideAnglePointIndex(loop):
 dotProductMinimum = 9999999.9
 widestPointIndex = 0
 for pointIndex in xrange(len(loop)):
  point = loop[(pointIndex % len(loop))]
  afterPoint = loop[((pointIndex + 1) % len(loop))]
  beforePoint = loop[((pointIndex - 1) % len(loop))]
  afterSegmentNormalized = euclidean.getNormalized((afterPoint - point))
  beforeSegmentNormalized = euclidean.getNormalized((beforePoint - point))
  dotProduct = euclidean.getDotProduct(afterSegmentNormalized, beforeSegmentNormalized)
  if (dotProduct < 0.99):
   return pointIndex
  if (dotProduct < dotProductMinimum):
   dotProductMinimum = dotProduct
   widestPointIndex = pointIndex
 return widestPointIndex

def getWideAnglePointIndex ( loop ) : dotProductMinimum = 9999999.9 widestPointIndex = 0 for pointIndex in xrange ( len ( loop ) ) : point = loop [ ( pointIndex % len ( loop ) ) ] afterPoint = loop [ ( ( pointIndex + 1 ) % len ( loop ) ) ] beforePoint = loop [ ( ( pointIndex - 1 ) % len ( loop ) ) ] afterSegmentNormalized = euclidean . getNormalized ( ( afterPoint - point ) ) beforeSegmentNormalized = euclidean . getNormalized ( ( beforePoint - point ) ) dotProduct = euclidean . getDotProduct ( afterSegmentNormalized , beforeSegmentNormalized ) if ( dotProduct < 0.99 ) : return pointIndex if ( dotProduct < dotProductMinimum ) : dotProductMinimum = dotProduct widestPointIndex = pointIndex return widestPointIndex
get a point index which has a wide enough angle .