POV-Ray : Newsgroups : povray.advanced-users : Logarithmic spiral tube Server Time
23 Nov 2024 04:31:51 EST (-0500)
  Logarithmic spiral tube (Message 1 to 4 of 4)  
From: Mike Horvath
Subject: Logarithmic spiral tube
Date: 26 Jan 2021 17:32:52
Message: <60109894$1@news.povray.org>
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.


Mike


Post a reply to this message

From: Robert McGregor
Subject: Re: Logarithmic spiral tube
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 {
      cubic_spline
      pt_cnt
      #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;
      #end
      tolerance 0.1
   }
#end

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
}


Cheers,
Rob


Post a reply to this message

From: Bald Eagle
Subject: Re: Logarithmic spiral tube
Date: 27 Jan 2021 07:00:00
Message: <web.6011555575e9c60d1f9dae300@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.
>
>
> Mike

I think you HAVE TO use a parametric or a loop, since you're going to need angle
values in your equation greater than tau, else you'll get a "circle of values"
rather than a "spiral of values" due to the atan2 in the implicit form required
for evaluating an isosurface.

so following:

http://news.povray.org/povray.newusers/thread/%3Cweb.59c7e943ff4768ea832bdcda0%40news.povray.org%3E/?mtop=418031&moff=1
0

this didn't work - it just gives an Archimedian spiral.

camera {orthographic
location <0,10,-0.1>
look_at 0
angle 90}

light_source {<0, 10, -10> rgb 1 shadowless}


plane {y, -1 pigment { checker rgb 0.5, rgb 1 }}

#declare RADIUS = 5;
#declare Thickness = 0.1;
#declare Freq = 2;
#declare Spirals = 1;


#declare Logarithmic =
function {
 Thickness - y*y*Freq -
  pow (
   sin (
    sqrt (x*x+z*z) * Freq -
    (pi * exp (0.15 * atan2 (z,x) ) )
   )
  , 2)
}


#declare Archimedian = function {(Thickness - y*y*Freq -
pow(sin(sqrt(x*x+z*z)*Freq -
 (0.5*Spirals*atan2(z,x)) ),2))}

isosurface {
 function {Logarithmic (x, y, z)}

 accuracy 0.01
 threshold 0 // default value
 max_gradient 102
 contained_by {sphere {<0,0,0>, RADIUS}}
 open
 texture {pigment {rgb <1, 0, 0>} finish {specular 0.4}}
}

So you'll need to adapt the parametric equations to a sphere sweep or a
parametric, or just a loop of spheres.

#declare SpiralX = function (Theta) {exp(0.15*Theta)*0.1*cos(Theta)};
 #declare SpiralY = function (Theta) {exp(0.15*Theta)*0.1*sin(Theta)};

 #for (T, 0, 10*tau, 0.01)
  #local X = SpiralX (T);
  #local Z = SpiralY (T);
  sphere {<X, 0, Z> 0.1 pigment {rgb <1, 0, 0>}}
 #end


[* Caution, this conclusion is based on a processor functioning on less than 1
cup of coffee]


Post a reply to this message

From: Mike Horvath
Subject: Re: Logarithmic spiral tube
Date: 22 Feb 2021 13:53:51
Message: <6033fdbf$1@news.povray.org>
On 1/26/2021 7:42 PM, Robert McGregor wrote:
> 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 {
>        cubic_spline
>        pt_cnt
>        #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;
>        #end
>        tolerance 0.1
>     }
> #end
> 
> 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
> }
> 
> 
> Cheers,
> Rob
> 
> 

Good idea thank you!

Another option is to create a mesh parametrically.


Mike


Post a reply to this message

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