POV-Ray : Newsgroups : povray.general : Math: helix wrap around a circle Server Time
4 Nov 2024 19:15:33 EST (-0500)
  Math: helix wrap around a circle (Message 1 to 5 of 5)  
From: Greg M  Johnson
Subject: Math: helix wrap around a circle
Date: 13 Sep 1999 11:21:43
Message: <37DD15F1.2B627647@my-dejanews.com>
I want to have a series of points which are a helix wrapped around a
circle.

If I had a series of objects, the operations in pov would be easy,
because I could translate them as per sin & cos in one plane and then
ROTATE the objects around another axis.  However, I need these to be
POINTS which I declare.

How can this be done? Can declare a point, then rotate it later, then
later on use it as the position of an object?


Post a reply to this message

From: Gilles Tran
Subject: Re: Math: helix wrap around a circle
Date: 13 Sep 1999 11:48:11
Message: <37DD1D5A.3177DB79@inapg.inra.fr>
One solution :
1. fill an array with the <x,y,z> positions P[n]
2. transform every point by whatever transformation (liberal use of
vector functions needed) P[n] -> Q[n]
3. apply the points : object{Toto translate Q[i]}
This can be a little more difficult if you have to reorient the object,
but a similar logic can be used.

Gilles


"Greg M. Johnson" wrote:

> I want to have a series of points which are a helix wrapped around a
> circle.
>
> If I had a series of objects, the operations in pov would be easy,
> because I could translate them as per sin & cos in one plane and then
> ROTATE the objects around another axis.  However, I need these to be
> POINTS which I declare.
>
> How can this be done? Can declare a point, then rotate it later, then
> later on use it as the position of an object?


Post a reply to this message

From: Jerome M  BERGER
Subject: Re: Math: helix wrap around a circle
Date: 13 Sep 1999 13:41:28
Message: <37DD374E.6C8B87B7@enst.fr>
"Greg M. Johnson" wrote:
> 
> I want to have a series of points which are a helix wrapped around a
> circle.
> 
> If I had a series of objects, the operations in pov would be easy,
> because I could translate them as per sin & cos in one plane and then
> ROTATE the objects around another axis.  However, I need these to be
> POINTS which I declare.
> 
> How can this be done? Can declare a point, then rotate it later, then
> later on use it as the position of an object?

	If you want to apply a translation to a point all you have to do is add
the translation vector. For the rotation, you might want to take a look
at the vrotate and vaxis_rotate functions.

		Jerome

-- 
*******************************

* they'll tell you what can't * mailto:ber### [at] inamecom
* be done and why...          * http://www.enst.fr/~jberger
* Then do it.                 *
*******************************


Post a reply to this message

From: Alberto
Subject: Re: Math: helix wrap around a circle
Date: 13 Sep 1999 13:46:51
Message: <37DD38FD.7C4FF8E3@ma.usb.ve>
Another solution:

I hope this can help you. The whole helix is created at once. At the end
you can reorient it as you wish.

cut here
-------------------------------------------------
#default{pigment{ rgb 1}}
camera{location 2*<0,5,-5> look_at 0}
light_source{<2,5,-5> rgb 1}

#declare R1 = 3; // the size of the circle
#declare R2 = 1; // the "size" of the helix
#declare R3 = .1;// point size
#declare Omega = 4*pi; //the speed of the helix
// around the circle

#declare n = 320 // number of points

#declare k = 0;

union{
  #while(k < n)
    #declare s = 2*pi*k/n;
    sphere{
    <
       (R2*cos(Omega*s) + R1)*cos(s),
      R2*sin(Omega*s),
      (R2*cos(Omega*s) + R1)*sin(s)
    >,
    R3
  }
  #declare k = k + 1;
  #end
} // here you can reorient your helix
-------------------------------------------------

Alberto


Post a reply to this message

From: Nieminen Juha
Subject: Re: Math: helix wrap around a circle
Date: 14 Sep 1999 06:48:37
Message: <37de2805@news.povray.org>
Greg M. Johnson <gre### [at] my-dejanewscom> wrote:
: How can this be done? Can declare a point, then rotate it later, then
: later on use it as the position of an object?

  You can apply to a vector all the tranformations you can apply to an
object:

object { MyObject translate Amount }
#declare MyVector=MyVector+Amount;

object { MyObject scale Amount }
#declare MyVector=MyVector*Amount;

object { MyObject rotate Amount }
#declare MyVector=vrotate(MyVector,Amount);

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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