POV-Ray : Newsgroups : povray.advanced-users : How to cap a cylinder by a 2d-function? : Re: How to cap a cylinder by a 2d-function? Server Time
19 Apr 2024 00:20:40 EDT (-0400)
  Re: How to cap a cylinder by a 2d-function?  
From: Bald Eagle
Date: 6 Dec 2016 10:15:00
Message: <web.5846d50e93354f5bc437ac910@news.povray.org>
It seems like the easiest thing to do there is just create a for-next loop and
increment the y position of a short cylinder as you alter the x and z values
with cos and sin functions.

#declare R1 = 5; // radius of spiral
#declare R2= 0.25; // radius of cylinders
#declare Y=0;

#for (t, 0, 2*pi, 0.1)
     #declare X = R1*cos(t);
     #declare Z = R1*sin(t);
     cylinder {<X, Y, Z>, <X, Y+0.5, Z>, R2 pigment {Yellow}}
     #declare Y = Y + 0.1;
#end // end for t


Post a reply to this message

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