def getRemainingLoopAddFace(faces, remainingLoop):
 for (indexedVertexIndex, indexedVertex) in enumerate(remainingLoop):
  nextIndex = ((indexedVertexIndex + 1) % len(remainingLoop))
  previousIndex = (((indexedVertexIndex + len(remainingLoop)) - 1) % len(remainingLoop))
  nextVertex = remainingLoop[nextIndex]
  previousVertex = remainingLoop[previousIndex]
  remainingPath = euclidean.getAroundLoop(((indexedVertexIndex + 2) % len(remainingLoop)), previousIndex, remainingLoop)
  if ((len(remainingLoop) < 4) or getIsPathEntirelyOutsideTriangle(previousVertex, indexedVertex, nextVertex, remainingPath)):
   faceConvex = face.Face()
   faceConvex.index = len(faces)
   faceConvex.vertexIndexes.append(indexedVertex.index)
   faceConvex.vertexIndexes.append(nextVertex.index)
   faceConvex.vertexIndexes.append(previousVertex.index)
   faces.append(faceConvex)
   return euclidean.getAroundLoop(nextIndex, indexedVertexIndex, remainingLoop)
 print 'Warning, could not decompose polygon in getRemainingLoopAddFace in trianglemesh for:'
 print remainingLoop
 return []

def getRemainingLoopAddFace ( faces , remainingLoop ) : for ( indexedVertexIndex , indexedVertex ) in enumerate ( remainingLoop ) : nextIndex = ( ( indexedVertexIndex + 1 ) % len ( remainingLoop ) ) previousIndex = ( ( ( indexedVertexIndex + len ( remainingLoop ) ) - 1 ) % len ( remainingLoop ) ) nextVertex = remainingLoop [ nextIndex ] previousVertex = remainingLoop [ previousIndex ] remainingPath = euclidean . getAroundLoop ( ( ( indexedVertexIndex + 2 ) % len ( remainingLoop ) ) , previousIndex , remainingLoop ) if ( ( len ( remainingLoop ) < 4 ) or getIsPathEntirelyOutsideTriangle ( previousVertex , indexedVertex , nextVertex , remainingPath ) ) : faceConvex = face . Face ( ) faceConvex . index = len ( faces ) faceConvex . vertexIndexes . append ( indexedVertex . index ) faceConvex . vertexIndexes . append ( nextVertex . index ) faceConvex . vertexIndexes . append ( previousVertex . index ) faces . append ( faceConvex ) return euclidean . getAroundLoop ( nextIndex , indexedVertexIndex , remainingLoop ) print 'Warning, could not decompose polygon in getRemainingLoopAddFace in trianglemesh for:' print remainingLoop return [ ]
get the remaining loop and add face .