|
|
|
|
|
|
| |
| |
|
|
From: Redbeard
Subject: Rand() problems (rand.inc and with functions)
Date: 9 Nov 2001 23:32:41
Message: <3becade9@news.povray.org>
|
|
|
| |
| |
|
|
I don't recall either of these being posted. Both are for POV-Ray 3.5 beta 7,
Win98SE, PIII 733/160, Athlon 700/192.
First, in rand.inc, the following change should be made to Vrand_In_Box:
#macro VRand_In_Box(Mn, Mx, RS) (< rand(RS), rand(RS), rand(RS)>*(Mx-Mn) + Mn)
#end
As it is currently written, it provides numbers outside the specified bounds,
since SRand returns [-1,1].
Second, I know (now) that rand is not valid in functions (it should be, IMHO),
but if you try with #declare F = function { rand(x) }
you get:
#declare F = function { rand(x) } <----ERROR
Parse Error: Expected 'function identifier', } found instead
I'm not exactly sure what this error is intended to mean. All I know is it
should have choked on rand and given an error there, instead. Or I could be
completely wrong.
An argument in favor of making rand usable in functions (there's probably
several against, and I might have read them at some point) is that it would make
most of the non-VRand macros in rand.inc much more efficient (as functions
instead of macros).
Michael
--
#macro M(D,J)text{ttf"cyrvetic.ttf"D 1,0translate-J}#end#macro N(E,K)#local A=
M(E,K)light_source{-z*30rgb 1projected_through{A}}#end N("Michael"<1.6,-.2,5>)
N("Johnson"<1.9.8,5>)sphere{z*9,4pigment{gradient x+y scale 10color_map{[0 rgb
x][1rgb x+y]}sine_wave}} // (c)2001 Michael D Johnson red### [at] wvadelphianet
Post a reply to this message
|
|
| |
| |
|
|
From: Thorsten Froehlich
Subject: Re: Rand() problems (rand.inc and with functions)
Date: 10 Nov 2001 04:46:10
Message: <3becf762$1@news.povray.org>
|
|
|
| |
| |
|
|
In article <3becade9@news.povray.org> , "Redbeard"
<red### [at] wvadelphianet> wrote:
> Parse Error: Expected 'function identifier', } found instead
>
> I'm not exactly sure what this error is intended to mean.
It thinks "rand" is a declared function because it doesn't know what else
rand could be. This is the correct behavior.
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
|
|
| |
| |
|
|
From: Redbeard
Subject: Re: Rand() problems (rand.inc and with functions)
Date: 11 Nov 2001 17:54:22
Message: <3bef019e@news.povray.org>
|
|
|
| |
| |
|
|
"Thorsten Froehlich" <tho### [at] trfde> wrote in message
news:3becf762$1@news.povray.org...
> In article <3becade9@news.povray.org> , "Redbeard"
> <red### [at] wvadelphianet> wrote:
>
> > Parse Error: Expected 'function identifier', } found instead
> >
> > I'm not exactly sure what this error is intended to mean.
>
> It thinks "rand" is a declared function because it doesn't know what else
> rand could be. This is the correct behavior.
>
> Thorsten
>
I just would have thought that the error would point out rand, or at least
something closer to rand. If an unknown identifier in the form of a called
function (i.e. function { Test(x) }) is parsed, the error is "Expected
'operator', ( found instead" This makes a little more sense to me. Why would
rand (which probably shouldn't be visible to the function parser) generate a
different error?
I'm not questioning the judgment, it's just that the message (as it stands)
doesn't make sense, epsecially if someone decides to try to use rand in a
function.
Michael
Post a reply to this message
|
|
| |
| |
|
|
From: Thorsten Froehlich
Subject: Re: Rand() problems (rand.inc and with functions)
Date: 12 Nov 2001 04:05:14
Message: <3bef90ca@news.povray.org>
|
|
|
| |
| |
|
|
In article <3bef019e@news.povray.org> , "Redbeard"
<red### [at] wvadelphianet> wrote:
> I just would have thought that the error would point out rand, or at least
> something closer to rand. If an unknown identifier in the form of a called
> function (i.e. function { Test(x) }) is parsed, the error is "Expected
> 'operator', ( found instead" This makes a little more sense to me. Why would
> rand (which probably shouldn't be visible to the function parser) generate a
> different error?
>
> I'm not questioning the judgment, it's just that the message (as it stands)
> doesn't make sense, epsecially if someone decides to try to use rand in a
> function.
It has to do with the slightly different internal representation of "rand"
compared to user defined variables.
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" <tho### [at] trfde> wrote in message
news:3bef90ca@news.povray.org...
> In article <3bef019e@news.povray.org> , "Redbeard"
> <red### [at] wvadelphianet> wrote:
>
>
> It has to do with the slightly different internal representation of "rand"
> compared to user defined variables.
>
Ok. Thanks,
Michael
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|