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.
Page Index Toggle Pages: 1
Matrix stuff (Read 1785 times)
Matrix stuff
Apr 13th, 2008, 4:13pm
 
Hello,

I'm pretty new to Processing but I ve been studying computational graphics in other environments... I just had a look at Matrices as understood by Processing... What is going on? I though we d have a 3x3 or 4x4 matrix to transform Homogeneous Vectors in 2D and 3D space accordingly but what I see is a weird 3x2 Matrix that I'm not very sure of how it works... Any suggestions?

Many thanks
Re: Matrix stuff
Reply #1 - Apr 14th, 2008, 5:35pm
 
> but what I see is a weird 3x2 Matrix

where do you see this?

official reference for matrix stuff:

http://processing.org/reference/applyMatrix_.html

which looks like 4x4
Re: Matrix stuff
Reply #2 - Apr 14th, 2008, 6:11pm
 
well... you are right , that does look like it , but then what is that Matrix you get on a new project if you type

printMatrix();

on the sketch? that is a 3x2 and that is the case for all simple sketches I ve created... do you have any suggestions?
Re: Matrix stuff
Reply #3 - Apr 14th, 2008, 6:15pm
 
It must have something to do with the mode you are in P3D for example , which makes sense because a 3D vector would need more elements to be transformed by , but my confusion is about that initial 3x2 matrix which isnt square and doesnt make much sense...

Also do we know if Processing uses Row Vector or Column Vector notation? Cause that would affect the way we view Matrices in the program..

many Thanks
Re: Matrix stuff
Reply #4 - Apr 14th, 2008, 6:32pm
 
relevant source is here (this for 2d case, i think):

http://dev.processing.org/source/index.cgi/trunk/processing/core/src/processing/core/PGraphics.java?rev=3787&view=markup

 /**
  * Model transformation of the form m[row][column],
  * which is a "column vector" (as opposed to "row vector") matrix.
  */

printmatrix() is also in the same file:

System.out.println(PApplet.nfs(m00, d, 4) + " " +
 PApplet.nfs(m01, d, 4) + " " +
 PApplet.nfs(m02, d, 4));

System.out.println(PApplet.nfs(m10, d, 4) + " " +
 PApplet.nfs(m11, d, 4) + " " +
 PApplet.nfs(m12, d, 4));

along with a different version of applyMatrix that only takes 6 params:

public void applyMatrix(
 float n00, float n01, float n02,
 float n10, float n11, float n12)

this page describes a 3x2 affine transform matrix: http://www.leptonica.com/affine.html
Page Index Toggle Pages: 1