from sage.plot.animate import Animation
class MyAnimation(Animation):
def make_image(self,frame,filename,**kwds):
G.set_axes_range(floor(G.xmin()),ceil(G.xmax()),
floor(G.ymin()),ceil(G.ymax()))
G.save_image(filename,**kwds)
return [[(cos(a)*x-sin(a)*y).n(),(sin(a)*x+cos(a)*y).n()]
vg=g.get_pos(); eg=g.edges(); ne=len(eg)
return [[list(vg[eg[i][0]]),list(vg[eg[i][1]])]
def col(): return (.3+random()/3,0,.3+random()/3)
def rotate_bezier_path_cubegraph(m,k,color='default',th=.5):
lg=linegraph(g); LG=Graphics()
rlg=[[rotate_line(j*pi/k,lg[i])
for i in range(len(lg))] for j in range(2*k)]
if color=='default': color=col()
LG+=bezier_path(rlg[i],color=color,thickness=th)
def _(m1=[3,4,5,6],m2=[3,4,5,6],
th1=[.5,.7,.9,1.1],th2=[.3,.7,1.1,1.5]):
[rotate_bezier_path_cubegraph(m1,k,th=th1),
rotate_bezier_path_cubegraph(m2,k,color='white',th=th2)])
for k in range(3,9)],figsize=(5,5),axes=False)
No comments:
Post a Comment