POV-Ray : Newsgroups : povray.advanced-users : Logarithmic spiral tube : Re: Logarithmic spiral tube Server Time
30 Nov 2022 05:59:10 EST (-0500)
  Re: Logarithmic spiral tube  
From: Robert McGregor
Date: 26 Jan 2021 19:45:01
Message: <web.6010b70675e9c60d87570eab0@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> How would I create a tube in the shape of a logarithmic spiral? It
> should have an even thickness. Do I need to use an isosurface once
> again? Thanks.

If you have the parametric equation already for a spiral isosurface and you just
a need a smooth tube, then a difference of two sphere sweeps would render *much*
faster than an isosurface.

Just make the radius of the outer one a bit larger and the length of the
differenced sweep a bit longer, so you get open ends (or just use other
differencing objects to snip off the ends).

Maybe something like this non-logarithmic spiral:

#macro Spherical_Spiral(turns, outer_rad, tube_rad, incr)
   #local pt_cnt = int(pi/incr+0.5);
   #local tt = 0;
   sphere_sweep {
      #while (tt < pi)
         #local xt = outer_rad * cos(turns*2*tt) * sin(tt);
         #local yt = outer_rad * sin(turns*2*tt) * sin(tt);
         #local zt = outer_rad * cos(tt);
         <xt, yt, zt> tube_rad
         #local tt = tt + incr;
      tolerance 0.1

difference {
   object { Spherical_Spiral(5, 3, 0.12, 0.03) pigment {color Red} }
   object { Spherical_Spiral(5, 3, 0.10, 0.03) pigment {color Blue} }
   box {-1, 1 scale 12 translate x*12}
   rotate y*40


Post a reply to this message

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