POV-Ray : Newsgroups : povray.general : #While Loop Equation for Lissajous Figures ? : Re: #While Loop Equation for Lissajous Figures ? Server Time
16 Nov 2024 09:22:17 EST (-0500)
  Re: #While Loop Equation for Lissajous Figures ?  
From: Peter Popov
Date: 5 Sep 1998 16:10:57
Message: <35f18cc1.0@news.povray.org>
Ken wrote in message <35F12490.D8B4B815@pacbell.net>...
>Anybody have a working equation for making lissajous figures ?
>Preferably one using something like a #while loop.
>
>Thanks
>
>Ken
>

A Lessajous figure is the path a point follows as it oscilates in two or
more different planes. Simply, if you oscilate the x, y, and z coords of a
sphere you'll get a Lessajou figure.

This should work if there're no typos. I just posted one with typos,
canceled it and am reposting it.

// A simple Lessajou
// POV 3.1 code

#declare Spheres=10000;

#declare coeff_X=2;
#declare coeff_Y=5;
#declare coeff_Z=7;

#declare phase_X=0;
#declare phase_Y=0;
#declare phase_Z=0;

#declare dummy=0;
#while (dummy<1)
  sphere
  {
    <sin(2*pi*(dummy+phase_X)*coeff_X),
     sin(2*pi*(dummy+phase_Y)*coeff_Y),
     sin(2*pi*(dummy+phase_Z)*coeff_Z)>*10, 1
     texture
     { pigment { color rgb <sin(2*pi*dummy*10),0,1-sin(2*pi*dummy*10)> }
       finish { ambient 0.1 diffuse 0.7 brilliance 2.25 specular 0.75
roughness 0.005 phong 0.25 phong_size 7.5 metallic 0.5 }
     }
     no_shadow
  }

  #declare dummy=dummy+1/Spheres;
#end

light_source { <10000,10000,-10000> color rgb 1 }

camera { location -40*z up y right x angle 30 look_at 0 }

// End of code
// render a square image

I am typing this directly in Outlook Express so a) please forgive the
ugliness, OE is no match for the new editor in POVWIN, and b) haven't tested
it (should work, but who knows?). Also, I have no darn idea what this will
look like, but it is a Lessajou figure

Post some of your Lessajous when you're ready with them.

Peter


Post a reply to this message

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