POV-Ray : Newsgroups : povray.advanced-users : Finer points of function syntax Server Time
14 May 2021 19:29:43 EDT (-0400)
  Finer points of function syntax (Message 1 to 2 of 2)  
From: Bald Eagle
Subject: Finer points of function syntax
Date: 23 Jul 2019 16:10:01
Message: <web.5d376884236c0b6e4eec112d0@news.povray.org>
1.   is there a way to define a tuple-style argument to act as the x,y,z for the
function parameters?

Something like #declare _p = ???tuple-thing??? ;

#declare Result = FunctionQ (_p)

2.     With #declare F = function {spline ...........}
I have no problems using #declare I = function {F(FunctionQ(x,y,z)).x}
but when I try to use #declare I = function {F(FunctionQ(X,Y,Z)).x}
I get:
Parse Error: Expected 'parameter identifier or floating-point constant
identifier', } found instead

3. for spline functions, is there a syntax (or a work-around) that allows a
function to be used in the vector definition?

#declare FSpline = function {
 spline {
    0, <0,   0,   FunctionW (x,y,z)>


Post a reply to this message

From: Bald Eagle
Subject: Re: Finer points of function syntax
Date: 24 Jul 2019 14:35:01
Message: <web.5d38a4b14d13b5404eec112d0@news.povray.org>
Also wondering if there's a way to employ vector component dot notation keywords
in an array, or otherwise/workaround.

Such as:

#declare VecC = array [5] {red, green, blue, filter, transmit];

Thus allowing things like

function { Something (x, y, z).Vec[N] }

Maybe there's a way to "wrap" such things in a directive like keyword (red) or
include (red) so that the parser "reads through" the directive and treats the
internal part as though it were #include-d, and array [1] {include(red)} would
be a valid statement.
I'm only suggesting it because I know clipka relishes the idea of rewriting the
parser.  :D

And, just because this never occurred to me the last time we delved into vector
component names:

Perhaps it would help keep things straight for new users, and help avoid
confusion when debugging if there were a numeric designation for vector
components 1-5.

To my knowledge, we don't use @ as a reserved symbol, so maybe
Vector.@1, Vector.@2, Vector.@3, Vector.@4, Vector.@5 could be something to
consider as an addition to the language somewhere down the line.

Post a reply to this message

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