FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   i still don't understand push() and pop()
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: i still don't understand push() and pop()  (Read 360 times)
buraque

Email
i still don't understand push() and pop()
« on: Feb 10th, 2005, 8:34am »

Pardon my lack of intelligence for I still can't figure out the role of push() and pop(). I read all examples and tutorials and threads, but couldn't find the fundamental answer to the question why. Is it something for matrix equations? Please help me.
 

for (IQ=0; IQ<300; IQ++) {
read();
writeProcessing();
}
fjen

WWW
Re: i still don't understand push() and pop()
« Reply #1 on: Feb 10th, 2005, 11:06am »

the idea behind it has to do with matrix math, yes.
think of it as preserving the current state you're in (location, rotation, scale). each pushpop could be considered as a new branch in a tree (see ben's anmone), where each itself can have many branches.
in keeping it you kind of get a "fresh start" after every push(), like setting a new origin in a 3D-application at where you currently are.
 
-- starting from point a --
 
push()
   turn to the left
   go 10 steps forward
   -- we are at point b --
 
   push()
 turn to the right
 go 10 steps forward
 -- we are at point c --
 do something ...
 
   pop()
   -- now we're back at point b --
 
pop()
-- now you're back at point a --
 
does this make it any clearer? .. sense?
couple of beer to much last night, gnnnn ...
/F
 
buraque

Email
Re: i still don't understand push() and pop()
« Reply #2 on: Feb 11th, 2005, 12:15am »

Thanks a lot. I got the idea.
 

for (IQ=0; IQ<300; IQ++) {
read();
writeProcessing();
}
Pages: 1 

« Previous topic | Next topic »