POV-Ray : Newsgroups : povray.general : how to prevent overlapping random objects? : Re: how to prevent overlapping random objects? Server Time
30 Jul 2024 04:14:57 EDT (-0400)
  Re: how to prevent overlapping random objects?  
From: Dre
Date: 19 Aug 2010 19:33:02
Message: <4c6dbf2e@news.povray.org>
<snip>
> I'm not sure that the time it takes to parse large sets is really worth 
> it. See the image I posted in p.b.i.:
>
http://news.povray.org/povray.binaries.images/thread/%3C4c6d67d5%40news.povray.org%3E/
>
> It took 23 minutes, 36 seconds to parse. Out of the 50,000 tests I gave it 
> to perform, only a mere 3,065 succeeded. To me, this is unacceptable. If 
> you were to populate a landscape with rocks or trees, you would need more 
> points than that. To make matters worse, the parse time goes up with each 
> new point added. I even used two optimizations. In one, a point stops 
> trying to be placed after the first overlap. The other one bails out 
> completely after failing to place a new random point n consecutive times. 
> I didn't use the latter for that render. If I had, the parse time wouldn't 
> have been as long, but there would have been fewer points. If, after all 
> this you still want some code, I'll go ahead and finish the file-writing 
> routines, which is the easy part.
>
> Another method is to just code this in C++, using a bitmap-like array to 
> test against. It's not as accurate, but it's much faster and you get to 
> see the progress, and can bail out manually at any time, saving the 
> successful points. I've already got a rough version, but I need to learn 
> more about vector.h before I can finish it.

This is the exact problem I ran into when coding the same sort of thing.  My 
code works also but it has a very high miss rate, very low success rate and 
it also takes ages to parse.

I've parked my code for now anyway, I'm doing other stuff atm but one day 
I'll dig it up and see if there is anything that I can do about it...

Cheers Dre


Post a reply to this message

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