POV-Ray : Newsgroups : povray.general : Simple math question : Re: Simple math question Server Time
30 Jul 2024 12:30:17 EDT (-0400)
  Re: Simple math question  
From: triple r
Date: 14 Feb 2009 19:40:01
Message: <web.49976357240b718bef2b9ba40@news.povray.org>
some_yahoo <209### [at] gmailcom> wrote:
> no - I am doing a different color in each frame.  I only have a clock variable to
work with.  There are no nested loo
ps

Weird.  I thought I responded already, but it didn't show up.  Oh well.

#declare x=floor(clock*nx)/(nx-1);
#declare y=floor(clock*nx*ny)/(ny-1);
#declare z=floor(clock*nx*ny*nz)/(nz-1);
#while (x>1+epsilon) #declare x=x-1; #end
#while (y>1+epsilon) #declare y=y-1; #end
#while (z>1+epsilon) #declare z=z-1; #end

Then map the clock onto a nested loop.  This may be what you've done already,
but the above code does it also, for x, y, z in [0,1] with nx, ny, and nz
discrete steps (you'll have to change x,y,z to something else, of course).  You
could use mod(), but the while loops avoid looping back to zero, as you ran
into, for epsilon < 1/min(dx,dy,dz).  Of course you could also just map it onto
RGB coordinates, but HSV seems somehow more appropriate.

 - Ricky


Post a reply to this message

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