#NEWLINE# def _setup( self , detail , position ) : #NEWLINE# #INDENT# ( a , b , c ) = position #NEWLINE# r = self . radius #NEWLINE# p = self . center #NEWLINE# if ( detail == 0 ) : #NEWLINE# #INDENT# self . normals . append ( a ) #NEWLINE# self . normals . append ( b ) #NEWLINE# self . normals . append ( c ) #NEWLINE# self . positions . append ( tuple ( ( ( ( r * a [ i ] ) + p [ i ] ) for i in xrange ( 3 ) ) ) ) #NEWLINE# self . positions . append ( tuple ( ( ( ( r * b [ i ] ) + p [ i ] ) for i in xrange ( 3 ) ) ) ) #NEWLINE# self . positions . append ( tuple ( ( ( ( r * c [ i ] ) + p [ i ] ) for i in xrange ( 3 ) ) ) ) #NEWLINE# ta = [ ( 0.5 + ( atan2 ( a [ 0 ] , a [ 2 ] ) / ( 2 * pi ) ) ) , ( 0.5 + ( asin ( a [ 1 ] ) / pi ) ) ] #NEWLINE# tb = [ ( 0.5 + ( atan2 ( b [ 0 ] , b [ 2 ] ) / ( 2 * pi ) ) ) , ( 0.5 + ( asin ( b [ 1 ] ) / pi ) ) ] #NEWLINE# tc = [ ( 0.5 + ( atan2 ( c [ 0 ] , c [ 2 ] ) / ( 2 * pi ) ) ) , ( 0.5 + ( asin ( c [ 1 ] ) / pi ) ) ] #NEWLINE# ab = abs ( ( ta [ 0 ] - tb [ 0 ] ) ) #NEWLINE# ac = abs ( ( ta [ 0 ] - tc [ 0 ] ) ) #NEWLINE# bc = abs ( ( tb [ 0 ] - tc [ 0 ] ) ) #NEWLINE# if any ( ( ( x > 0.5 ) for x in [ ab , ac , bc ] ) ) : #NEWLINE# #INDENT# ta [ 0 ] = ( ( ta [ 0 ] + 1 ) % 1.0 ) #NEWLINE# tb [ 0 ] = ( ( tb [ 0 ] + 1 ) % 1.0 ) #NEWLINE# tc [ 0 ] = ( ( tc [ 0 ] + 1 ) % 1.0 ) #NEWLINE# #UNINDENT# self . uvs . append ( tuple ( ta ) ) #NEWLINE# self . uvs . append ( tuple ( tb ) ) #NEWLINE# self . uvs . append ( tuple ( tc ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ab = normalize ( [ ( ( a [ i ] + b [ i ] ) / 2.0 ) for i in xrange ( 3 ) ] ) #NEWLINE# ac = normalize ( [ ( ( a [ i ] + c [ i ] ) / 2.0 ) for i in xrange ( 3 ) ] ) #NEWLINE# bc = normalize ( [ ( ( b [ i ] + c [ i ] ) / 2.0 ) for i in xrange ( 3 ) ] ) #NEWLINE# self . _setup ( ( detail - 1 ) , ( a , ab , ac ) ) #NEWLINE# self . _setup ( ( detail - 1 ) , ( b , bc , ab ) ) #NEWLINE# self . _setup ( ( detail - 1 ) , ( c , ac , bc ) ) #NEWLINE# self . _setup ( ( detail - 1 ) , ( ab , bc , ac ) )