POV-Ray : Newsgroups : povray.general : Q: Sine Wave : Re: Q: Sine Wave Server Time
12 Aug 2024 13:23:39 EDT (-0400)
  Re: Q: Sine Wave  
From: Marc Schimmler
Date: 2 Feb 1999 06:16:50
Message: <36B6DEA1.D401CFEE@ica.uni-stuttgart.de>
Ken wrote:
> 
> Nieminen Mika wrote:
> >
> > Ken <tyl### [at] pacbellnet> wrote:
> > : Could someone please provide me an example of how to create
> > : a sine wave using a while loop to translate/rotate(?) a sphere.
> >
> >   Since I'm a programmer and a perfectionist, I will give you a more
> > detailed answer than the one already given:
> >
> > //-----------------------------------------------------------------------
> <snip>
> 
> Thank you sir and thank you Mark as well for your example.
> 
> Next question -
> 
> Now that I have the shape established I would like to
> rotate the face of the defining object to follow the
> curve of the wave.
> 
>  Say I had a box(-1,1 scale<1,0.1,10>}
> 
> The flat face of the object is in the +y direction.
> As it moves through the curve it needs to rotate
> +/- 180*z to keep from having a stair stepped appearance.
> 
> Again any help would be appreciated.
> 
> --
> Ken Tyler
> 
> tyl### [at] pacbellnet


Hi Ken!
-----
camera {
 rotate <0,180,0>
 location <45,0,-80>
 look_at  <45,0,0>
 angle 60
}

#declare i=0;

#while (i<90)
 #declare angle1 = i*pi/30;
 box {<-0.5,-0.5,-0.5>,<0.5,0.5,0.5> 
         pigment {rgb <1,0,0>}
         finish {ambient 1.0}
         rotate <0,0,45*sin(angle1)>
		 translate <i,10*sin(angle1+pi/2),0>}
 #declare i = i + 1;
#end;

----

The rotation follows the sine. I inserted a phase differenvce of pi/2 to
have the sine starting in a horizontal position.

I hope it helps!


Marc
-- 
Marc Schimmler


Post a reply to this message

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