POV-Ray : Newsgroups : povray.pov4.discussion.general : Using vector components as function parameters Server Time
21 Nov 2024 06:58:34 EST (-0500)
  Using vector components as function parameters (Message 1 to 3 of 3)  
From: scott
Subject: Using vector components as function parameters
Date: 20 May 2013 10:41:57
Message: <519a3635$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) }


Post a reply to this message

From: Simon Copar
Subject: Re: Using vector components as function parameters
Date: 20 May 2013 11:35:00
Message: <web.519a4283b1d79f3465a03f8f0@news.povray.org>
scott <sco### [at] scottcom> wrote:
> 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.

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


Post a reply to this message

From: Gyscos
Subject: Re: Using vector components as function parameters
Date: 2 Oct 2013 10:45:02
Message: <web.524c3130b1d79f3434b5e3610@news.povray.org>
"Simon Copar" <inf### [at] gmailcom> wrote:
> scott <sco### [at] scottcom> wrote:
> > 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.
>
> This message is better suited for the "newusers" section.

Maybe it was a way of asking 'Could functions in POV-Ray 4.0 be general enough
to
handle vectors, and basically anything ou would expect from a regular
computer-science function ?', which is an interesting question, altough probably
an already asked one.


Post a reply to this message

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