POV-Ray : Newsgroups : povray.unofficial.patches : extended function Server Time
1 Sep 2024 18:15:08 EDT (-0400)
  extended function (Message 1 to 1 of 1)  
From: Wlodzimierz ABX Skiba
Subject: extended function
Date: 20 Oct 2000 05:09:23
Message: <39f00bc3$1@news.povray.org>
I don't know if it is wish or question or something else
I don't know if it is proper group for such wish list
but i'm imagine automatic creation of macro with float result
after function declaration
something like this:

#declare fun1=function{x}  // it means also macro fun1(x,y,z,t)
#declare fun2=function{y}  // it means also macro fun2(x,y,z,t)
#declare A=0;
#macro test(var)
 #declare A=A+var;
#end
test(fun1(10.5,11,12,0))  // A=10.5
test(fun2(0.1,12,12,0))   // A=22.5

and my second wish - function as parameter of macro

#declare fun1=function{x}
#declare fun2=function{y}
#declare A=0;
#macro test(fun)
 #declare A=A+calculate_fun(fun,1,2,3,4);
#end
test("fun1")  // A=1
test("fun2")   // A=3

I can do something like this this way

#declare fun1=function{x}
#declare fun2=function{y}
#declare pig1=pigment{function{fun1}}
#declare pig2=pigment{function{fun2}}
#declare A=0;
#macro test(pig)
 #local result=eval_pigment(pig,<1.8,2.1,3>);
 #declare A=A+result.x;
#end
#warning concat(str(A,0,-1),"\n")
test(pig1)  // should be A=1.8 but there is 0.8
#warning concat(str(A,0,-1),"\n")
test(pig2)  // should be A=3.9 but there is 0.9
#warning concat(str(A,0,-1),"\n")

this produces wrong result becouse eval_pigment
truncate everything to <1,1,1>
there is sollution - code pigments pig1 and pig2
as integer in red (1/x) and decimal in green
but this is very complicated

what you think about my imagination ?

ABX


Post a reply to this message

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