POV-Ray : Newsgroups : povray.general : Rounding a Cylinder : Re: Rounding a Cylinder Server Time
7 Aug 2024 09:21:11 EDT (-0400)
  Re: Rounding a Cylinder  
From: Mike Williams
Date: 6 Oct 2001 09:13:09
Message: <GibqFPAUJwv7EwOO@econym.demon.co.uk>
Wasn't it  who wrote:
>Okay all, just a little bit of help.. I've been trying to come 
>up with this formula for a while loop to create a round
>set of small cylinders.
>
>I start out with one small cylinder at:
>x = 0, y=0, z=-4.5
>
>I know that 1/4 of the way through it should be at
>x=4.5, y=0, z=0
>
>1/2 the way through:
>x=0, y=0, z=4.5
>
>and 3/4 of the way:
>x=-4.5, y=0, z=0
>
>and then back again to:
>x=0, y=0, z=-4.5 (However I don't want to go this far
>
>Now I've been trying something like:
>(where Offset is the spacing between Cylinders)
>
>#declare X = X + (Offset + .25); (.25 is the circ of the cylinder)
>#declare Z = Z + (Offset)
>
>But it doesn't go around, it just makes a bee-ling down the Z axis..
>

I'd do it like this: Move each cylinder to -4.5*z and then rotate them
around the origin by different amounts.

#declare Height = 1; // Length of each cylinder
#declare Radius = 0.2; // Radius of each cylinder
#declare Separation = 10; // degrees
             
#declare A=0;
#while (A<360)
  cylinder {<0,0,0>,<0,Height,0>,Radius
     pigment {rgb 1}
     translate -4.5*z
     rotate y*A
  }
  #declare A=A+Separation;
#end 


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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