POV-Ray : Newsgroups : povray.text.tutorials : Re: Macro tutorial. Server Time
24 Nov 2024 01:22:14 EST (-0500)
  Re: Macro tutorial. (Message 1 to 1 of 1)  
From: Spider
Subject: Re: Macro tutorial.
Date: 1 May 1999 00:24:42
Message: <372A72B6.F4FE8E57@bahnhof.se>
Hmm... to make atutorial on programming is one thing, and macros is another..

I think you should know the difference first...

A pprogram will produce a predicted result from a known set of data, where the
data must be provided before execution. This can be done in two major ways.

1) Declare variables(input data) in one file, and present the code in another.
2) Declare variables in the same file.

The end result is pretty much the same, but there is still a difference.

in a macro, you place a pice of code inside a "container" and then call them.
But in this case, you set the original identifiers when calling the macro..

As for loops go, it's just a fancy way of saying "do this when this thing is
true" 

exaample.
#while(1=2)
  sohere {<....}
#end

would never execute, since "1" never equaks "2"
, but

#while(2=2)
 ...
#end
would get stuck, since whatever you do it would be true. (explain to a conputer
that 2 isn't really 2 ...))

To make this work in some way, we need to contrain the loop into something that
works.

try this as an example.
#declare Loop = 0;
#declare Endloop = 10;

#while (Loop<Endloop)
  sphere{}
  #declare Loop = Loop + 1;
#end


This code woyuld be executed Endloop times (10). since as long as the variable
Loop is less than 10, it will be true, and thus will be executed. But when it
passes 9 (Loop =9 +1) it will no longer be less than ten, and thus will not be
executed  again...

hope this helps..


-- 
//Spider    --  [ spi### [at] bahnhofse ]-[ http://www.bahnhof.se/~spider/ ]
And the meek'll inherit what they damn well please
	Get ahead, go figure, go ahead and pull the trigger
		Everything under the gun
			--"Sisters Of Mercy" -- "Under The Gun"


Post a reply to this message

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