POV-Ray : Newsgroups : povray.binaries.animations : POVigma: I just can't get it right! Server Time
19 Apr 2024 04:35:16 EDT (-0400)
  POVigma: I just can't get it right! (Message 11 to 11 of 11)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: "Jörg \"Yadgar\" Bleimann"
Subject: Re: POVigma: I just can't get it right!
Date: 30 Aug 2015 15:41:37
Message: <55e35c71$1@news.povray.org>
Hi(gh)!

On 30.08.2015 19:29, clipka wrote:

> Your information about the #break statement is outdated since 2010-04-18 ;-)
>
> As of Perforce change 4942 (included in 3.7.beta.37 and later), you can
> also use #break in any #while, #loop or #macro block to leave the
> respective construct early.

But regardless whether I use #break or not, even in combination with 
#else in the collision detection as showed here:

#declare rows=0; // check for collision with any stone
#while (rows < LevelLength)
   #declare cols=0;
   #while (cols < LevelWidth)
     // #warning concat("row: ", str(rows, 1, 0), ", col: ", str (cols, 
1, 0))
     #if (layer2_array[rows][cols] = 1 | layer3_array[rows][cols] >= 20)
       #declare xmin=cols-0.35;
       #declare xmax=cols+1+0.35;
       #declare zmin=rows-0.35;
       #declare zmax=rows+1+0.35;
       // horizontal obstacles
       #if (ballpos_next.x >= xmin & ballpos_next.x <= xmax & 
ballpos_next.z >= zmin & ballpos_next.z <= zmax & (ballpos.z < zmin | 
ballpos.z > zmax))
         #declare dir = 180-dir;
	#declare hit=1;
	#break
	// #declare cols=LevelWidth;
	// #declare rows=LevelLength; // loop is aborted
       #else
	#if (ballpos_next.x >= xmin & ballpos_next.x <= xmax & ballpos_next.z 
 >= zmin & ballpos_next.z <= zmax & (ballpos.x < xmin | ballpos.x > xmax))
	  #declare dir = -dir;
	  #declare hit=1;
	  #break
	  // #declare cols=LevelWidth;
	  // #declare rows=LevelLength; // loop is aborted
	#end
       #end
     #end
     #declare cols=cols+1;
   #end
   #if (hit)
     #break
   #end
   #declare rows=rows+1;
#end

the ball keeps bouncing off a non-existent "horizontal" wall and then 
moves right through the eastern wall!

See you in Khyberspace!

Yadgar


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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