![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Another good thing about the operator-and-assignment is that it can
save writing and make parsing faster.
For example, consider this:
#declare Table[Index1*2+Offset1][Index2*2+Offset2] =
Table[Index1*2+Offset1][Index2*2+Offset2] + 1;
vs:
#declare Table[Index1*2+Offset1][Index2*2+Offset2] += 1;
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp <war### [at] tag povray org> wrote in news:3db1b7e0@news.povray.org
#declare Table[Index1*2+Offset1][Index2*2+Offset2] =
Table[Index1*2+Offset1][Index2*2+Offset2] + 1;
$Table[$Index1*2+$Offset1][$Index2*2+$Offset2]+=1;
syntax $var_name ihas one greate advantage :
$sphere = 10;
$ior = 50;
You can use variable names that are reserved words. This is in fact VERY usefull,
in stuff like :
// from #version 3.1
#declare dispersion = 5.0;
--
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Rafal 'Raf256' Maj <raf### [at] raf256 com> wrote:
> syntax $var_name ihas one greate advantage :
> $sphere = 10;
> $ior = 50;
> You can use variable names that are reserved words.
How do you expect to use those variable names?
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp <war### [at] tag povray org> wrote in news:3db1bd8f$6@news.povray.org
I.e someone will write script, with variables like say :
a, b, c, speed, displacment, size
It will work fine, until in say POV 4.0 displacment will became a
reserved word and stop this script from working.
I like very much PHP style - where every variable name starts with '$'.
What do You think about allowing, as PHP, syntax with variant types,
say :
$x = 100;
"foo"+$x+"bar" will result in "foo100bar" (x is used like string)
and :
20 + $x will result in 120 (x is used like number)
--
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Rafal 'Raf256' Maj wrote:
> I.e someone will write script, with variables like say :
> a, b, c, speed, displacment, size
> It will work fine, until in say POV 4.0 displacment will became a
> reserved word and stop this script from working.
Just do as the docs suggest and use at least one capital letter in your
variable names.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Rafal 'Raf256' Maj <raf### [at] raf256 com> wrote:
> 20 + $x will result in 120 (x is used like number)
FYI it didn't work that way in MegaPov.
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp <war### [at] tag povray org> wrote in news:3db1cf8f@news.povray.org
> Rafal 'Raf256' Maj <raf### [at] raf256 com> wrote:
>> 20 + $x will result in 120 (x is used like number)
> FYI it didn't work that way in MegaPov.
Yes - it didn't. Do You think it would be a good idea to allow such
behaviour ?
--
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Rafal 'Raf256' Maj" <raf### [at] raf256 com> wrote in message
news:Xns### [at] 204 213 191 226...
> syntax $var_name ihas one greate advantage :
>
> $sphere = 10;
> $ior = 50;
>
> You can use variable names that are reserved words. This is in fact VERY
> usefull, in stuff like :
That's not useful, in fact it sounds like a terrible idea, and isn't any
more possible with that syntax anyway.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Rafal 'Raf256' Maj" <raf### [at] raf256 com> wrote in message
news:Xns### [at] 204 213 191 226...
> I.e someone will write script, with variables like say :
> a, b, c, speed, displacment, size
> It will work fine, until in say POV 4.0 displacment will became a
> reserved word and stop this script from working.
Use upper case in your variable names. Upper case words will never be
reserved.
> What do You think about allowing, as PHP, syntax with variant types,
> say :
> $x = 100;
> "foo"+$x+"bar" will result in "foo100bar" (x is used like string)
> and :
> 20 + $x will result in 120 (x is used like number)
You're joking, right? You *like* that?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Christopher James Huff" <cja### [at] earthlink net> wrote in message
news:3db1f4a3@news.povray.org...
> "Rafal 'Raf256' Maj" <raf### [at] raf256 com> wrote in message
> news:Xns### [at] 204 213 191 226...
> > I.e someone will write script, with variables like say :
> > a, b, c, speed, displacment, size
>
> Use upper case in your variable names. Upper case words will never be
> reserved.
Would it be conceivable that a future POV-Ray could tag any and all
user-defined identifiers, regardless of case, as a non-keyword? It's not
always compulsory to use upper case letters so it can seem okay. In fact,
people have often complained they couldn't use a number as the first
character either.
> > What do You think about allowing, as PHP, syntax with variant types,
> > say :
> > $x = 100;
> > "foo"+$x+"bar" will result in "foo100bar" (x is used like string)
> > and :
> > 20 + $x will result in 120 (x is used like number)
>
> You're joking, right? You *like* that?
That would be weird to me.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |