POV-Ray : Newsgroups : povray.text.tutorials : spiral : Re: spiral Server Time
6 Oct 2024 00:01:16 EDT (-0400)
  Re: spiral  
From: Grassblade
Date: 29 Mar 2007 17:05:01
Message: <web.460c37fdcef26043997bba560@news.povray.org>
"sahraoui" <sch### [at] uiucedu> wrote:
> Hi
>
> I was wondering if there is a simple way
> to draw a helix on a sinus. Instead of having a straigh helix
> we should have a helix that would follow a sine function. It seems
> hard but may be I am not optimising the code. so far it is not working
>
> regards

I would turn to parametric objects, with them you can get pretty much
anything that strikes your fancy, provided you know your way around them.
I'm not too familiar with them myself, but I do know you can find pointers
at Mike Williams page:
http://www.econym.demon.co.uk/isotut/parametric.htm

The helix isn't mentioned over there, at least I haven't found it with only
a quick sweep, but its parametric equation is:

#declare Fx = function {sin(5*v)}
#declare Fy = function {v}
#declare Fz = function {cos(5*v)}

parametric {
  function {Fx(u,v,0)}
  function {Fy(u,v,0)}
  function {Fz(u,v,0)}
    <2*pi,-pi>,<4*pi,2.1*pi>
  contained_by{box{-2,2}}
  precompute 18, x,y,z
  pigment {rgb x}
  }

If you render the above you'll only see a series of dots in a helix pattern,
that is because the above formula implies 0 thickness. I do not know how to
change it so that it becomes a sphere sweep of a given radius along the
helix.
Anyway, to address your question, simply modify Fy (the helix's axis) to
accomodate for a sin(v) or whatnot.

Parametric objects render exceedingly slowly, so you may want to use Ingo
Janssen's param.inc. You can find more details at Mike Williams page.


Post a reply to this message

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