We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › push and pop matrix ... matrix stack :O
Page Index Toggle Pages: 1
push and pop matrix ... matrix stack ? :O (Read 1436 times)
push and pop matrix ... matrix stack ? :O
Apr 28th, 2010, 4:44am
 
hey, i checked the index and read the description of these functions but am now even more confused, is there any one who could explain these functions to me in detail but simple xD as im new to processing so if you use exspert language you may confuzzle me more  Cry

just to clarify the question can anyone explain what the push and pop matrix functions do and also what the matrix stack is ?


 Grin

many thanks in advance
Re: push and pop matrix ... matrix stack ? :O
Reply #1 - Apr 28th, 2010, 6:15am
 
http://processing.org/learning/transform2d/

Go read this first, and then come back and post again if you still have questions.
Re: push and pop matrix ... matrix stack ? :O
Reply #2 - Apr 29th, 2010, 4:29pm
 
Im not going lie that was a pritty useful link, thank you very much.

But is there any chance you could explain the matrix stack as it dosent really mention it in the link, unless i missed it.

Many thanks
Re: push and pop matrix ... matrix stack ? :O
Reply #3 - Apr 29th, 2010, 6:02pm
 
It does.

Quote:
Push and Pop

What, about the push and pop part of the names? These come from a computer concept known as a stack, which works like a spring-loaded tray dispenser in a cafeteria. When someone returns a tray to the stack, its weight pushes the platform down. When someone needs a tray, he takes it from the top of the stack, and the remaining trays pop up a little bit.

In a similar manner, pushMatrix() puts the current status of the coordinate system at the top of a memory area, and popMatrix() pulls that status back out. The preceding example used pushMatrix() and popMatrix() to make sure that the coordinate system was “clean” before each part of the drawing. In all of the other examples, the calls to those two functions weren’t really necessary, but it doesn’t hurt anything to save and restore the grid status.

Note: in Processing, the coordinate system is restored to its original state (origin at the upper left of the window, no rotation, and no scaling) every time that the draw() function is executed.
Page Index Toggle Pages: 1