def addSphere(elementNode, faces, radius, vertexes):
 bottom = (- radius.z)
 sides = evaluate.getSidesMinimumThreeBasedOnPrecision(elementNode, max(radius.x, radius.y, radius.z))
 sphereSlices = max((sides / 2), 2)
 equator = euclidean.getComplexPolygonByComplexRadius(complex(radius.x, radius.y), sides)
 polygons = [triangle_mesh.getAddIndexedLoop([complex()], vertexes, bottom)]
 zIncrement = ((radius.z + radius.z) / float(sphereSlices))
 z = bottom
 for sphereSlice in xrange(1, sphereSlices):
  z += zIncrement
  zPortion = (abs(z) / radius.z)
  multipliedPath = euclidean.getComplexPathByMultiplier(math.sqrt((1.0 - (zPortion * zPortion))), equator)
  polygons.append(triangle_mesh.getAddIndexedLoop(multipliedPath, vertexes, z))
 polygons.append(triangle_mesh.getAddIndexedLoop([complex()], vertexes, radius.z))
 triangle_mesh.addPillarByLoops(faces, polygons)

def addSphere ( elementNode , faces , radius , vertexes ) : bottom = ( - radius . z ) sides = evaluate . getSidesMinimumThreeBasedOnPrecision ( elementNode , max ( radius . x , radius . y , radius . z ) ) sphereSlices = max ( ( sides / 2 ) , 2 ) equator = euclidean . getComplexPolygonByComplexRadius ( complex ( radius . x , radius . y ) , sides ) polygons = [ triangle_mesh . getAddIndexedLoop ( [ complex ( ) ] , vertexes , bottom ) ] zIncrement = ( ( radius . z + radius . z ) / float ( sphereSlices ) ) z = bottom for sphereSlice in xrange ( 1 , sphereSlices ) : z += zIncrement zPortion = ( abs ( z ) / radius . z ) multipliedPath = euclidean . getComplexPathByMultiplier ( math . sqrt ( ( 1.0 - ( zPortion * zPortion ) ) ) , equator ) polygons . append ( triangle_mesh . getAddIndexedLoop ( multipliedPath , vertexes , z ) ) polygons . append ( triangle_mesh . getAddIndexedLoop ( [ complex ( ) ] , vertexes , radius . z ) ) triangle_mesh . addPillarByLoops ( faces , polygons )
add sphere by radius .