POV-Ray : Newsgroups : povray.general : Help: Place objects within a circle : Re: Place objects within a circle Server Time
4 Nov 2024 21:26:52 EST (-0500)
  Re: Place objects within a circle  
From: Marc Champagne
Date: 12 Sep 2003 18:12:51
Message: <Xns93F4B8DE84F66POVMIKA@204.213.191.226>
"Slime" <fak### [at] emailaddress> wrote in news:3f61391d$1@news.povray.org:

>> Well it took writing this message to figure out that I can place the
>> object randomly on the x radious and then randomly rotate it arround
>> the y, it will always remain within the circle.
>>
>> Am I on the right track here?
> 
> 
> Yes. However, if you do that, you'll find that there's one problem with
> it: the objects will be more dense at the center of the circle than at
> the edge. This is because each X-coordinate has an equal likelihood of
> being chosen, but the ones closer to zero get put in a smaller area (a
> small circle) than those closer to the radius of the circle.
> 
> To counteract this, you need to "pull" the objects closer to the outer
> edge of the circle. The correct way to do this involves calculus (I
> think), but I'm pretty sure that it will turn out that you want to take
> the square root of the X-value you get.
> 
> So:
> 
> x = random value from 0 to 1
> x = sqrt(x)
> x = x * radius of circle
> final position = x coordinate rotated randomly around origin

I'm trying real hard to figure out how you came about the idea of using
sqrt(), so I'll take my pen and paper and work some examples to understand 
why this should work.

I'll pop it in my code and try.

Thanks Slime

-- 
Marc Champagne
marcch.AT.videotron.DOT.ca
Montreal, CANADA


Post a reply to this message

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