def addFacesByLoop(faces, indexedLoop):
 if (len(indexedLoop) < 3):
  return
 lastNormal = None
 for (pointIndex, point) in enumerate(indexedLoop):
  center = indexedLoop[((pointIndex + 1) % len(indexedLoop))]
  end = indexedLoop[((pointIndex + 2) % len(indexedLoop))]
  normal = euclidean.getNormalWeighted(point, center, end)
  if (abs(normal) > 0.0):
   if (lastNormal != None):
    if (lastNormal.dot(normal) < 0.0):
     addFacesByConcaveLoop(faces, indexedLoop)
     return
   lastNormal = normal
 addFacesByConvex(faces, indexedLoop)

def addFacesByLoop ( faces , indexedLoop ) : if ( len ( indexedLoop ) < 3 ) : return lastNormal = None for ( pointIndex , point ) in enumerate ( indexedLoop ) : center = indexedLoop [ ( ( pointIndex + 1 ) % len ( indexedLoop ) ) ] end = indexedLoop [ ( ( pointIndex + 2 ) % len ( indexedLoop ) ) ] normal = euclidean . getNormalWeighted ( point , center , end ) if ( abs ( normal ) > 0.0 ) : if ( lastNormal != None ) : if ( lastNormal . dot ( normal ) < 0.0 ) : addFacesByConcaveLoop ( faces , indexedLoop ) return lastNormal = normal addFacesByConvex ( faces , indexedLoop )
add faces from a polygon which may be concave .