|
![](/i/fill.gif) |
Am 03.12.2016 um 12:47 schrieb [GDS|Entropy]:
> In a macro when I have a parameter of type vector and pass its value as
> such, I get an error:
>
> abs(x - Position.x)
>
> But if I do this it works:
>
> #local positionX = Position.x;
> abs(x - positionX)
I very much doubt that the latter works.
As William already pointed out, the problem isn't so much the use of
`Position`, or even `Position.x`, but the very first term of the
expression inside `abs()`: The lone `x`.
When standing on its own (as opposed to `Something.x`) outside of a
function definition, `x` is a constant evaluating to `<1,0,0>`. Thus,
the expression
abs(x - Position.x)
is equivalent to
abs(<1,0,0> - Position.x)
which, thanks to scalar-to-vector promotion, is in turn equivalent to
abs(<1,0,0> - <Position.x,0,0>)
which in turn is equivalent to
abs(<1-Position.x,0,0>)
The location given for the error message may be misleading, but POV-Ray
does not know that the expression inside the `abs()` will evaluate to a
vector until it has indeed completely parsed the expression.
Post a reply to this message
|
![](/i/fill.gif) |