POV-Ray : Newsgroups : povray.newusers : Help with CGS : Re: Help with CGS Server Time
6 Sep 2024 08:11:00 EDT (-0400)
  Re: Help with CGS  
From: Markus Becker
Date: 16 Apr 1999 08:21:54
Message: <37171E09.16D8FD7C@zess.uni-siegen.de>
Ken wrote:
> 
> Markus Becker wrote:
> > What do you expect? If you have the "merge" _inside_ the #while
> > loop, POV creates a "merge"-object fo each pass through the
> > loop. That's the way things work. No need to ask "why?"

> Not altogether a programmer type and struggling to use what I can of these
> functions I expect no more or no less than what I can figure out myself
> of from what I can learn from the generous guidance of others. What is
> intuitively obvious to you is sometimes heap big juju magic to me.

That might be, myself being the programmer-type this has always been
obvious to me. Let me try to give you (or the original poster) a more
detailed explanation:

Case 1, "merge" _inside_ #while:

    #declare n = 0;
+-->  #while (n<10)
|       merge			// a new object is created
|       {
|          object {....}
|       }				// merge object is finished
|     #declare n = n+1;
+-- #end			// loop again and create a new object

Note that each time POV loops through the #while, it parses a 
complete merge-object.

Case 2, "merge" _outside_ #while:

    #declare n = 0;
    merge			// a new object is created
    {
+-->  #while (n<10)
|        object {....}
|     #declare n = n+1;
+-- #end			// loop again and create a new object
    }				// merge object is finished

Note here how the loop only adds new objects to the merge object.

Hope this makes it a little bit more clearer. Even if you're not at
all the programming type [tm], you should get one concept into
your head (no offense meant, it's just the lack of better english):

POV parses the file line by line and the #while only tells it
to parse some lines more often. It is just redirected to a new
position in the file.

The first case would "unroll" (common practice for the programmer
type ;-) to the following:

merge {object {...}}
merge{ object {...}}
merge {object {...}}

anbd the second case unrolls to:

merge
{
  object {...}
  object {...}
  object {...}
  object {...}
}

This should make it clearer.

Markus
-- 

 Ich nicht eine Sekunde!!!" H. Heinol in Val Thorens


Post a reply to this message

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