|
![](/i/fill.gif) |
> I didn't think of trying even distro. That'll be version 2. :)
Well, there are even distro which work quite well. E.g. the following:
#declare MaxRad = 1;
#local Counter=0;
#while (Counter<=TotalAmount)
#declare Pos=vrotate(<MaxRad ,0,0>,y*(360/.618*Counter)) *
sqrt(Counter/TotalAmount);
sphere{Pos,.05 pigment{rgb x}}
#declare Counter=Counter+1;
#end
produces a nice, even distribution, without looking like a grid.
(Here's a link for further insight into the code above:
http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/fibnat.html#seeds).
> Your line above works great, with the small exception that they seem to
> be more bunched up on the left side than the right. Which is okay, I
> think, but just for curiosity's sake, is there a reason for that?
I'm not sure, but it may depend on how many times you call the rd-random
stream. AFAIK, the stream jumps back and forth between positions more to 0
and more to 1, but over hundreds of iterations, this evens out. Just try a
different seed, or, if my theory would be correct, just add a rand(rd)
before entering the #if (vlength())-case.
Another thing I've noticed: vlength() will always return positive numbers or
0, so instead of
#if (vlength(Norm)>0)
you could just as easily write
#if (vlength(Norm)
because POV-Ray interprets 0 as false, but !=0 as true.
> Thanks a bunch, Tim!!
No problem, that was an easy one. :-)
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Post a reply to this message
|
![](/i/fill.gif) |