POV-Ray : Newsgroups : povray.general : HELP Using macro to visualise mathematical functions : HELP Using macro to visualise mathematical functions Server Time
2 Aug 2024 08:13:21 EDT (-0400)
  HELP Using macro to visualise mathematical functions  
From: The Ugly
Date: 30 Nov 2004 12:30:01
Message: <web.41acadff91225dd755f15cf90@news.povray.org>
I would like to make a macro that visualises mathematical functions.
Something like this would be nice.




#macro MyFunc(Length,Formula)

#local N=0;

#while (N<=Length)

sphere { 0, 0.02
        pigment { rgb <N,0,N*-1+1> }
        translate <N,Formula,0>
        }

#local N=N+0.1;

#end

#end




But as you might see this is of little use.
If this is to become usefull you have to be able to use it like this:

MyFunc(N*N)


In other words, you will have to be able to refere to the local N when you
call it, but it hasnt been defined yet.
If you try to define it before you call the macro it will calculate the
value before passing it into the macro.
Do I make any sense?

Is there any way you could get around this limitation?


Robb


Post a reply to this message

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