POV-Ray : Newsgroups : povray.binaries.images : A few cylinders [~117 KB] : Re: A few cylinders [~117 KB] Server Time
14 Nov 2024 00:21:22 EST (-0500)
  Re: A few cylinders [~117 KB]  
From: Matt Leonard
Date: 15 Apr 2004 18:03:47
Message: <opr6ip8kp1vka4sj@news.povray.org>
On Thu, 15 Apr 2004 22:46:59 +0200, Hugo Asm <hua### [at] post3teledk> wrote:

> I really like that grey, shiny look!
>
> What formula did you use for tracing?  For a sphere, it wouldn't be
> necessary to use trace at all, of course, but now that you have ... I 
> wonder
> if you also used some interesting formula for tracing all around the 
> object
> in question.
>
> Regards,
> Hugo
>
>
>

Basically all I did was trace out a sphere with the start of the trace 
function.  Ummm...  when using spherical coordinates, you can describe a 
sphere easily with three parameters, the radius, theta - the angle around 
the vertical axis, and phi - the angle with respect to the horizontal 
plane.  I just took one theta and moved phi down, scanning across the 
surface of the sphere and placing cylinders.  Then it increments theta, and 
scans down again.  Do this a bunch of times and you end up with the 
picture.  Code looks like this:

#while ( theta < 2*pi )
    #local phi = 0;   #while ( phi < pi )      #local vary = rand(seed1);
      #local Start = <r*sin(phi)*sin(theta), r*cos(phi), r*sin(phi) 
*cos(theta)>;  #local Inter = trace ( S, Start, <0,0,0> - Start, Norm ); 
cylinder { Inter, Inter + Norm*vary*.5, .025
      }
      #local phi = phi + pi/Number;
    #end
    #local theta = theta + 2*pi/Number;
  #end

Probably more complicated than it needs to be, but whatever....

Thanks for the comments!


Post a reply to this message

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