POV-Ray : Newsgroups : povray.newusers : Re: Using vector components as function parameters Server Time
22 Dec 2024 06:21:46 EST (-0500)
  Re: Using vector components as function parameters (Message 1 to 3 of 3)  
From: scott
Subject: Re: Using vector components as function parameters
Date: 20 May 2013 12:19:56
Message: <519a4d2c$1@news.povray.org>
>> How come this doesn't parse:
>>
>> #local V = <0,1,2>;
>> #local f = function(x,y,z){ sin(x*V.x) }
>>
>> but this does:
>>
>> #local V = <0,1,2>;
>> #local Vx = V.x;
>> #local f = function(x,y,z){ sin(x*Vx) }
>
> Vectors don't work in functions. Nothing vector-like will work, except if your
> function is a special vector function (defined as a transform or a spline).
> Everything else is scalar-only.

Isn't V.x a scalar value? It's not obvious why it results in an error, 
after all the parser internally should evaluate V.x and Vx to exactly 
the same value (zero in this case).

> This message is better suited for the "newusers" section.

Oops, must have selected the wrong group... changed it now.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Using vector components as function parameters
Date: 21 May 2013 20:18:59
Message: <519c0ef3@news.povray.org>
scott wrote:

> Isn't V.x a scalar value? It's not obvious why it results in an error, 
> after all the parser internally should evaluate V.x and Vx to exactly 
> the same value (zero in this case).

AFAIK the function parser is different from the normal parser,
and therefore more restricted.


Post a reply to this message

From: scott
Subject: Re: Using vector components as function parameters
Date: 22 May 2013 03:12:33
Message: <519c6fe1$1@news.povray.org>
>> Isn't V.x a scalar value? It's not obvious why it results in an error,
>> after all the parser internally should evaluate V.x and Vx to exactly
>> the same value (zero in this case).
>
> AFAIK the function parser is different from the normal parser,
> and therefore more restricted.

OK that explains it then.


Post a reply to this message

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