|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'm not that much into how functions work and should work, but this surely
must be a bug?
The following code:
#declare V = 0.1;
#declare Myfunction = function (V) {V*2}
sphere {x, V}
Gives the error:
"#declare V = 0.1;
#declare Myfunction = function (V <----ERROR
Parse Error: Expected 'parameter identifier', float function 'float
identifier' found instead
Returned from renderer with error status"
I'm using POV-Ray 3.5 beta 6
on a P150, 16MB RAM
Windows 95 4.00.450 B IE 5 5.00.2919.6307
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
V does not represent your function, it's just a parameter. As it is now you
are telling povray to do:
#declare Myfunction (0.1) (0.1*2)
sphere {x, 0.1)
which isn't correct.
try something like this:
#declare Myfunction = function (V) {V*2}
sphere {x, Myfunction (0.1)}
--
Jonathan.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"JRG" wrote:
> V does not represent your function, it's just a
> parameter. As it is now you are telling povray to do:
> #declare Myfunction (0.1) (0.1*2)
But shouldn't the parameters use a different name-space than things declared
outside of the functions, just like it works with macros?
This:
#declare V = 0.1;
#include "math.inc"
gives an error because a function in math.inc uses V as a parameter! We
can't have that, now can we?
> try something like this:
>
> #declare Myfunction = function (V) {V*2}
> sphere {x, Myfunction (0.1)}
No because that's not what I want. I want the function to leave alone my
declared floats and stop bothering them.
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Rune wrote:
>
> But shouldn't the parameters use a different name-space than things declared
> outside of the functions, just like it works with macros?
>
Since it's leagal to use declared variables in functions, this would lead
to at least a lot of confusion.
Christoph
--
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other
things on: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ah aaah.... now I understand...
You want to give your float identifiers any name you want without bothering
that that name is already used somewhere (for example in math.inc) as a
function parameter. But why bother? Just use another identifier. Of course I
usually expect an uppercased identifier (such as R) to work in any
situation, but this could be just a minor problem in math.inc design.
--
Jonathan.
"Rune" <run### [at] mobilixnetdk> ha scritto nel messaggio
news:3bd9fd4e@news.povray.org...
> "JRG" wrote:
> > V does not represent your function, it's just a
> > parameter. As it is now you are telling povray to do:
> > #declare Myfunction (0.1) (0.1*2)
>
> But shouldn't the parameters use a different name-space than things
declared
> outside of the functions, just like it works with macros?
>
> This:
>
> #declare V = 0.1;
> #include "math.inc"
>
> gives an error because a function in math.inc uses V as a parameter! We
> can't have that, now can we?
>
> > try something like this:
> >
> > #declare Myfunction = function (V) {V*2}
> > sphere {x, Myfunction (0.1)}
>
> No because that's not what I want. I want the function to leave alone my
> declared floats and stop bothering them.
>
> Rune
> --
> 3D images and anims, include files, tutorials and more:
> Rune's World: http://rsj.mobilixnet.dk (updated June 26)
> POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
> POV-Ray Webring: http://webring.povray.co.uk
>
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3bd9fd4e@news.povray.org> , "Rune" <run### [at] mobilixnetdk>
wrote:
> But shouldn't the parameters use a different name-space than things declared
> outside of the functions, just like it works with macros?
No, because one is the scene level and the other the parser level. The
parser values are inserted first by substituting every variable you
declared. The resulting scene file (which is invisible to you) is the
passed on the the actual parser which only sees the 0.1 as it should because
the "V" has been substituted by "0.1" as you requested.
You mistake is part of the functions are no macros misunderstanding!
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Christoph Hormann" wrote:
> Since it's leagal to use declared variables in functions,
When you *call* functions, not when you initiate them! At least it shouldn't
be since it makes no sense at all.
Take a macro:
#declare V = 0.1:
#macro MyMacro(V) V*2 #end
sphere {x, 0.1}
Here's there's no problem since the parameter in the macro doesn't conflict
with already declared variables. You can still call the macro with the
declared variable and *then* it will be used:
#declare B = MyMacro(V);
But with functions a conflict happens at the time of declaring the function
and that's all wrong.
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"JRG" wrote:
> But why bother? Just use another identifier.
To use long cryptic parameter names and/or variable names just to avoid a
name conflicts is not an acceptable solution. You can never know if some
include file uses the same name you're using for your variables.
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3bda83a9$1@news.povray.org> , "Rune"
<run### [at] mobilixnetdk> wrote:
> When you *call* functions, not when you initiate them! At least it shouldn't
> be since it makes no sense at all.
>
> Take a macro:
>
> #declare V = 0.1:
> #macro MyMacro(V) V*2 #end
> sphere {x, 0.1}
>
> Here's there's no problem since the parameter in the macro doesn't conflict
> with already declared variables. You can still call the macro with the
> declared variable and *then* it will be used:
>
> #declare B = MyMacro(V);
>
> But with functions a conflict happens at the time of declaring the function
> and that's all wrong.
Repeat after we:
Functions are not macros. Functions are not macros. Functions are not
macros. Functions are not macros. Functions are not macros. ...
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Thorsten Froehlich" wrote:
> The parser values are inserted first by substituting
> every variable you declared.
But it doesn't make sense to have parameters that are constant! And indeed
an error is generated as I reported! The *only* result of the way it woks
now is apparently that parameter names cannot use the same name as declared
variables and that's *very* inconvenient, as it's very common to use
one-letter names for both variables and for function parameters.
> You mistake is part of the functions are no macros misunderstanding!
But what's the logic behind how it works? It seems to be a big limitation
that have no positive effects at all...
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |