POV-Ray : Newsgroups : povray.general : Rounding a Cylinder Server Time
7 Aug 2024 07:17:01 EDT (-0400)
  Rounding a Cylinder (Message 1 to 4 of 4)  
From: dave
Subject: Rounding a Cylinder
Date: 6 Oct 2001 08:28:34
Message: <3bbef8f2@news.povray.org>
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..

Any help would be lovely.'

Thanks


Post a reply to this message

From: Christoph Hormann
Subject: Re: Rounding a Cylinder
Date: 6 Oct 2001 09:04:13
Message: <3BBF022B.282471DC@gmx.de>
dav### [at] intrepidvoygrcom 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.
> 
> [...]

How about:

#declare Angle=0;

#while (Angle < 2*pi)
  #declare Point=<cos(Angle), sin(Angle), 0>;     
  #declare Angle=Angle+(2*pi/50);
  #declare Point2=<cos(Angle), sin(Angle), 0>; 
  cylinder { Point, Point2, 0.05 }
#end

Note that you can also use 'rotate' instead of trigonometry.

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Mike Williams
Subject: Re: Rounding a Cylinder
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

From: dave
Subject: Re: Rounding a Cylinder
Date: 6 Oct 2001 09:49:49
Message: <3bbf0bfd@news.povray.org>
DuH!.. 
Is see now.. I wasn't even think cos, and sin.. 
And I didn't EVER think of rotate, rotate might be nicer on the loop.

Thanks all

Christoph Hormann <chr### [at] gmxde> wrote:


> dav### [at] intrepidvoygrcom 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.
>> 
>> [...]

> How about:

> #declare Angle=0;

> #while (Angle < 2*pi)
>   #declare Point=<cos(Angle), sin(Angle), 0>;     
>   #declare Angle=Angle+(2*pi/50);
>   #declare Point2=<cos(Angle), sin(Angle), 0>; 
>   cylinder { Point, Point2, 0.05 }
> #end

> Note that you can also use 'rotate' instead of trigonometry.

> Christoph

> -- 
> Christoph Hormann <chr### [at] gmxde>
> IsoWood include, radiosity tutorial, TransSkin and other 
> things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

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