POV-Ray : Newsgroups : povray.binaries.animations : An old one. Filling a container. : Re: An old one. Filling a container. Server Time
2 Nov 2024 05:22:10 EDT (-0400)
  Re: An old one. Filling a container.  
From: Slime
Date: 21 Jul 2002 18:46:38
Message: <3d3b39ce@news.povray.org>
> Ouch... the 10 iterations version (which looked pretty much the same...)
took 409
> sec... (debug not optimised version compiled with Visual Studio) so about
half a
> second per frame (actually the first hundreds frames get calculated in a
> *phhheeeww*).
> Anyway my algorithm cannot prevent *every* intersection right now, so it
would be
> great if you could give me some tips about the one you used. BTW I
couldn't enjoy
> your anim... just  a single still boring frame...who knows why.

Ooooh, you wrote this in C++? No wonder it's so fast. Mine's in POV-SDL =)
mainly so I can use the trace() function.

The algorithm basically works like this, for each iteration:

1. find every possible collision that will occur during this iteration
2. take the first collision and react to it, advancing all the balls the
amount of time that has passed
3. repeat until there are no more collisions during this iteration

Now, it doesn't work exactly like that; if it did, it'd be about 10 times as
slow. I've optimized it in various ways, but that's the gist of it. (the
main optimization is only checking for collisions involving balls that have
had collisions earlier during the current iteration, or which *will* have a
collision sometime during the iteration. That is, if a ball is found to have
no collisions during the iteration, ignore it in subsequent loops until the
next iteration.) Hard to explain, as you can see.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

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