POV-Ray : Newsgroups : povray.general : Possible BUG in function-handling (V3.5) : Re: Possible BUG in function-handling (V3.5) Server Time
5 Aug 2024 18:22:59 EDT (-0400)
  Re: Possible BUG in function-handling (V3.5)  
From: Thorsten Froehlich
Date: 13 Aug 2002 10:01:52
Message: <3d591150$1@news.povray.org>
In article <3d58fd40@news.povray.org> , "jansb000" <jan### [at] planetnl> 
wrote:

> #declare my_circle_centre = <1.1, 2.2, 3.3>;
> #declare my_fun =
> function(v) {
>    my_circle_centre.x  + v
> }
> // my_circle_centre.x is not recognised as a float.
>
> I think that my_circle_centre.x should be treated as a float.

No, this is a cureent design limitation that cannot easily be eliminated
completely in 3.5 but will go away in POV-Ray 4.0.

For now, use casting, i.e. like this will help:

#macro Const(theconst)
    #local retconst = theconst;
    retconst
#end

#declare my_fun = function(v)
{
    Const(my_circle_centre.x)  + v
}

Just like the other solutions proposed in this thread it will parse a bit
slower but have no (negative) effect on the function's speed.

    Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

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