From: Arthur <ajs...@op...> - 2003-03-25 14:19:15
|
# the previous phi3.py is now an import. Demo is same as phi.py, but with polyhedron in wireframe (using edge mappings) from phi3 import * scene=display(background=[.7,.8,.9],autoscale=False,range=30,30,30],width=80 0,height=800) angle=pi/100 t=[] i=0 for tetra in tetras: t.append(frame()) for edge in poly_edges(tetra): curve(frame=t[i],pos=edge,color=color.blue,radius=.2) t[i].pos=[6+6*i,6+6*i,0] i+=1 i=0 c=[] for cube in cubes: c.append(frame()) for edge in poly_edges(cube): curve(frame=c[i],pos=edge,color=color.cyan,radius=.2) c[i].pos=[-8-8*i,8+8*i,0] i+=1 o=[] i=0 for octa in octahedrons: o.append(frame()) for edge in poly_edges(octa): curve(frame=o[i],pos=edge,color=color.red,radius=.2) o[i].pos=[-8-8*i,-8-8*i,0] i+=1 r=[] i=0 for rhomba in rhombics: r.append(frame()) for edge in poly_edges(rhomba): curve(frame=r[i],pos=edge,color=color.green,radius=.2) r[i].pos=[8+8*i,-8-8*i,0] i+=1 p=frame() for edge in poly_edges(poly120): curve(frame=p,pos=edge,color=color.black,radius=.1) d=frame() for edge in poly_edges(dodeca): curve(frame=d,pos=edge,color=color.magenta,radius=.2) d.pos=[24,0,0] i=frame() for edge in poly_edges(isohedron): curve(frame=i,pos=edge,color=color.yellow,radius=.2) i.pos=[-24,0,0] w=frame() for edge in poly_edges(triaconta): curve(frame=w,pos=edge,color=color.magenta,radius=.2) w.pos=[0,24,0] while 1: from random import random rate(100) axis=[random(),random(),random()] for f in t: f.rotate(axis=axis,angle=angle) axis=[random(),random(),random()] for f in c: f.rotate(axis=axis,angle=angle) axis=[random(),random(),random()] for f in o: f.rotate(axis=axis,angle=angle) axis=[random(),random(),random()] for f in r: f.rotate(axis=axis,angle=angle) axis=[random(),random(),random()] p.rotate(axis=axis,angle=angle) axis=[random(),random(),random()] d.rotate(axis=axis,angle=angle) axis=[random(),random(),random()] i.rotate(axis=axis,angle=angle) axis=[random(),random(),random()] w.rotate(axis=axis,angle=angle) |