|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
It looks like it ignores the first while.
Take a look at this:
#declare cRed=0
#declare cGreen=0
#while (cRed < 1)
#while (cGreen < 1)
sphere {<cRed*2.5,cGreen*2.5, 0>, 0.2 pigment {color rgb <cRed,
cGreen, 0>}}
#declare cGreen=cGreen+0.1
#end
#declare cRed=cRed+0.1
#end
It only makes 10 objects (this is what written in Messages)
and cRed always = 0. it looks like it only supports one #while.
possible (and easy) to do a workaround using mod (modulo, % in c++)
possible (but annoying) to do with a switch. do I have to use the
switch? or maybe it was fixed in a newer version? I'm running here
#version 3.1
BTW: I don't like the ; semicolon after #declare. it seems so wrong for
me, because it is a #directive that goes to the compiler. on C++, it
will Not have ; semicolon.
Post a reply to this message
|
|
| |
| |
|
|
From: Trevor Quayle
Subject: Re: while () { while () {}} doesn't work propertly.
Date: 25 Sep 2001 16:28:15
Message: <3bb0e8df@news.povray.org>
|
|
|
| |
| |
|
|
You need to redeclare cGreen as 0 again at the end of the cGreen loop to
reset it back to 0
-tgq
"Eitan Tal" <eit### [at] netvisionnetil> wrote in message
news:3BB0E68B.B75F68DB@netvision.net.il...
> It looks like it ignores the first while.
> Take a look at this:
> #declare cRed=0
> #declare cGreen=0
>
> #while (cRed < 1)
> #while (cGreen < 1)
> sphere {<cRed*2.5,cGreen*2.5, 0>, 0.2 pigment {color rgb <cRed,
> cGreen, 0>}}
> #declare cGreen=cGreen+0.1
> #end
#declare cGreen=0 // add this
> #declare cRed=cRed+0.1
> #end
>
> It only makes 10 objects (this is what written in Messages)
> and cRed always = 0. it looks like it only supports one #while.
>
> possible (and easy) to do a workaround using mod (modulo, % in c++)
> possible (but annoying) to do with a switch. do I have to use the
> switch? or maybe it was fixed in a newer version? I'm running here
> #version 3.1
>
> BTW: I don't like the ; semicolon after #declare. it seems so wrong for
> me, because it is a #directive that goes to the compiler. on C++, it
> will Not have ; semicolon.
>
Post a reply to this message
|
|
| |
| |
|
|
From: Trevor Quayle
Subject: Re: while () { while () {}} doesn't work propertly.
Date: 25 Sep 2001 16:36:10
Message: <3bb0eaba$1@news.povray.org>
|
|
|
| |
| |
|
|
> BTW: I don't like the ; semicolon after #declare. it seems so wrong for
> me, because it is a #directive that goes to the compiler. on C++, it
> will Not have ; semicolon.
>
I used to think the same, but there is a good reason why.
From the docs:
Note that there should be a semi-colon after the expression in all float,
vector and color identifier declarations. This semi-colon is introduced in
POV-Ray version 3.1. If omitted, it generates a warning and some macros may
not work properly.
try the following as a very simple example of why:
#macro Add3 (a,b,c)
#declare ab=a+b;
ab+c
#end
sphere{0 Add3(1,1,1) pigment{red 1}}
then remove the semi-colon and try again. It doesn't work because POV
doesn't truncate at the end-of-line so without the semicolon, it does not
know when tho end the declare in this case and the declare essentially
becomes:
"#declare ab=a+b ab+c"
ab+c becomes part of the decalre rather than being a separate operation.
-tgq
--
camera{location z*13look_at 0}light_source{15 15looks_like{sphere{0 10
}pigment{rgb 1}finish{ambient 15}}}union{torus{3,0.5rotate x*90}cone{y
*4,.5,-y*8,0}cone{-x*4,.5,x*8,0}pigment{rgb<.7,.6,.4>}finish{ambient 0
diffuse 0reflection{1fresnel on metallic 1}}interior{ior 25}rotate 15}
plane{y,-7pigment{checker rgb 0rgb 1scale 4}finish{diffuse.1}}// TGQ
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Trevor Quayle wrote:
> You need to redeclare cGreen as 0 again at the end of the cGreen loop to
> reset it back to 0
Oh, Right! I'm sorry I bothered you!
I completely forgot about it, thanks!
...It is very hard to work without a debugger, isn't it?
>
>
>
> -tgq
>
> "Eitan Tal" <eit### [at] netvisionnetil> wrote in message
> news:3BB0E68B.B75F68DB@netvision.net.il...
> > It looks like it ignores the first while.
> > Take a look at this:
> > #declare cRed=0
> > #declare cGreen=0
> >
> > #while (cRed < 1)
> > #while (cGreen < 1)
> > sphere {<cRed*2.5,cGreen*2.5, 0>, 0.2 pigment {color rgb <cRed,
> > cGreen, 0>}}
> > #declare cGreen=cGreen+0.1
> > #end
>
> #declare cGreen=0 // add this
>
> > #declare cRed=cRed+0.1
> > #end
> >
> > It only makes 10 objects (this is what written in Messages)
> > and cRed always = 0. it looks like it only supports one #while.
> >
> > possible (and easy) to do a workaround using mod (modulo, % in c++)
> > possible (but annoying) to do with a switch. do I have to use the
> > switch? or maybe it was fixed in a newer version? I'm running here
> > #version 3.1
> >
> > BTW: I don't like the ; semicolon after #declare. it seems so wrong for
> > me, because it is a #directive that goes to the compiler. on C++, it
> > will Not have ; semicolon.
> >
Post a reply to this message
|
|
| |
| |
|
|
From: Trevor Quayle
Subject: Re: while () { while () {}} doesn't work propertly.
Date: 25 Sep 2001 16:54:41
Message: <3bb0ef11$1@news.povray.org>
|
|
|
| |
| |
|
|
you can try using the #debug streaming to watch your variables when you have
problems
-tgq
(see below)
> > > #declare cRed=0
> > > #declare cGreen=0
> > >
> > > #while (cRed < 1)
> > > #while (cGreen < 1)
> > > sphere {<cRed*2.5,cGreen*2.5, 0>, 0.2 pigment {color rgb
<cRed,
> > > cGreen, 0>}}
> > > #declare cGreen=cGreen+0.1
#debug concat("cGreen",str(cGreen,0,1),"\n")
#debug concat("cRed",str(cRed,0,1),"\n")
> > > #end
> >
> > #declare cGreen=0 // add this
> >
> > > #declare cRed=cRed+0.1
> > > #end
> > >
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Since it does have to have semi-colons after floats, vectors, and colors, I
wish it would accept semi-colons after arrays and anything else that might
be declared. It's a nuisance to have to think about whether i should put one
in after I declare something. Perhaps it shouldn't be *required* for things
other than floats, vectors, and colors, but it'd be nice if it were
*accepted*.
- Slime
[ http://www.teja.nu/slime/ ]
[ http://www.teja.nu/slime/images/ ]
"Trevor Quayle" <Tin### [at] hotmailcom> wrote in message
news:3bb0eaba$1@news.povray.org...
> > BTW: I don't like the ; semicolon after #declare. it seems so wrong for
> > me, because it is a #directive that goes to the compiler. on C++, it
> > will Not have ; semicolon.
> >
>
> I used to think the same, but there is a good reason why.
> From the docs:
> Note that there should be a semi-colon after the expression in all float,
> vector and color identifier declarations. This semi-colon is introduced in
> POV-Ray version 3.1. If omitted, it generates a warning and some macros
may
> not work properly.
>
>
>
> try the following as a very simple example of why:
>
> #macro Add3 (a,b,c)
> #declare ab=a+b;
> ab+c
> #end
>
> sphere{0 Add3(1,1,1) pigment{red 1}}
>
> then remove the semi-colon and try again. It doesn't work because POV
> doesn't truncate at the end-of-line so without the semicolon, it does not
> know when tho end the declare in this case and the declare essentially
> becomes:
>
> "#declare ab=a+b ab+c"
>
> ab+c becomes part of the decalre rather than being a separate operation.
>
>
>
> -tgq
>
>
>
>
> --
> camera{location z*13look_at 0}light_source{15 15looks_like{sphere{0 10
> }pigment{rgb 1}finish{ambient 15}}}union{torus{3,0.5rotate x*90}cone{y
> *4,.5,-y*8,0}cone{-x*4,.5,x*8,0}pigment{rgb<.7,.6,.4>}finish{ambient 0
> diffuse 0reflection{1fresnel on metallic 1}}interior{ior 25}rotate 15}
> plane{y,-7pigment{checker rgb 0rgb 1scale 4}finish{diffuse.1}}// TGQ
>
>
>
>
>
>
>
>
>
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Slime wrote:
>
> Since it does have to have semi-colons after floats, vectors, and colors, I
> wish it would accept semi-colons after arrays and anything else that might
> be declared. It's a nuisance to have to think about whether i should put one
> in after I declare something. Perhaps it shouldn't be *required* for things
> other than floats, vectors, and colors, but it'd be nice if it were
> *accepted*.
To be honest with you I was kinda bitchy about the semi-colon addition
with v3.1, but after a couple of weeks of getting used to it, I add them
without even thinking about it. Give it a little time and it will become
second nature to you. No reason to change the program when we can change
you instead.
--
Ken Tyler - POV-Ray Technical Assistance Group
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|