def addLoop(derivation, endMultiplier, loopLists, path, portionDirectionIndex, portionDirections, vertexes):
 portionDirection = portionDirections[portionDirectionIndex]
 if (portionDirection.directionReversed == True):
  loopLists.append([])
 loops = loopLists[(-1)]
 interpolationOffset = derivation.interpolationDictionary['offset']
 offset = interpolationOffset.getVector3ByPortion(portionDirection)
 if (endMultiplier != None):
  if (portionDirectionIndex == 0):
   setOffsetByMultiplier(interpolationOffset.path[1], interpolationOffset.path[0], endMultiplier, offset)
  elif (portionDirectionIndex == (len(portionDirections) - 1)):
   setOffsetByMultiplier(interpolationOffset.path[(-2)], interpolationOffset.path[(-1)], endMultiplier, offset)
 scale = derivation.interpolationDictionary['scale'].getComplexByPortion(portionDirection)
 twist = derivation.interpolationDictionary['twist'].getYByPortion(portionDirection)
 projectiveSpace = euclidean.ProjectiveSpace()
 if (derivation.tiltTop == None):
  tilt = derivation.interpolationDictionary['tilt'].getComplexByPortion(portionDirection)
  projectiveSpace = projectiveSpace.getByTilt(tilt)
 else:
  normals = getNormals(interpolationOffset, offset, portionDirection)
  normalFirst = normals[0]
  normalAverage = getNormalAverage(normals)
  if (derivation.tiltFollow and (derivation.oldProjectiveSpace != None)):
   projectiveSpace = derivation.oldProjectiveSpace.getNextSpace(normalAverage)
  else:
   projectiveSpace = projectiveSpace.getByBasisZTop(normalAverage, derivation.tiltTop)
  derivation.oldProjectiveSpace = projectiveSpace
  projectiveSpace.unbuckle(derivation.maximumUnbuckling, normalFirst)
 projectiveSpace = projectiveSpace.getSpaceByXYScaleAngle(twist, scale)
 loop = []
 if ((abs(projectiveSpace.basisX) + abs(projectiveSpace.basisY)) < 0.0001):
  vector3Index = Vector3Index(len(vertexes))
  addOffsetAddToLists(loop, offset, vector3Index, vertexes)
  loops.append(loop)
  return
 for point in path:
  vector3Index = Vector3Index(len(vertexes))
  projectedVertex = projectiveSpace.getVector3ByPoint(point)
  vector3Index.setToVector3(projectedVertex)
  addOffsetAddToLists(loop, offset, vector3Index, vertexes)
 loops.append(loop)

def addLoop ( derivation , endMultiplier , loopLists , path , portionDirectionIndex , portionDirections , vertexes ) : portionDirection = portionDirections [ portionDirectionIndex ] if ( portionDirection . directionReversed == True ) : loopLists . append ( [ ] ) loops = loopLists [ ( - 1 ) ] interpolationOffset = derivation . interpolationDictionary [ 'offset' ] offset = interpolationOffset . getVector3ByPortion ( portionDirection ) if ( endMultiplier != None ) : if ( portionDirectionIndex == 0 ) : setOffsetByMultiplier ( interpolationOffset . path [ 1 ] , interpolationOffset . path [ 0 ] , endMultiplier , offset ) elif ( portionDirectionIndex == ( len ( portionDirections ) - 1 ) ) : setOffsetByMultiplier ( interpolationOffset . path [ ( - 2 ) ] , interpolationOffset . path [ ( - 1 ) ] , endMultiplier , offset ) scale = derivation . interpolationDictionary [ 'scale' ] . getComplexByPortion ( portionDirection ) twist = derivation . interpolationDictionary [ 'twist' ] . getYByPortion ( portionDirection ) projectiveSpace = euclidean . ProjectiveSpace ( ) if ( derivation . tiltTop == None ) : tilt = derivation . interpolationDictionary [ 'tilt' ] . getComplexByPortion ( portionDirection ) projectiveSpace = projectiveSpace . getByTilt ( tilt ) else : normals = getNormals ( interpolationOffset , offset , portionDirection ) normalFirst = normals [ 0 ] normalAverage = getNormalAverage ( normals ) if ( derivation . tiltFollow and ( derivation . oldProjectiveSpace != None ) ) : projectiveSpace = derivation . oldProjectiveSpace . getNextSpace ( normalAverage ) else : projectiveSpace = projectiveSpace . getByBasisZTop ( normalAverage , derivation . tiltTop ) derivation . oldProjectiveSpace = projectiveSpace projectiveSpace . unbuckle ( derivation . maximumUnbuckling , normalFirst ) projectiveSpace = projectiveSpace . getSpaceByXYScaleAngle ( twist , scale ) loop = [ ] if ( ( abs ( projectiveSpace . basisX ) + abs ( projectiveSpace . basisY ) ) < 0.0001 ) : vector3Index = Vector3Index ( len ( vertexes ) ) addOffsetAddToLists ( loop , offset , vector3Index , vertexes ) loops . append ( loop ) return for point in path : vector3Index = Vector3Index ( len ( vertexes ) ) projectedVertex = projectiveSpace . getVector3ByPoint ( point ) vector3Index . setToVector3 ( projectedVertex ) addOffsetAddToLists ( loop , offset , vector3Index , vertexes ) loops . append ( loop )
add simplified path to fill .