POV-Ray : Newsgroups : povray.binaries.images : Just an experiment - 1 attachment : Re: Just an experiment - 1 attachment Server Time
15 Nov 2024 20:17:39 EST (-0500)
  Re: Just an experiment - 1 attachment  
From: JC (Exether)
Date: 7 May 2003 06:13:20
Message: <3EB8DCFA.1060600@club-internet.fr>
The image looks nice.
But unfortunately I don't think you can do a real even distribution by 
putting your holes on parallels and meridians. Actually even 
distribution of points on a sphere is not an easy task at all. But you 
can get a good approximation by using a electrostatic repulsion-like 
algorithm starting with a more or less random distribution and step by 
step moving them to be at even distances. But it costs CPU, it's more 
complex and inelegant (it's an approx), so ...

Cordialement,

JC

Zio Pera wrote:
> "Hugo Asm" <hua### [at] post3teledk> wrote in
> news:3eb8c8a3$1@news.povray.org: 
> 
> 
>>No insults.  :o)  But how do you compute the almost-even distribution,
>>perhaps by subdividing a triangle? If you share your code .. hmm..
>>I'll be grateful but it's up to you.. Now you could add some media, or
>>maybe you already did.
>>
>>Regards,
>>Hugo
>>
>>
> 
> I just make 2 cycle, the outer scans the "meridians" of the sphere with a 
> fixed step, the inner scans the "parallels" (is the right word ?), with a
> step that depends on the size of the parallel itself. Here is a snippet
> of the code.
> 
> #declare fori = object { union {
>    #declare zi=0;   
>    #while (zi<180)
>    
>       #declare zrad=sin(zi*pi/180);
>       
>       #if (zrad=0)
>       #declare xstep=360;
>       #else
>       #declare xstep=360/(30*zrad);   
>       #end
>       //#declare xstep=int(xstep/5)*5;
>       #debug str(xstep,5,2)
>       #debug "\n"
>       #declare xi=rand(rr)*xstep;                                       
>       #while (xi<360)       
>          cylinder { <0.9*sin(zi*pi/180),0.9*cos(zi*pi/180),0> 
>                     <1.1*sin(zi*pi/180),1.1*cos(zi*pi/180),0>, 
>                     0.05 rotate <0,xi,0> }
>       #declare xi=xi+xstep;
>       #end
>    #declare zi=zi+10;
>    #end
>    } }


Post a reply to this message

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