POV-Ray : Newsgroups : povray.text.tutorials : spiral : Re: spiral Server Time
5 Oct 2024 23:14:18 EDT (-0400)
  Re: spiral  
From: Mike Williams
Date: 30 Mar 2007 20:57:16
Message: <28cuQCAC3bDGFwv3@econym.demon.co.uk>
Wasn't it sahraoui who wrote:
>Hi Mike
>
>Thanks a lot for the file.
>Actually i was trying that same loop
>but got entangled inside and got the code
>to run forever until I saw your message. thanks again.
>The parametric stuff did not work for some reason.
>
>Now here is the thing. What you sent me make the spiral follow
>the sinus line indeed but BUT every "circle" of the spiral
>is NOT perpendicular to the line of the sinus but it
>is always perpendicular to the horizontal.
>In other words your code produce a helix who axis is
>always parallel to the horizontal
>but what would be perfect is a helix whose axis
>is parallel to the sinus fonction that follows, andn that I beleive
>is not a piece of cake...but may be not for you Oh gentleman of Leisure

The basic strategy would be to tilt each "circle" by an amount that
varied with the cosine. The tricky bit would be to calculate the correct
value for the amount of tilt ("B" in the following code) from the other
values.

#declare R1=1.5;
#declare F1=1.2;
#declare R2=0.15;
#declare N=100;
#declare H=10;

#declare F2=0.2;
#declare A=0.5;
#declare B=-0.2;

sphere_sweep {
  b_spline
  100,            
  #declare Y=0;
  #while (Y<N)
    #declare X=R1*sin(F1*Y)+A*sin(F2*Y);
    <X, Y*H/N-H/2 + B*X*cos(F2*Y) , R1*cos(F1*Y)>,R2
    #declare Y=Y+1;
  #end
  pigment {rgb 1}
}

>embedding that into a larger sheet of beads would be quite a challenge too.

In what way?

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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