Here is an example which might help.  For it to work you need to
install ffmpeg.  It generates a rotating icosahedron movie.  For what
you want to do list_plot3d might be more appropriate:

{{{
c = polytopes.icosahedron()
label = 'Ico_movie'

# Numerical pi predefined for some speed
npi = RDF(pi)

#A rotation matrix
def rot(i,j,th):
    q = matrix(RDF,3)
    for k in range(3):
        q[k,k] = 1.0
    q[i,i] = cos(th)
    q[j,j] = cos(th)
    q[i,j] = sin(th)
    q[j,i] = -sin(th)
    return q

index = 0
for theta in srange(0,2*npi,npi/10):
    vs = c.vertices()[:]
    #rotate the vertices:
    vs = [rot(0,1,theta)*vector(v) for v in vs]
    edgedata = c.vertex_adjacencies()
    facedata = c.triangulated_facial_incidences()

    #Set up Tachyon.
    #use small xres, yres for speed.  antialiasing helps things look
better.
    t = Tachyon(xres = 250, yres = 250, antialiasing = True)
    t.texture('e1', color = (0,0,1))
    t.texture('f1',opacity = .5, color = (1,0,0))
    t.light((2,2,2), 0.1, (1,1,1))

    #Draw edges:
    edges = []
    for anedge in edgedata:
        v0 = anedge[0]
        for v1 in anedge[1]:
            if v1 > v0:
                edges.append([vs[v0],vs[v1]])
    for anedge in edges:
        t.fcylinder(anedge[0],anedge[1],.01,'e1')

    #Draw transparent faces:
    for atri in facedata:
        t.triangle(vs[atri[1][0]],vs[atri[1][1]],vs[atri[1][2]],'f1')

    #Make file names in order for ffmpeg
    str_index = '0'*(3-len(str(index)))+str(index)
    t.save(DATA+label+ str_index + '.png')
    index += 1

#Add a black final frame, since otherwise the compression in ffmpeg
gets confused.
t = Tachyon(xres = 250, yres = 250, antialiasing = True)
str_index = '0'*(3-len(str(index)))+str(index)
t.save(DATA+label+ str_index + '.png')

#Use ffmpeg to animate:
os.system('ffmpeg -qmax 2 -i ' + DATA + label + '%3d.png  ./test.mp4')
}}}

On Dec 9, 5:02 am, ggrafendorfer <georg.grafendor...@gmail.com> wrote:
> Hi Marshall,
> thanks for the answer, if you once have the frames I also know these
> two projects, but I did not try them out yet:
>
> http://www.onyxbits.de/giftedmotion
>
> http://www.lcdf.org/~eddietwo/gifsicle/
>
> Is it possible to make the frames, i.e. .jpg or .png files with
> tachyon from within sage or python?
>
> Actually I was hoping for an easy "on the fly" solution, to keep all
> the data of all surfaces in one file and produce the moving surface
> directly from that file
>
> thanks,
> Georg
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to