Re: Uniform scaling with gdisplay
"Poul Riis" <Poul.Riis-pIBpe43/vk1knbxzx/[email protected]> Sun, 14 Oct 2012 16:21:53 +0200
| Newsgroups | gmane.comp.python.visualpython.user |
|---|---|
| Message-ID | <[email protected]> |
This iss excellent - thank you! Best regards, Poul Riis [email protected] writes: >from __future__ import division, print_function >from visual import * >scene.title = 'Spiral' >scene.width = scene.height = 800 >scene.background = color.white >scene.foreground = color.black >scale = 1 >xaxis = curve(pos=[(-scale,0),(scale,0)], color=color.gray(.5)) >yaxis = curve(pos=[(0,-scale),(0,scale)], color=color.gray(.5)) >xlabel = label(pos=(0.95*scale,-0.05*scale), text='x', box=0) >ylabel = label(pos=(0.05*scale,0.95*scale), text='y', box=0) > >p = points(color=color.blue) >kr = 1 >kt = 1 >t = 0 >dt = pi/360 >while True: >rate(1000) >r = kr*t >theta = kt*t >x = r*cos(theta) >y = r*sin(theta) >t += dt >m = max([x,y]) >if m > scale: >scale = 1.05*m >xlabel.pos = (0.95*scale,-0.05*scale) >ylabel.pos = (0.05*scale,0.95*scale) >xaxis.pos = [(-scale,0),(scale,0)] >yaxis.pos = [(0,-scale),(0,scale)] >p.append(pos=(x,y)) ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Visualpython-users mailing list Visualpython-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/visualpython-users