POV-Ray : Newsgroups : povray.newusers : Error-while loop Server Time
30 Jul 2024 00:24:34 EDT (-0400)
  Error-while loop (Message 1 to 4 of 4)  
From: Rishi
Subject: Error-while loop
Date: 17 Feb 2005 11:41:34
Message: <4214c93e$1@news.povray.org>
Hi,

Can someone tell me what is wrong with the following:

#declare row=0;
#while (row < 24)
#declare col=4;
#while (col<16)
object {T_chair translate <col, 0, row>}
#declare col=col+4;
#end
#declare row=row+6;
#end

#declare row=0;
#while (row < 24)
#declare col=-4;
#while (col>-16)
object {T_chair translate <col, 0, row>}
#declare col=col-4;
#end
#declare row=row-6;
#end

It starts rendering...and goes on and on..and on...and on...should it 
take that long? there is nothing much in the scene except for the chair 
which uses a simple texture and a sphere_sweep...and and a very simple 
isosurface...

Regards,

Rishi
P.S. Message window keeps displaying 'No pigment type given, but does 
not stop rendering...


Post a reply to this message

From: Daniel Hulme
Subject: Re: Error-while loop
Date: 17 Feb 2005 12:05:41
Message: <20050217170539.68fdeec9@dh286.pem.cam.ac.uk>
> #declare row=0;
> #while (row < 24)
> #declare col=4;
> #while (col<16)
> object {T_chair translate <col, 0, row>}
> #declare col=col+4;
> #end
> #declare row=row+6;
> #end
> 
> #declare row=0;
> #while (row < 24)
****************^^ This termination condition will never be reached.
row starts out as 0 and decreases, so it will always be < 24.
> #declare col=-4;
> #while (col>-16)
> object {T_chair translate <col, 0, row>}
> #declare col=col-4;
> #end
> #declare row=row-6;
> #end

btw, it is usual in POV-Ray to start your variable names with a capital
letter (Row, Col) because lowercase names might have some special
meaning in a future version of POV-Ray.

Daniel

-- 
I went to the CO guess what he told me guess what he told me | apologies
He said  boy u better learn to like Win  no matter what u do | to Prince
But  he's  a  fool,  'cos  nothing  compares,  nothing  compares  2  GNU
http://surreal.istic.org/ | A tidy desk is the product of an empty mind.


Post a reply to this message

From: Mike Williams
Subject: Re: Error-while loop
Date: 17 Feb 2005 12:08:28
Message: <$bKc5DAB+MFCFwcZ@econym.demon.co.uk>
Wasn't it Rishi who wrote:
>Hi,
>
>Can someone tell me what is wrong with the following:
>
>#declare row=0;
>#while (row < 24)
>#declare col=4;
>#while (col<16)
>object {T_chair translate <col, 0, row>}
>#declare col=col+4;
>#end
>#declare row=row+6;
>#end
>
>#declare row=0;
>#while (row < 24)
>#declare col=-4;
>#while (col>-16)
>object {T_chair translate <col, 0, row>}
>#declare col=col-4;
>#end
>#declare row=row-6;
>#end
>

The problem is with this bit

#declare row=0;
while (row < 24)
 . . .
#declare row=row-6;
#end

The value of row keeps getting more and more negative and always stays
below 24.

Try using "while (row >-24)"

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Rishi
Subject: Re: Error-while loop
Date: 17 Feb 2005 12:17:03
Message: <4214d18f@news.povray.org>
:P

Thanks a lot! I think it's time I stopped 'ctrl+C'ing...

Rishi


Post a reply to this message

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