





 
 




 
 


One thing I noticed while trying to compose some functions is that the
conditional expressions are not recognized by POVRay's function VM.
I can work around this with select(), but sometimes it would just be a lot
easier on my brain to use the simpler and more direct conditional syntax.
Possible Parse Error: Suspicious identifier found in function! If you want to
call a function make sure the function you call has been declared. If you call
an internal function, make sure you have included 'functions.inc'.
Parse Error: Expected 'operator', ? found instead
Conditional expressions: The operand C is boolean while operands A and B are any
expressions. The result is of the same type as A and B.
(C ? A : B) if C then A else B
Post a reply to this message


 
 




 
 


I was also trying to minimize the processing of vectors, and executed the
following:
#declare f_Axis = function (Vector) {select (Vector, x, y, z)}
Which worked, but did not give me the expected results.
My debug statements with str complained that it expected a value, but a vector
was encountered instead, which leads me to believe that it was returning the
_vector_ quantities x, y, and z  which I thought functions couldn't do?
modifying/correcting to:
#declare f_Axis = function (x, y, z, Vector) {select (Vector, x, y, z)}
yielded the expected scalar worldcoordinate, so that's an interesting pair of
results.
Post a reply to this message


 
 




 
 


"Bald Eagle" <cre### [at] netscapenet> wrote:
> I was also trying to minimize the processing of vectors, and executed the
> following:
>
> #declare f_Axis = function (Vector) {select (Vector, x, y, z)}
>
> Which worked, but did not give me the expected results.
> My debug statements with str complained that it expected a value, but a vector
> was encountered instead, which leads me to believe that it was returning the
> _vector_ quantities x, y, and z  which I thought functions couldn't do?
>
> modifying/correcting to:
>
> #declare f_Axis = function (x, y, z, Vector) {select (Vector, x, y, z)}
>
> yielded the expected scalar worldcoordinate, so that's an interesting pair of
> results.
+1 to the addition of conditional in userdefined functions ! I also use select
as a replacement but as you say it would be much easier to use an explicit
condition.
Having no limitation of parameters to float values would also be very helpful.
Also, I found the equivalence x/u and y/v, the default x,y,z optional arguments,
or the fact they share the same name with the predefined vectors x,y,z, all very
confusing. It made me avoid the use of userdefined functions for a long time,
and even now I'm always a bit reluctant, trying to find workaround as much as
possible.
Hopefully a future version of Povray will improve their usability.
Pascal
Post a reply to this message


 
 




 
 


"Bald Eagle" <cre### [at] netscapenet> wrote:
> I was also trying to minimize the processing of vectors, and executed the
> following:
>
> #declare f_Axis = function (Vector) {select (Vector, x, y, z)}
>
> Which worked, but did not give me the expected results.
> My debug statements with str complained that it expected a value, but a vector
> was encountered instead...
>
For your #debug, did you try just str? or vstr (for vectors, to see what
would happen)? This is probably tangential to you're main concern, but it's
worth a try...
example...
#debug concat("\n","my vector = <",vstr(3,Vector,", ",0,5),">","\n")
Post a reply to this message


 
 




 

