POV-Ray : Newsgroups : povray.general : PovDynamics Server Time
2 Nov 2024 01:21:36 EDT (-0400)
  PovDynamics (Message 1 to 3 of 3)  
From: kike
Subject: PovDynamics
Date: 17 Nov 2010 07:20:01
Message: <web.4ce3c83dfb7127c1519bbb570@news.povray.org>
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

From: Alain
Subject: Re: PovDynamics
Date: 17 Nov 2010 17:08:28
Message: <4ce4525c$1@news.povray.org>

> 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

From: kike
Subject: Re: PovDynamics
Date: 19 Nov 2010 06:05:01
Message: <web.4ce658af4c5371dc519bbb570@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.