POV-Ray : Newsgroups : povray.binaries.images : Re: Rotating Squares problem : Re: Rotating Squares problem Server Time
12 Aug 2024 07:26:34 EDT (-0400)
  Re: Rotating Squares problem  
From: Ben T  Scheele
Date: 9 Oct 2003 23:41:53
Message: <3f862a81@news.povray.org>
Awww, I'm jealous of Mike.  I solved this problem a couple of years ago,
but I found the thread too late to be the first to post it.  You might
still enjoy my code, as it is fairly efficient, well commented, and it
is an animation as well!  Try it out, as it looks pretty cool.  For the
still I have included, the clock value was .05.  I enjoyed working out
this problem.  It required a similar trigonometric solution as the ones
presented above.  Now that I look at the equation involved, I wonder how
I got it.  Oh well.

-Ben

//Title: Equiangular Spiral Animation
//Author: Ben Scheele
//Date: 5-20-2001
//updated 10-9-03

//animation .ini settings

//[300X300 AA on]
//+w300 +h300 +ki0 +kf1 +kfi1 +kff90 +A0.3 -j

camera{
  location 20*y
  up y right x
  look_at 0
  angle 6
}

light_source{ <20,50,20> rgb 1.25 }

background{ rgb .2}

#declare s = 1;
#declare a = 1;
#declare n = .06; //determines thickness of the frame

#declare T = 0;
#declare EndT = 90; //how far the square is rotated; sets the number of
objects as well
             //set at 360 for the animation

#declare Step = 0+90*clock; //determines rotation rate
#while(T < EndT + Step )

  #declare a = a/(sin(Step/180*pi)+cos(Step/180*pi))*.97;  //all the
trig that's involved. (the .97 just shrinks it a bit)

   difference{
     box{ <-s,0,-s>, <s,s/4,s>}
     box{ <-s+n,-.01,-s+n>, <s-n,s/4+.01,s-n> }
       pigment{ rgb <a,.25,1-a> }  //changes as it goes through the loop
       finish{ ambient .2 diffuse .8 phong .4 reflection{ .2 .5}
metallic .3 specular.2 roughness .02 }
       scale <a,1+5*T/EndT,a> // you can scale it more or less in the
vertical direction (y)
       rotate T*y
   }

#declare T = T + Step;
#end


Post a reply to this message


Attachments:
Download 'equiangular spiral.jpg' (36 KB)

Preview of image 'equiangular spiral.jpg'
equiangular spiral.jpg


 

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