POV-Ray : Newsgroups : povray.binaries.images : Red Spheres : Re: Red Spheres Server Time
11 Aug 2024 13:19:29 EDT (-0400)
  Re: Red Spheres  
From: Slime
Date: 16 Mar 2004 17:49:01
Message: <4057845d$1@news.povray.org>
> Very cool! I am flattered that my pic inspired this.
> Just curious...I assume that your spheres are placed randomly; how is
> it that you get them to not intersect with one another?

I keep an array of sphere positions, and each time I make a new sphere, I
check the new position against every previous position in the array, and, if
they're too close, I choose a new position. This gets really slow for large
numbers of spheres, but I had few enough that it wasn't a problem. After
that, it was just a matter of choosing a random number generator that
produced a good result.

I used a more complicated (but similar) technique in
http://www.slimeland.com/images/pictures/ManyReflective.jpg , where the
spheres could have different sizes, to keep them from intersecting. There
were so many spheres in this image that I had to make an array of positions
beforehand, sort them, and compare them against each other (using the
sortedness to reduce the number of necessary comparisons). This gave a
nearly complete list which I could use as a beginning for placing the rest
of the spheres.

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


Post a reply to this message

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