From: Dockeen <do...@mc...> - 2002-06-21 03:26:30
|
I am obviously way too stressed out after a couple of high stress 13 hour days in the lab. I know I should not specify colors the way I did. I just find it so neat you can extract the axis of an object by simple specifying object.axis. Here it is, very 60's cylinder from visual import * from Numeric import * length = 3.0 radius = 1.0 number_of_steps_length = 20 number_of_angle_steps = 20 length_step = length / number_of_steps_length angle_step = 2.0 * 3.1415926 / number_of_angle_steps scene = display(title='Cylinder', width=500, height=500, center=(0,0,0), range=(5,5,5)) f = frame() for i in xrange(0,number_of_steps_length): x1 = i * length_step x2 = (i + 1) * length_step for j in xrange(0,number_of_angle_steps): theta = j * angle_step y1 = radius * sin(theta) z1 = radius * cos(theta) y2 = radius * sin(theta + angle_step) z2 = radius * cos(theta + angle_step) convex(frame = f,pos = [(x1,y1,z1),(x1,y2,z2),(x2,y1,z1),(x2,y2,z2)],color = (x1,y1,z1)) for i in xrange(1,200): rate(5) f.rotate(angle = 0.02,axis = (0,1,0),origin = (0,0,0)) f.rotate(angle = -0.1,axis=f.axis,origin = (0,0,0)) Wayne Keen |