POV-Ray : Newsgroups : povray.advanced-users : Parametrics and isosurfaces : Re: Parametrics and isosurfaces Server Time
3 May 2024 23:11:07 EDT (-0400)
  Re: Parametrics and isosurfaces  
From: clipka
Date: 6 Aug 2016 19:40:42
Message: <57a6757a$1@news.povray.org>
Am 06.08.2016 um 22:23 schrieb Bald Eagle:
> If I try to use:
>   function { (5+2*RESULT[int(u/Delta)][4]/Order) * sin(u) * cos(v) }, // x-axis
> 
> I get "Float expected but vector or color expression found"
> 
> Are u and v not scalar values?
> 
> (apparently not, since using u.gray gets me through the parsing...)

The problem here is that the function evaluation engine cannot access
any scene-level variables whatsoever. Therefore, whenever you specify
such a variable in a function, POV-Ray immediately evaluates it while
parsing the function, expecting to get a float, which it will insert
into the function as a constant.

This attempt at immediate evaluation also includes access to array
elements. However, the parsing of the array indices is done by the
parser for generic SDL code, /not/ the parser for user-defined
functions. Thus, in the sub-expression

    RESULT[int(u/Delta)][4]

the `u` is /not/ interpreted as the function's first parameter, but as
the vector constant `<1,0>`; this ultimately leads to a parse error,
since the int() function expects a float but encounters a vector.


Post a reply to this message

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