<s> from __future__ import division , print_function <EOL> from . import cvisual <EOL> from sys import version_info <EOL> def import_check ( name ) : <EOL> if name == "<STR_LIT>" : <EOL> imported = False <EOL> try : <EOL> from Polygon import Polygon <EOL> imported = True <EOL> except ImportError : <EOL> print ( "<STR_LIT>" ) <EOL> return imported <EOL> elif name == "<STR_LIT>" : <EOL> imported = False <EOL> try : <EOL> from ttfquery import describe , glyphquery , glyph <EOL> imported = True <EOL> except ImportError : <EOL> print ( "<STR_LIT>" ) <EOL> return imported <EOL> return False <EOL> if import_check ( "<STR_LIT>" ) : <EOL> from Polygon import Polygon <EOL> from . import shapes <EOL> if import_check ( "<STR_LIT>" ) : <EOL> from ttfquery import describe , glyphquery , glyph <EOL> from . cvisual import vector <EOL> from numpy import array , asarray , zeros , arange , int32 , float64 , sin , cos , fromstring , uint8 <EOL> from . import crayola <EOL> color = crayola <EOL> from math import pi <EOL> import wx as _wx <EOL> _App2 = _wx . App ( ) <EOL> _platInfo = _wx . PlatformInformation ( ) <EOL> _plat = _platInfo . GetOperatingSystemFamilyName ( ) <EOL> NCHORDS = <NUM_LIT> <EOL> trail_list = [ ] <EOL> class py_renderable ( object ) : <EOL> def __init__ ( self , ** keywords ) : <EOL> _other = keywords . get ( "<STR_LIT>" ) <EOL> if _other : <EOL> del keywords [ "<STR_LIT>" ] <EOL> super ( py_renderable , self ) . __init__ ( _other ) <EOL> self . __dict__ = dict ( _other . __dict__ ) <EOL> self . __display = _other . display <EOL> self . __frame = _other . frame <EOL> self . __visible = _other . visible <EOL> else : <EOL> super ( py_renderable , self ) . __init__ ( ) <EOL> self . __display = cvisual . display_kernel . get_selected ( ) <EOL> self . __frame = None <EOL> self . __visible = True <EOL> if '<STR_LIT>' in keywords : <EOL> self . __display = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in keywords : <EOL> self . __visible = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in keywords : <EOL> self . __frame = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> if not _other : self . init_defaults ( keywords ) <EOL> self . process_init_args_from_keyword_dictionary ( keywords ) <EOL> if self . __frame : <EOL> if self . __frame . display != self . __display : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> self . check_init_invariants ( ) <EOL> if self . __visible : <EOL> if self . __frame : <EOL> self . __frame . add_renderable ( self ) <EOL> elif self . __display : <EOL> self . __display . add_renderable ( self ) <EOL> def __copy__ ( self , ** keywords ) : <EOL> return self . __class__ ( _other = self , ** keywords ) <EOL> def check_init_invariants ( self ) : <EOL> pass <EOL> def set_display ( self , display ) : <EOL> "<STR_LIT>" <EOL> if display != self . __display : <EOL> if self . __frame : <EOL> raise ValueError ( """<STR_LIT>""" ) <EOL> if self . __display : <EOL> self . __display . remove_renderable ( self ) <EOL> self . __display = display <EOL> self . __display . add_renderable ( self ) <EOL> def get_display ( self ) : <EOL> "<STR_LIT>" <EOL> return self . __display <EOL> display = property ( get_display , set_display ) <EOL> def get_frame ( self ) : <EOL> "<STR_LIT>" <EOL> return self . __frame <EOL> def set_frame ( self , frame ) : <EOL> "<STR_LIT>" <EOL> if frame != self . __frame : <EOL> if frame and ( frame . display != self . __display ) : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> if frame and self . __frame : <EOL> self . __frame . remove_renderable ( self ) <EOL> frame . add_renderable ( self ) <EOL> elif frame and not self . __frame : <EOL> if self . __display : <EOL> self . __display . remove_renderable ( self ) <EOL> frame . add_renderable ( self ) <EOL> elif not frame and self . __frame : <EOL> self . __frame . remove_renderable ( self ) <EOL> if self . __display : <EOL> self . __display . add_renderable ( self ) <EOL> self . __frame = frame <EOL> frame = property ( get_frame , set_frame ) <EOL> def get_visible ( self ) : <EOL> "<STR_LIT>" <EOL> return self . __visible <EOL> def set_visible ( self , visible ) : <EOL> "<STR_LIT>" <EOL> if visible and not self . __visible : <EOL> if self . __frame : <EOL> self . __frame . add_renderable ( self ) <EOL> elif self . __display : <EOL> self . __display . add_renderable ( self ) <EOL> if not visible and self . __visible : <EOL> if self . __frame : <EOL> self . __frame . remove_renderable ( self ) <EOL> elif self . __display : <EOL> self . __display . remove_renderable ( self ) <EOL> self . __visible = visible <EOL> visible = property ( get_visible , set_visible ) <EOL> def init_defaults ( self , keywords ) : <EOL> self . color = self . display . foreground <EOL> if isinstance ( self , cvisual . light ) : <EOL> self . color = ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> elif '<STR_LIT>' not in keywords : <EOL> self . material = self . display . material <EOL> def process_init_args_from_keyword_dictionary ( self , keywords ) : <EOL> self . primitive_object = self <EOL> if '<STR_LIT>' in keywords : <EOL> self . axis = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in keywords : <EOL> self . color = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in keywords : <EOL> self . trail_type = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> if not ( self . trail_type == '<STR_LIT>' or self . trail_type == '<STR_LIT>' ) : <EOL> raise RuntimeError ( "<STR_LIT>" + trail_type + "<STR_LIT:'>" ) <EOL> else : <EOL> self . trail_type = '<STR_LIT>' <EOL> self . interval = <NUM_LIT:1> <EOL> if '<STR_LIT>' in keywords : <EOL> self . interval = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in keywords : <EOL> make_trail = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> if self . trail_type == '<STR_LIT>' : <EOL> self . trail_object = curve ( frame = self . __frame , color = self . color ) <EOL> else : <EOL> self . trail_object = points ( frame = self . __frame , color = self . color ) <EOL> if make_trail and self . interval > <NUM_LIT:0> : <EOL> if '<STR_LIT>' in keywords : <EOL> self . pos = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> self . trail_object . pos = self . pos <EOL> self . retain = - <NUM_LIT:1> <EOL> self . interval_count = <NUM_LIT:0> <EOL> self . updated = False <EOL> trail_list . append ( self ) <EOL> else : <EOL> make_trail = None <EOL> for key , value in keywords . items ( ) : <EOL> setattr ( self , key , value ) <EOL> if not ( make_trail is None ) : <EOL> self . make_trail = make_trail <EOL> def trail_update ( obj ) : <EOL> if obj . interval == <NUM_LIT:0> : return <EOL> obj . updated = True <EOL> obj . interval_count += <NUM_LIT:1> <EOL> if len ( obj . trail_object . pos ) == <NUM_LIT:0> : <EOL> obj . trail_object . append ( pos = obj . pos ) <EOL> obj . interval_count -= <NUM_LIT:1> <EOL> if obj . interval_count == obj . interval : <EOL> if obj . pos != obj . trail_object . pos [ - <NUM_LIT:1> ] : <EOL> obj . trail_object . append ( pos = obj . pos , retain = obj . retain ) <EOL> obj . interval_count = <NUM_LIT:0> <EOL> class py_renderable_uniform ( py_renderable ) : <EOL> def check_init_invariants ( self ) : <EOL> if not self . display . uniform : <EOL> raise RuntimeError ( "<STR_LIT>" + self . __class__ . __name__ + "<STR_LIT>" ) <EOL> class py_renderable_arrayobject ( py_renderable ) : <EOL> def get_red ( self ) : <EOL> return self . color [ : , <NUM_LIT:0> ] <EOL> def get_green ( self ) : <EOL> return self . color [ : , <NUM_LIT:1> ] <EOL> def get_blue ( self ) : <EOL> return self . color [ : , <NUM_LIT:2> ] <EOL> def get_x ( self ) : <EOL> return self . pos [ : , <NUM_LIT:0> ] <EOL> def get_y ( self ) : <EOL> return self . pos [ : , <NUM_LIT:1> ] <EOL> def get_z ( self ) : <EOL> return self . pos [ : , <NUM_LIT:2> ] <EOL> def set_opacity ( self , opacity ) : <EOL> raise RuntimeError ( "<STR_LIT>" ) <EOL> opacity = property ( None , set_opacity , None ) <EOL> class distant_light ( py_renderable , cvisual . distant_light ) : <EOL> def set_pos ( self , _ ) : raise AttributeError ( "<STR_LIT>" ) <EOL> pos = property ( None , set_pos ) <EOL> class local_light ( py_renderable , cvisual . local_light ) : <EOL> def set_direction ( self , _ ) : raise AttributeError ( "<STR_LIT>" ) <EOL> direction = property ( None , set_direction ) <EOL> class arrow ( py_renderable_uniform , cvisual . arrow ) : <EOL> pass <EOL> class cone ( py_renderable_uniform , cvisual . cone ) : <EOL> pass <EOL> class cylinder ( py_renderable_uniform , cvisual . cylinder ) : <EOL> pass <EOL> class sphere ( py_renderable_uniform , cvisual . sphere ) : <EOL> pass <EOL> class ring ( py_renderable_uniform , cvisual . ring ) : <EOL> pass <EOL> class box ( py_renderable_uniform , cvisual . box ) : <EOL> pass <EOL> class ellipsoid ( py_renderable_uniform , cvisual . ellipsoid ) : <EOL> pass <EOL> class pyramid ( py_renderable_uniform , cvisual . pyramid ) : <EOL> pass <EOL> def text_to_bitmap ( text , color = ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) , background = ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , opacity = <NUM_LIT:1> , <EOL> height = <NUM_LIT> , font = '<STR_LIT>' , <EOL> style = '<STR_LIT>' , weight = '<STR_LIT>' ) : <EOL> if font == '<STR_LIT>' : <EOL> wfont = _wx . FONTFAMILY_SWISS <EOL> if _plat == '<STR_LIT>' : <EOL> fudge = <NUM_LIT> <EOL> elif _plat == '<STR_LIT>' : <EOL> fudge = <NUM_LIT> <EOL> else : <EOL> fudge = <NUM_LIT> <EOL> elif font == '<STR_LIT>' : <EOL> wfont = _wx . FONTFAMILY_ROMAN <EOL> if _plat == '<STR_LIT>' : <EOL> fudge = <NUM_LIT> <EOL> elif _plat == '<STR_LIT>' : <EOL> fudge = <NUM_LIT> <EOL> else : <EOL> fudge = <NUM_LIT> <EOL> elif font == '<STR_LIT>' : <EOL> wfont = _wx . FONTFAMILY_MODERN <EOL> if _plat == '<STR_LIT>' : <EOL> fudge = <NUM_LIT> <EOL> elif _plat == '<STR_LIT>' : <EOL> fudge = <NUM_LIT> <EOL> else : <EOL> fudge = <NUM_LIT> <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> fudge /= <NUM_LIT> <EOL> if style == '<STR_LIT>' : <EOL> wstyle = _wx . FONTSTYLE_NORMAL <EOL> elif style == '<STR_LIT>' : <EOL> wstyle = _wx . FONTSTYLE_ITALIC <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> if weight == '<STR_LIT>' : <EOL> wweight = _wx . FONTWEIGHT_NORMAL <EOL> elif weight == '<STR_LIT>' : <EOL> wweight = _wx . FONTWEIGHT_BOLD <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> dc = _wx . MemoryDC ( ) <EOL> height = int ( fudge * height + <NUM_LIT:0.5> ) <EOL> dc . SetFont ( _wx . Font ( height , wfont , wstyle , wweight ) ) <EOL> while text and text [ <NUM_LIT:0> ] == '<STR_LIT:\n>' : text = text [ <NUM_LIT:1> : ] <EOL> while text and text [ - <NUM_LIT:1> ] == '<STR_LIT:\n>' : text = text [ : - <NUM_LIT:1> ] <EOL> lines = text . split ( '<STR_LIT:\n>' ) <EOL> maxwidth = <NUM_LIT:0> <EOL> totalheight = <NUM_LIT:0> <EOL> heights = [ ] <EOL> for line in lines : <EOL> if line == '<STR_LIT>' : line = '<STR_LIT:U+0020>' <EOL> w , h = dc . GetTextExtent ( line ) <EOL> h += <NUM_LIT:1> <EOL> w += <NUM_LIT:2> <EOL> if w > maxwidth : maxwidth = w <EOL> heights . append ( totalheight ) <EOL> totalheight += h <EOL> if '<STR_LIT>' in _wx . PlatformInfo : <EOL> bmp = _wx . Bitmap ( maxwidth , totalheight ) <EOL> else : <EOL> bmp = _wx . EmptyBitmap ( maxwidth , totalheight ) <EOL> dc . SelectObject ( bmp ) <EOL> fore = ( int ( <NUM_LIT:255> * color [ <NUM_LIT:0> ] ) , <EOL> int ( <NUM_LIT:255> * color [ <NUM_LIT:1> ] ) , <EOL> int ( <NUM_LIT:255> * color [ <NUM_LIT:2> ] ) ) <EOL> dc . SetTextForeground ( fore ) <EOL> back = ( int ( <NUM_LIT:255> * background [ <NUM_LIT:0> ] ) , <EOL> int ( <NUM_LIT:255> * background [ <NUM_LIT:1> ] ) , <EOL> int ( <NUM_LIT:255> * background [ <NUM_LIT:2> ] ) ) <EOL> if ( back == fore ) : <EOL> if fore == ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) : back = ( <NUM_LIT:255> , <NUM_LIT:255> , <NUM_LIT:255> ) <EOL> elif fore == ( <NUM_LIT:255> , <NUM_LIT:255> , <NUM_LIT:255> ) : back = ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> else : back = ( fore [ <NUM_LIT:0> ] // <NUM_LIT:2> , fore [ <NUM_LIT:1> ] // <NUM_LIT:2> , fore [ <NUM_LIT:2> ] // <NUM_LIT:2> ) <EOL> brush = _wx . Brush ( back ) <EOL> dc . SetBackground ( brush ) <EOL> dc . Clear ( ) <EOL> for n , line in enumerate ( lines ) : <EOL> dc . DrawText ( line , <NUM_LIT:1> , heights [ n ] ) <EOL> dc . SelectObject ( _wx . NullBitmap ) <EOL> if '<STR_LIT>' in _wx . PlatformInfo : <EOL> img = bmp . ConvertToImage ( ) <EOL> data = asarray ( img . GetData ( ) ) <EOL> else : <EOL> img = _wx . ImageFromBitmap ( bmp ) <EOL> data = fromstring ( img . GetData ( ) , dtype = uint8 ) <EOL> return maxwidth , totalheight , back , data <EOL> def get_bitmap ( obj ) : <EOL> w , h , back , data = text_to_bitmap ( obj . text , obj . color , obj . background , obj . opacity , <EOL> obj . height , obj . font , "<STR_LIT>" , "<STR_LIT>" ) <EOL> cvisual . label . set_bitmap ( obj , data , w , h , back [ <NUM_LIT:0> ] , back [ <NUM_LIT:1> ] , back [ <NUM_LIT:2> ] ) <EOL> class label ( py_renderable , cvisual . label ) : <EOL> def init_defaults ( self , keywords ) : <EOL> if '<STR_LIT>' not in keywords : <EOL> self . linecolor = self . display . foreground <EOL> if '<STR_LIT>' not in keywords : <EOL> self . background = self . display . background <EOL> if '<STR_LIT>' not in keywords : <EOL> self . font = '<STR_LIT>' <EOL> super ( label , self ) . init_defaults ( keywords ) <EOL> class frame ( py_renderable_uniform , cvisual . frame ) : <EOL> def set_frame ( self , frame ) : <EOL> frame_iterator = frame <EOL> while frame_iterator : <EOL> if frame_iterator . frame is self : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> frame_iterator = frame_iterator . frame <EOL> py_renderable_uniform . set_frame ( self , frame ) <EOL> class faces ( py_renderable_arrayobject , cvisual . faces ) : <EOL> def set_pos ( self , positions ) : <EOL> A = array ( positions ) <EOL> if len ( self . pos ) == A . shape [ <NUM_LIT:0> ] : <EOL> self . pos [ : A . shape [ <NUM_LIT:0> ] ] = A <EOL> else : <EOL> cvisual . faces . set_pos ( self , A ) <EOL> def set_normal ( self , normals ) : <EOL> A = array ( normals ) <EOL> if len ( self . normal ) == A . shape [ <NUM_LIT:0> ] : <EOL> self . normal [ : A . shape [ <NUM_LIT:0> ] ] = A <EOL> else : <EOL> cvisual . faces . set_normal ( self , A ) <EOL> def set_color ( self , colors ) : <EOL> A = array ( colors ) <EOL> if len ( self . color ) == A . shape [ <NUM_LIT:0> ] : <EOL> self . color [ : A . shape [ <NUM_LIT:0> ] ] = A <EOL> else : <EOL> cvisual . faces . set_color ( self , A ) <EOL> pos = property ( cvisual . faces . get_pos , set_pos , None ) <EOL> normal = property ( cvisual . faces . get_normal , set_normal , None ) <EOL> color = property ( cvisual . faces . get_color , set_color , None ) <EOL> red = property ( py_renderable_arrayobject . get_red , cvisual . faces . set_red , None ) <EOL> green = property ( py_renderable_arrayobject . get_green , cvisual . faces . set_green , None ) <EOL> blue = property ( py_renderable_arrayobject . get_blue , cvisual . faces . set_blue , None ) <EOL> class curve ( py_renderable_arrayobject , cvisual . curve ) : <EOL> def set_pos ( self , positions ) : <EOL> try : <EOL> self . up = positions . up <EOL> cvisual . curve . set_pos ( self , array ( positions . pos ) ) <EOL> return <EOL> except : <EOL> pass <EOL> try : <EOL> pts = positions . contour ( <NUM_LIT:0> ) <EOL> except : <EOL> A = array ( positions ) <EOL> if len ( self . pos ) > <NUM_LIT:0> and len ( self . pos ) == A . shape [ <NUM_LIT:0> ] : <EOL> self . pos [ : A . shape [ <NUM_LIT:0> ] ] = A <EOL> else : <EOL> cvisual . curve . set_pos ( self , A ) <EOL> return <EOL> if len ( positions ) > <NUM_LIT:1> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> newpts = [ ] <EOL> for pt in pts : <EOL> newpt = vector ( pt [ <NUM_LIT:0> ] , <NUM_LIT:0> , - pt [ <NUM_LIT:1> ] ) <EOL> newpts . append ( newpt ) <EOL> if newpts [ - <NUM_LIT:1> ] != newpts [ <NUM_LIT:0> ] : <EOL> newpts . append ( newpts [ <NUM_LIT:0> ] ) <EOL> cvisual . curve . set_pos ( self , array ( newpts ) ) <EOL> def set_color ( self , colors ) : <EOL> A = array ( colors ) <EOL> if len ( self . color ) == A . shape [ <NUM_LIT:0> ] : <EOL> self . color [ : A . shape [ <NUM_LIT:0> ] ] = A <EOL> else : <EOL> cvisual . curve . set_color ( self , A ) <EOL> pos = property ( cvisual . curve . get_pos , set_pos , None ) <EOL> color = property ( cvisual . curve . get_color , set_color , None ) <EOL> x = property ( py_renderable_arrayobject . get_x , cvisual . curve . set_x , None ) <EOL> y = property ( py_renderable_arrayobject . get_y , cvisual . curve . set_y , None ) <EOL> z = property ( py_renderable_arrayobject . get_z , cvisual . curve . set_z , None ) <EOL> red = property ( py_renderable_arrayobject . get_red , cvisual . curve . set_red , None ) <EOL> green = property ( py_renderable_arrayobject . get_green , cvisual . curve . set_green , None ) <EOL> blue = property ( py_renderable_arrayobject . get_blue , cvisual . curve . set_blue , None ) <EOL> class extrusion ( py_renderable_uniform , py_renderable_arrayobject , cvisual . extrusion ) : <EOL> def get_faces ( self ) : <EOL> current_visible = self . visible <EOL> self . visible = False <EOL> data = self . _faces_render ( ) <EOL> self . visible = current_visible <EOL> L = len ( data ) / <NUM_LIT:3> <EOL> return ( data [ : L ] , data [ L : <NUM_LIT:2> * L ] , data [ <NUM_LIT:2> * L : ] ) <EOL> def create_faces ( self , keep = False ) : <EOL> currentvisible = self . visible <EOL> if self . frame : <EOL> fcurrentvisible = self . frame . visible <EOL> ( pos , normal , color ) = self . get_faces ( ) <EOL> self . visible = False <EOL> newfaces = faces ( frame = self . frame , pos = pos , normal = normal , color = color , <EOL> material = self . material , visible = currentvisible , <EOL> display = self . display , up = self . up ) <EOL> if newfaces . frame : <EOL> newfaces . frame . visible = fcurrentvisible <EOL> if not keep : <EOL> self . pos = [ ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ] <EOL> self . shape = [ ( <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:1> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , <NUM_LIT:0> ) ] <EOL> self . color = [ ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ] <EOL> self . show_start_face = False <EOL> self . show_end_face = False <EOL> self . material = None <EOL> return newfaces <EOL> def xycurl ( self , s ) : <EOL> c = <NUM_LIT:0> <EOL> for i in range ( len ( s ) - <NUM_LIT:1> ) : <EOL> x1 = s [ i ] [ <NUM_LIT:0> ] <EOL> y1 = s [ i ] [ <NUM_LIT:1> ] <EOL> x2 = s [ i + <NUM_LIT:1> ] [ <NUM_LIT:0> ] <EOL> y2 = s [ i + <NUM_LIT:1> ] [ <NUM_LIT:1> ] <EOL> c += x1 * ( y2 - y1 ) - y1 * ( x2 - x1 ) <EOL> return c <EOL> def xzcurl ( self , s ) : <EOL> c = <NUM_LIT:0> <EOL> for i in range ( len ( s ) - <NUM_LIT:1> ) : <EOL> x1 = s [ i ] [ <NUM_LIT:0> ] <EOL> z1 = s [ i ] [ <NUM_LIT:2> ] <EOL> x2 = s [ i + <NUM_LIT:1> ] [ <NUM_LIT:0> ] <EOL> z2 = s [ i + <NUM_LIT:1> ] [ <NUM_LIT:2> ] <EOL> c += z1 * ( x2 - x1 ) - x1 * ( z2 - z1 ) <EOL> return c <EOL> def make_shapedata ( self , datalist , closed ) : <EOL> ncontours = len ( datalist ) <EOL> pointers = zeros ( shape = ( ncontours + <NUM_LIT:1> , <NUM_LIT:2> ) , dtype = int32 ) <EOL> pointers [ <NUM_LIT:0> ] = ( ncontours , closed ) <EOL> datalength = <NUM_LIT:0> <EOL> for i , c in enumerate ( datalist ) : <EOL> length = len ( c ) <EOL> pointers [ i + <NUM_LIT:1> ] = ( length , datalength ) <EOL> datalength += length <EOL> contours = zeros ( shape = ( datalength , <NUM_LIT:2> ) , dtype = float64 ) <EOL> for i , c in enumerate ( datalist ) : <EOL> contours [ pointers [ i + <NUM_LIT:1> ] [ <NUM_LIT:1> ] : pointers [ i + <NUM_LIT:1> ] [ <NUM_LIT:1> ] + pointers [ i + <NUM_LIT:1> ] [ <NUM_LIT:0> ] ] = c <EOL> return contours , pointers <EOL> def set_shape ( self , shape ) : <EOL> if not import_check ( "<STR_LIT>" ) : <EOL> return <EOL> datalist = [ ] <EOL> if isinstance ( shape , str ) : <EOL> shape = shapes . text ( text = shape , align = '<STR_LIT>' ) <EOL> else : <EOL> try : <EOL> shape . pos <EOL> s = [ ] <EOL> for v in shape . pos : <EOL> s . append ( ( v . x , - v . z ) ) <EOL> shape = Polygon ( s ) <EOL> except : <EOL> pass <EOL> try : <EOL> for i in range ( len ( shape ) ) : <EOL> s = list ( shape . contour ( i ) ) <EOL> if s [ - <NUM_LIT:1> ] == s [ <NUM_LIT:0> ] : <EOL> s = s [ : - <NUM_LIT:1> ] <EOL> c = self . xycurl ( s ) <EOL> if ( shape . isHole ( i ) and ( c < <NUM_LIT:0> ) or <EOL> ( not shape . isHole ( i ) ) and ( c > <NUM_LIT:0> ) ) : <EOL> s . reverse ( ) <EOL> datalist . append ( s ) <EOL> closed = True <EOL> isPolygon = True <EOL> except : <EOL> s = shape <EOL> if self . xycurl ( s ) > <NUM_LIT:0> : <EOL> s . reverse ( ) <EOL> if s [ - <NUM_LIT:1> ] == s [ <NUM_LIT:0> ] : <EOL> s = s [ : - <NUM_LIT:1> ] <EOL> closed = True <EOL> else : <EOL> closed = False <EOL> isPolygon = False <EOL> datalist = array ( [ s ] , float ) <EOL> contours , pcontours = self . make_shapedata ( datalist , closed ) <EOL> if isPolygon : <EOL> strips , pstrips = self . make_shapedata ( shape . triStrip ( ) , closed ) <EOL> else : <EOL> strips = array ( [ ( <NUM_LIT:0> , <NUM_LIT:0> ) ] ) <EOL> pstrips = array ( [ ( <NUM_LIT:0> , <NUM_LIT:0> ) ] ) <EOL> self . set_contours ( contours , pcontours , strips , pstrips ) <EOL> def set_pos ( self , positions ) : <EOL> if not import_check ( "<STR_LIT>" ) : <EOL> return <EOL> try : <EOL> self . up = positions . up <EOL> cvisual . extrusion . set_pos ( self , array ( positions . pos ) ) <EOL> return <EOL> except : <EOL> pass <EOL> try : <EOL> pts = positions . contour ( <NUM_LIT:0> ) <EOL> except : <EOL> cvisual . extrusion . set_pos ( self , array ( positions ) ) <EOL> return <EOL> if len ( positions ) > <NUM_LIT:1> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> newpts = [ ] <EOL> for pt in pts : <EOL> newpt = vector ( pt [ <NUM_LIT:0> ] , <NUM_LIT:0> , - pt [ <NUM_LIT:1> ] ) <EOL> newpts . append ( newpt ) <EOL> if newpts [ - <NUM_LIT:1> ] != newpts [ <NUM_LIT:0> ] : <EOL> newpts . append ( newpts [ <NUM_LIT:0> ] ) <EOL> if self . xzcurl ( newpts ) < <NUM_LIT:0> : <EOL> newpts . reverse ( ) <EOL> cvisual . extrusion . set_pos ( self , array ( newpts ) ) <EOL> def get_xscale ( self ) : <EOL> return self . scale [ : , <NUM_LIT:0> ] <EOL> def get_yscale ( self ) : <EOL> return self . scale [ : , <NUM_LIT:1> ] <EOL> def get_shape ( self ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> pos = property ( cvisual . extrusion . get_pos , set_pos , None ) <EOL> color = property ( cvisual . extrusion . get_color , cvisual . extrusion . set_color , None ) <EOL> x = property ( py_renderable_arrayobject . get_x , cvisual . extrusion . set_x , None ) <EOL> y = property ( py_renderable_arrayobject . get_y , cvisual . extrusion . set_y , None ) <EOL> z = property ( py_renderable_arrayobject . get_z , cvisual . extrusion . set_z , None ) <EOL> red = property ( py_renderable_arrayobject . get_red , cvisual . extrusion . set_red , None ) <EOL> green = property ( py_renderable_arrayobject . get_green , cvisual . extrusion . set_green , None ) <EOL> blue = property ( py_renderable_arrayobject . get_blue , cvisual . extrusion . set_blue , None ) <EOL> shape = property ( get_shape , set_shape , None ) <EOL> scale = property ( cvisual . extrusion . get_scale , cvisual . extrusion . set_scale , None ) <EOL> xscale = property ( get_xscale , cvisual . extrusion . set_xscale , None ) <EOL> yscale = property ( get_yscale , cvisual . extrusion . set_yscale , None ) <EOL> twist = property ( cvisual . extrusion . get_twist , cvisual . extrusion . set_twist , None ) <EOL> class points ( py_renderable_arrayobject , cvisual . points ) : <EOL> pos = property ( cvisual . points . get_pos , cvisual . points . set_pos , None ) <EOL> color = property ( cvisual . points . get_color , cvisual . points . set_color , None ) <EOL> x = property ( py_renderable_arrayobject . get_x , cvisual . points . set_x , None ) <EOL> y = property ( py_renderable_arrayobject . get_y , cvisual . points . set_y , None ) <EOL> z = property ( py_renderable_arrayobject . get_z , cvisual . points . set_z , None ) <EOL> red = property ( py_renderable_arrayobject . get_red , cvisual . points . set_red , None ) <EOL> green = property ( py_renderable_arrayobject . get_green , cvisual . points . set_green , None ) <EOL> blue = property ( py_renderable_arrayobject . get_blue , cvisual . points . set_blue , None ) <EOL> class convex ( py_renderable_arrayobject , py_renderable_uniform , cvisual . convex ) : <EOL> pos = property ( cvisual . convex . get_pos , cvisual . convex . set_pos , None ) <EOL> class helix ( py_renderable_uniform , py_renderable ) : <EOL> def __init__ ( self , _other = None , pos = vector ( ) , <EOL> x = None , y = None , z = None , red = None , green = None , blue = None , <EOL> axis = vector ( <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> ) , radius = <NUM_LIT:1.0> , length = None , up = vector ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> ) , <EOL> coils = <NUM_LIT:5> , thickness = None , color = color . white , visible = True , ** keywords ) : <EOL> if '<STR_LIT>' in keywords : <EOL> disp = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> else : <EOL> disp = cvisual . display_kernel . get_selected ( ) <EOL> if ( not disp . uniform ) : <EOL> raise RuntimeError ( "<STR_LIT>" ) <EOL> if '<STR_LIT>' in keywords : <EOL> fr = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> else : <EOL> fr = None <EOL> self . process_init_args_from_keyword_dictionary ( keywords ) <EOL> if x is not None : <EOL> pos [ <NUM_LIT:0> ] = x <EOL> if y is not None : <EOL> pos [ <NUM_LIT:1> ] = y <EOL> if z is not None : <EOL> pos [ <NUM_LIT:2> ] = z <EOL> if red is not None : <EOL> color [ <NUM_LIT:0> ] = red <EOL> if green is not None : <EOL> color [ <NUM_LIT:1> ] = green <EOL> if blue is not None : <EOL> color [ <NUM_LIT:2> ] = blue <EOL> self . __color = color <EOL> axis = vector ( axis ) <EOL> if length is None : <EOL> length = axis . mag <EOL> self . __length = length <EOL> self . __axis = axis <EOL> self . __radius = radius <EOL> self . __up = up <EOL> self . __coils = coils <EOL> self . __thickness = radius / <NUM_LIT> <EOL> if thickness : <EOL> self . __thickness = thickness <EOL> self . __frame = frame ( display = disp , frame = fr , pos = pos , axis = axis . norm ( ) , up = up ) <EOL> self . helix = curve ( frame = self . __frame , radius = self . __thickness / <NUM_LIT> , <EOL> color = color ) <EOL> self . create_pos ( ) <EOL> def create_pos ( self ) : <EOL> k = self . coils * ( <NUM_LIT:2> * pi / self . __length ) <EOL> dx = ( self . length / self . coils ) / NCHORDS <EOL> x_col = arange ( <NUM_LIT:0> , self . __length + dx , dx ) <EOL> pos_data = zeros ( ( len ( x_col ) , <NUM_LIT:3> ) , float64 ) <EOL> pos_data [ : , <NUM_LIT:0> ] = arange ( <NUM_LIT:0> , self . __length + dx , dx ) <EOL> pos_data [ : , <NUM_LIT:1> ] = ( self . radius ) * sin ( k * pos_data [ : , <NUM_LIT:0> ] ) <EOL> pos_data [ : , <NUM_LIT:2> ] = ( self . radius ) * cos ( k * pos_data [ : , <NUM_LIT:0> ] ) <EOL> self . helix . pos = pos_data <EOL> def set_pos ( self , pos ) : <EOL> self . __frame . pos = vector ( pos ) <EOL> def get_pos ( self ) : <EOL> return self . __frame . pos <EOL> def set_x ( self , x ) : <EOL> self . __frame . pos . x = x <EOL> def get_x ( self ) : <EOL> return self . __frame . pos . x <EOL> def set_y ( self , y ) : <EOL> self . __frame . pos . y = y <EOL> def get_y ( self ) : <EOL> return self . __frame . pos . y <EOL> def set_z ( self , z ) : <EOL> self . __frame . pos . z = z <EOL> def get_z ( self ) : <EOL> return self . __frame . pos . z <EOL> def set_color ( self , color ) : <EOL> self . __color = self . helix . color = color <EOL> def get_color ( self ) : <EOL> return self . __color <EOL> def set_red ( self , red ) : <EOL> self . helix . red = red <EOL> def get_red ( self ) : <EOL> return self . helix . red <EOL> def set_green ( self , green ) : <EOL> self . helix . green = green <EOL> def get_green ( self ) : <EOL> return self . helix . green <EOL> def set_blue ( self , blue ) : <EOL> self . helix . blue = blue <EOL> def get_blue ( self ) : <EOL> return self . helix . blue <EOL> def set_radius ( self , radius ) : <EOL> scale = radius / self . __radius <EOL> self . __radius = radius <EOL> self . helix . y *= scale <EOL> self . helix . z *= scale <EOL> def get_radius ( self ) : <EOL> return self . __radius <EOL> def set_axis ( self , axis ) : <EOL> axis = vector ( axis ) <EOL> self . __axis = axis <EOL> self . __frame . axis = axis . norm ( ) <EOL> self . set_length ( axis . mag ) <EOL> def get_axis ( self ) : <EOL> return self . __axis <EOL> def set_length ( self , length ) : <EOL> self . helix . x *= ( length / self . __length ) <EOL> self . __length = length <EOL> self . __frame . axis = self . __axis . norm ( ) <EOL> self . __axis = length * self . __frame . axis <EOL> def get_length ( self ) : <EOL> return self . __length <EOL> def set_coils ( self , coils ) : <EOL> if self . __coils == coils : return <EOL> self . __coils = coils <EOL> self . create_pos ( ) <EOL> def get_coils ( self ) : <EOL> return self . __coils <EOL> def set_thickness ( self , thickness ) : <EOL> if self . __thickness == thickness : return <EOL> self . __thickness = thickness <EOL> self . helix . radius = thickness / <NUM_LIT> <EOL> def get_thickness ( self ) : <EOL> return self . __thickness <EOL> def set_display ( self , disp ) : <EOL> self . helix . display = self . frame . display = disp <EOL> def get_display ( self ) : <EOL> return self . helix . display <EOL> def set_frame ( self , fr ) : <EOL> self . __frame . frame = fr <EOL> def get_frame ( self ) : <EOL> return self . __frame . frame <EOL> def set_up ( self , up ) : <EOL> self . __frame . up = up <EOL> def get_up ( self ) : <EOL> return self . __frame . up <EOL> def set_visible ( self , visible ) : <EOL> self . helix . visible = visible <EOL> def get_visible ( self ) : <EOL> return self . helix . visible <EOL> pos = property ( get_pos , set_pos , None ) <EOL> x = property ( get_x , set_x , None ) <EOL> y = property ( get_y , set_y , None ) <EOL> z = property ( get_z , set_z , None ) <EOL> color = property ( get_color , set_color , None ) <EOL> red = property ( get_red , set_red , None ) <EOL> green = property ( get_green , set_green , None ) <EOL> blue = property ( get_blue , set_blue , None ) <EOL> axis = property ( get_axis , set_axis , None ) <EOL> radius = property ( get_radius , set_radius , None ) <EOL> coils = property ( get_coils , set_coils , None ) <EOL> thickness = property ( get_thickness , set_thickness , None ) <EOL> length = property ( get_length , set_length , None ) <EOL> display = property ( get_display , set_display , None ) <EOL> frame = property ( get_frame , set_frame , None ) <EOL> up = property ( get_up , set_up , None ) <EOL> visible = property ( get_visible , set_visible , None ) <EOL> class text ( object ) : <EOL> def __init__ ( self , pos = ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , axis = ( <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> ) , up = ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> ) , height = <NUM_LIT:1> , color = color . white , <EOL> x = None , y = None , z = None , red = None , green = None , blue = None , <EOL> text = "<STR_LIT>" , font = "<STR_LIT>" , align = '<STR_LIT:left>' , visible = True , twosided = True , <EOL> depth = <NUM_LIT> , material = None , spacing = <NUM_LIT> , vertical_spacing = None , ** keywords ) : <EOL> if not import_check ( "<STR_LIT>" ) : <EOL> return <EOL> self . initial = True <EOL> self . __text = text <EOL> if '<STR_LIT>' in keywords : <EOL> self . __display = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> else : <EOL> self . __display = cvisual . display_kernel . get_selected ( ) <EOL> if ( not self . display . uniform ) : <EOL> raise RuntimeError ( "<STR_LIT>" ) <EOL> if '<STR_LIT>' in keywords : <EOL> fr = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> else : <EOL> fr = None <EOL> if x is not None : <EOL> pos [ <NUM_LIT:0> ] = x <EOL> if y is not None : <EOL> pos [ <NUM_LIT:1> ] = y <EOL> if z is not None : <EOL> pos [ <NUM_LIT:2> ] = z <EOL> if red is not None : <EOL> color [ <NUM_LIT:0> ] = red <EOL> if green is not None : <EOL> color [ <NUM_LIT:1> ] = green <EOL> if blue is not None : <EOL> color [ <NUM_LIT:2> ] = blue <EOL> self . __color = color <EOL> self . __material = material <EOL> self . __visible = visible <EOL> self . __up = up <EOL> self . __twosided = twosided <EOL> self . __font = font <EOL> self . __height = float ( height ) <EOL> self . __spacing = spacing <EOL> self . __vertical_spacing = vertical_spacing <EOL> try : <EOL> if len ( depth ) == <NUM_LIT:3> : <EOL> self . __depth = vector ( depth ) <EOL> except : <EOL> self . __depth = vector ( <NUM_LIT:0> , <NUM_LIT:0> , depth ) <EOL> self . __frame = frame ( display = self . __display , frame = fr , pos = pos , axis = vector ( axis ) . norm ( ) , up = up ) <EOL> self . check_align ( align ) <EOL> self . paintText ( ) <EOL> self . initial = False <EOL> def get_faces ( self ) : <EOL> current_visible = self . visible <EOL> self . visible = False <EOL> data = self . extrusion . _faces_render ( ) <EOL> self . visible = current_visible <EOL> L = len ( data ) / <NUM_LIT:3> <EOL> return ( data [ : L ] , data [ L : <NUM_LIT:2> * L ] , data [ <NUM_LIT:2> * L : ] ) <EOL> def create_faces ( self , keep = False ) : <EOL> currentvisible = self . visible <EOL> if self . frame : <EOL> fcurrentvisible = self . frame . visible <EOL> ( pos , normal , color ) = self . extrusion . get_faces ( ) <EOL> self . visible = False <EOL> newfaces = faces ( frame = self . frame , pos = pos , normal = normal , color = color , <EOL> material = self . material , visible = currentvisible , <EOL> display = self . display , up = self . up ) <EOL> if newfaces . frame : <EOL> newfaces . frame . visible = fcurrentvisible <EOL> if not keep : <EOL> self . text = "<STR_LIT>" <EOL> self . extrusion . pos = [ ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ] <EOL> self . extrusion . shape = [ ( <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:1> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , <NUM_LIT:0> ) ] <EOL> self . extrusion . color = [ ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ] <EOL> self . extrusion . show_start_face = False <EOL> self . extrusion . show_end_face = False <EOL> return newfaces <EOL> def fontlist ( self ) : <EOL> return shapes . findSystemFonts ( ) <EOL> def destroyText ( self ) : <EOL> try : <EOL> self . extrusion . visible = False <EOL> del self . extrusion <EOL> except : <EOL> pass <EOL> def paintText ( self ) : <EOL> if not self . initial : <EOL> self . destroyText ( ) <EOL> shape = shapes . text ( text = self . __text , font = self . __font , <EOL> align = self . __align , height = self . __height , info = True , <EOL> spacing = self . __spacing , vertical_spacing = self . __vertical_spacing ) <EOL> dy = self . __height - ( shape . upper_left . y - shape . lower_left . y ) / <NUM_LIT:2> <EOL> if self . __align == '<STR_LIT:left>' : <EOL> self . displace = vector ( shape . width / <NUM_LIT:2> , dy , <NUM_LIT:0> ) <EOL> dstart = vector ( <NUM_LIT:0> , dy , <NUM_LIT:0> ) <EOL> elif self . __align == '<STR_LIT:right>' : <EOL> self . displace = vector ( - shape . width / <NUM_LIT:2> , dy , <NUM_LIT:0> ) <EOL> dstart = vector ( <NUM_LIT:0> , dy , <NUM_LIT:0> ) <EOL> else : <EOL> self . displace = vector ( <NUM_LIT:0> , dy , <NUM_LIT:0> ) <EOL> dstart = vector ( <NUM_LIT:0> , dy , <NUM_LIT:0> ) <EOL> self . __start = shape . start + dstart <EOL> ystart = self . __start . y <EOL> for line in range ( len ( shape . starts ) ) : <EOL> shape . starts [ line ] = vector ( shape . starts [ line ] . x , ystart - line * shape . vertical_spacing , <NUM_LIT:0> ) <EOL> self . __starts = shape . starts <EOL> self . __width = shape . width <EOL> self . __widths = shape . widths <EOL> self . __descent = shape . descent <EOL> self . __vertical_spacing = shape . vertical_spacing <EOL> self . __upper_left = shape . upper_left + self . displace <EOL> self . __upper_right = shape . upper_right + self . displace <EOL> self . __lower_left = shape . lower_left + self . displace <EOL> self . __lower_right = shape . lower_right + self . displace <EOL> depthmag = ( self . __depth ) . mag <EOL> if self . __depth . z <= <NUM_LIT:0> : <EOL> p = [ self . displace + vector ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , self . displace + vector ( <NUM_LIT:0> , <NUM_LIT:0> , - depthmag ) ] <EOL> else : <EOL> p = [ self . displace + vector ( <NUM_LIT:0> , <NUM_LIT:0> , depthmag ) , self . displace + vector ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ] <EOL> self . extrusion = extrusion ( frame = self . __frame , pos = p , shape = shape . Polygon , <EOL> color = self . __color , material = self . __material , twosided = self . __twosided ) <EOL> def rotate ( self , angle = <NUM_LIT:0> , axis = None , origin = None ) : <EOL> if axis is None : <EOL> axis = self . __display . up <EOL> if origin is None : <EOL> origin = self . __frame . pos <EOL> self . __frame . rotate ( origin = vector ( origin ) , angle = angle , axis = vector ( axis ) ) <EOL> def set_text ( self , text ) : <EOL> if self . __text == text : return <EOL> self . destroyText ( ) <EOL> self . __text = text <EOL> self . paintText ( ) <EOL> def get_text ( self ) : <EOL> return self . __text <EOL> def check_align ( self , align ) : <EOL> if align == '<STR_LIT:left>' or align == '<STR_LIT:right>' or align == '<STR_LIT>' : <EOL> self . __align = align <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> def set_align ( self , align ) : <EOL> oldalign = self . __align <EOL> self . check_align ( align ) <EOL> if align == '<STR_LIT:left>' : <EOL> displace = <NUM_LIT:0> <EOL> elif align == '<STR_LIT:right>' : <EOL> displace = - self . __width <EOL> else : <EOL> displace = - self . __width / <NUM_LIT:2> <EOL> if oldalign == '<STR_LIT:left>' : <EOL> if align == '<STR_LIT:left>' : return <EOL> displace += <NUM_LIT:0> <EOL> elif oldalign == '<STR_LIT:right>' : <EOL> if align == '<STR_LIT:right>' : return <EOL> displace += self . __width <EOL> else : <EOL> if align == '<STR_LIT>' : return <EOL> displace += self . __width / <NUM_LIT:2> <EOL> if displace == <NUM_LIT:0> : return <EOL> self . extrusion . pos [ ... , <NUM_LIT:0> ] += displace <EOL> displace = vector ( displace , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> self . __start += displace <EOL> self . __upper_left += displace <EOL> self . __upper_right += displace <EOL> self . __lower_left += displace <EOL> self . __lower_right += displace <EOL> for s in self . __starts : <EOL> s += displace <EOL> def get_align ( self ) : <EOL> return self . __align <EOL> def set_font ( self , font ) : <EOL> if self . __font == font : return <EOL> self . __font = font <EOL> self . paintText ( ) <EOL> def get_font ( self ) : <EOL> return self . __font <EOL> def set_height ( self , height ) : <EOL> height = float ( height ) <EOL> if height == self . height : return <EOL> oldheight = self . __height <EOL> self . __height = height <EOL> factor = height / oldheight <EOL> self . extrusion . scale *= factor <EOL> self . __descent *= factor <EOL> self . __vertical_spacing *= factor <EOL> self . displace *= factor <EOL> self . extrusion . pos *= factor <EOL> self . __width *= factor <EOL> for n in range ( len ( self . __widths ) ) : <EOL> self . __widths [ n ] *= factor <EOL> self . __start *= factor <EOL> self . __upper_left *= factor <EOL> self . __upper_right *= factor <EOL> self . __lower_left *= factor <EOL> self . __lower_right *= factor <EOL> for s in self . __starts : <EOL> s *= factor <EOL> def get_height ( self ) : <EOL> return self . __height <EOL> def set_depth ( self , depth ) : <EOL> olddepth = self . __depth <EOL> try : <EOL> if len ( depth ) == <NUM_LIT:3> : <EOL> self . __depth = vector ( depth ) <EOL> except : <EOL> self . __depth = vector ( <NUM_LIT:0> , <NUM_LIT:0> , depth ) <EOL> if ( self . __depth - olddepth ) . mag == <NUM_LIT:0> : return <EOL> depthmag = ( self . __depth ) . mag <EOL> if self . __depth . z <= <NUM_LIT:0> : <EOL> self . extrusion . pos = [ self . displace + vector ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , self . displace + vector ( <NUM_LIT:0> , <NUM_LIT:0> , - depthmag ) ] <EOL> self . __frame . axis = ( vector ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> ) . cross ( - self . __depth ) ) . norm ( ) <EOL> else : <EOL> self . extrusion . pos = [ self . displace + vector ( <NUM_LIT:0> , <NUM_LIT:0> , depthmag ) , self . displace + vector ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ] <EOL> self . __frame . axis = ( vector ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> ) . cross ( self . __depth ) ) . norm ( ) <EOL> def get_depth ( self ) : <EOL> return self . __depth <EOL> def set_width ( self , temp ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def get_width ( self ) : <EOL> return self . __width <EOL> def set_widths ( self , temp ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def get_widths ( self ) : <EOL> return self . __widths <EOL> def set_descent ( self , temp ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def get_descent ( self ) : <EOL> return abs ( self . __descent ) <EOL> def set_spacing ( self , spacing ) : <EOL> if self . __spacing == spacing : return <EOL> self . __spacing = spacing <EOL> self . paintText ( ) <EOL> def get_spacing ( self ) : <EOL> return self . __spacing <EOL> def set_vertical_spacing ( self , vspace ) : <EOL> old = self . __vertical_spacing <EOL> if vspace == old : return <EOL> self . __vertical_spacing = vspace <EOL> self . paintText ( ) <EOL> def get_vertical_spacing ( self ) : <EOL> return self . __vertical_spacing <EOL> def set_upper_left ( self , temp ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def get_upper_left ( self ) : <EOL> return self . __frame . frame_to_world ( self . __upper_left ) <EOL> def set_upper_right ( self , temp ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def get_upper_right ( self ) : <EOL> return self . __frame . frame_to_world ( self . __upper_right ) <EOL> def set_lower_left ( self , temp ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def get_lower_left ( self ) : <EOL> return self . __frame . frame_to_world ( self . __lower_left ) <EOL> def set_lower_right ( self , temp ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def get_lower_right ( self ) : <EOL> return self . __frame . frame_to_world ( self . __lower_right ) <EOL> def set_start ( self , temp ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def get_start ( self ) : <EOL> return self . __frame . frame_to_world ( self . __start ) <EOL> def set_starts ( self , temp ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def get_starts ( self ) : <EOL> s = [ ] <EOL> for L in self . __starts : <EOL> s . append ( self . __frame . frame_to_world ( L ) ) <EOL> return s <EOL> def set_pos ( self , pos ) : <EOL> self . __frame . pos = vector ( pos ) <EOL> def get_pos ( self ) : <EOL> return self . __frame . pos <EOL> def set_x ( self , x ) : <EOL> self . __frame . pos . x = x <EOL> def get_x ( self ) : <EOL> return self . __frame . pos . x <EOL> def set_y ( self , y ) : <EOL> self . __frame . pos . y = y <EOL> def get_y ( self ) : <EOL> return self . __frame . pos . y <EOL> def set_z ( self , z ) : <EOL> self . __frame . pos . z = z <EOL> def get_z ( self ) : <EOL> return self . __frame . pos . z <EOL> def set_material ( self , material ) : <EOL> self . extrusion . material = material <EOL> def get_material ( self ) : <EOL> return self . __material <EOL> def set_color ( self , color ) : <EOL> self . extrusion . color = color <EOL> self . __color = color <EOL> def get_color ( self ) : <EOL> return self . __color <EOL> def set_red ( self , red ) : <EOL> self . __color = ( red , self . __color [ <NUM_LIT:1> ] , self . __color [ <NUM_LIT:2> ] ) <EOL> self . set_color ( self . __color ) <EOL> def get_red ( self ) : <EOL> return self . __color [ <NUM_LIT:0> ] <EOL> def set_green ( self , green ) : <EOL> self . __color = ( self . __color [ <NUM_LIT:0> ] , green , self . __color [ <NUM_LIT:2> ] ) <EOL> self . set_color ( self . __color ) <EOL> def get_green ( self ) : <EOL> return self . __color [ <NUM_LIT:1> ] <EOL> def set_blue ( self , blue ) : <EOL> self . __color = ( self . __color [ <NUM_LIT:0> ] , self . __color [ <NUM_LIT:1> ] , blue ) <EOL> self . set_color ( self . __color ) <EOL> def get_blue ( self ) : <EOL> return self . __color [ <NUM_LIT:2> ] <EOL> def set_axis ( self , axis ) : <EOL> self . __frame . axis = vector ( axis ) . norm ( ) <EOL> def get_axis ( self ) : <EOL> return self . __frame . axis . norm ( ) <EOL> def set_display ( self , disp ) : <EOL> self . __display = self . __frame . display = disp <EOL> def get_display ( self ) : <EOL> return self . __display <EOL> def set_frame ( self , fr ) : <EOL> self . __frame = fr <EOL> def get_frame ( self ) : <EOL> return self . __frame <EOL> def set_up ( self , up ) : <EOL> self . __frame . up = up <EOL> def get_up ( self ) : <EOL> return self . __frame . up <EOL> def set_twosided ( self , twosided ) : <EOL> self . __twosided = twosided <EOL> def get_twosided ( self ) : <EOL> return self . __twosided <EOL> def set_visible ( self , visible ) : <EOL> self . __frame . visible = self . __visible = visible <EOL> def get_visible ( self ) : <EOL> return self . __visible <EOL> pos = property ( get_pos , set_pos , None ) <EOL> x = property ( get_x , set_x , None ) <EOL> y = property ( get_y , set_y , None ) <EOL> z = property ( get_z , set_z , None ) <EOL> text = property ( get_text , set_text , None ) <EOL> align = property ( get_align , set_align , None ) <EOL> font = property ( get_font , set_font , None ) <EOL> height = property ( get_height , set_height , None ) <EOL> color = property ( get_color , set_color , None ) <EOL> material = property ( get_material , set_material , None ) <EOL> red = property ( get_red , set_red , None ) <EOL> green = property ( get_green , set_green , None ) <EOL> blue = property ( get_blue , set_blue , None ) <EOL> axis = property ( get_axis , set_axis , None ) <EOL> depth = property ( get_depth , set_depth , None ) <EOL> display = property ( get_display , set_display , None ) <EOL> frame = property ( get_frame , set_frame , None ) <EOL> up = property ( get_up , set_up , None ) <EOL> visible = property ( get_visible , set_visible , None ) <EOL> width = property ( get_width , set_width , None ) <EOL> widths = property ( get_widths , set_widths , None ) <EOL> descent = property ( get_descent , set_descent , None ) <EOL> vertical_spacing = property ( get_vertical_spacing , set_vertical_spacing , None ) <EOL> upper_left = property ( get_upper_left , set_upper_left , None ) <EOL> upper_right = property ( get_upper_right , set_upper_right , None ) <EOL> lower_left = property ( get_lower_left , set_lower_left , None ) <EOL> lower_right = property ( get_lower_right , set_lower_right , None ) <EOL> start = property ( get_start , set_start , None ) <EOL> starts = property ( get_starts , set_starts , None ) <EOL> spacing = property ( get_spacing , set_spacing , None ) <EOL> twosided = property ( get_twosided , set_twosided , None ) </s>
