|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi all:
Long time since my last post!
I'm working in a very nerd thing. I want to do a molecular dynamic simulation
with Pov... not in fortran (C or whatever) and then export data to Pov. I mean
with Pov.
My problem was to save information from one frame to other. And I have solve it
by writing an external file. Its something like this:
//You define the time
#declare ti=frame_number;
#declare dt=1/25;
//then open a file with the initial conditions
#fopen MyFile "dypov.dat" read
#read (MyFile,x0,v0)
#fclose MyFile
//this is the Euler method for a spring in 1D
#declare k0=1;
#declare F0=-k0*x0;
#declare v0=v0+dt*F0;
#declare x0=x0+dt*v0;
sphere{<x0,0,0>,.2}
//then you write the result in the same file so in the next frame these will be
//the data for the next step in the simulation
#fopen MyFile "dypov.dat" write
#write (MyFile,x0,",",v0,",")
#fclose MyFile
Dont know if this is old but seems funny to me and I'm working in something more
complicated.
Cheers!!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Hi all:
>
> Long time since my last post!
> I'm working in a very nerd thing. I want to do a molecular dynamic simulation
> with Pov... not in fortran (C or whatever) and then export data to Pov. I mean
> with Pov.
>
> My problem was to save information from one frame to other. And I have solve it
> by writing an external file. Its something like this:
>
> //You define the time
> #declare ti=frame_number;
> #declare dt=1/25;
>
> //then open a file with the initial conditions
> #fopen MyFile "dypov.dat" read
> #read (MyFile,x0,v0)
> #fclose MyFile
>
> //this is the Euler method for a spring in 1D
> #declare k0=1;
> #declare F0=-k0*x0;
> #declare v0=v0+dt*F0;
> #declare x0=x0+dt*v0;
>
> sphere{<x0,0,0>,.2}
> //then you write the result in the same file so in the next frame these will be
> //the data for the next step in the simulation
> #fopen MyFile "dypov.dat" write
> #write (MyFile,x0,",",v0,",")
> #fclose MyFile
>
> Dont know if this is old but seems funny to me and I'm working in something more
> complicated.
>
> Cheers!!
>
>
Not odd at all.
There are some other animation scenes that do use that exact same
read/write technique to do the exact same thing.
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
These are somethings I have done with these idea. Hope yo like it.
http://vimeo.com/16960021
http://vimeo.com/16993423
------------------------
www.enriquesahagun.es
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|