Results 1 to 9 of 9

Thread: What do the numbers in the matrix mean?

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2001
    Posts
    1

    What do the numbers in the matrix mean?

    Can somebody tell me what the numbers in the transformation matrices actually represent? This is a system of linear equations, right? What are the equations?

    Thanks...

    Lloyd Bonafide

  2. #2
    Junior Member Newbie
    Join Date
    Aug 2001
    Location
    Thessaloniki,Macedonia,Greece
    Posts
    11

    Re: What do the numbers in the matrix mean?

    Well my friend -it's not exactly a system of linear equations because the matrix is not multiplied with a vector (a matrix column);the matrix is multiplied with another 4x4 matrix.In general the elements of the main diagonal (1,1) (2,2) (3,3) have to do with the scale part of the matrix in x,y and z directions.The elements (1,4),(2,4) and (3,4) with the transformation part and all the other elements (except the fourth row which does not contain info-all elements are zero except the last which is 1) with the rotation stuff (in combination with the elements of the diagonal).

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Adelaide, South Australia, Australia
    Posts
    763

    Re: What do the numbers in the matrix mean?

    er, well, if you have a matrix * vector:

    Code :
    [x'] = [ A B ] * [ x ]
    [y'] = [ C D ] * [ y ]
    then this forms two linear equations:

    x'=Ax + By
    y'=Cx + Dy

    the matrix represents the coefficients of the linear equations.

    cheers,
    John


    [This message has been edited by john (edited 08-28-2001).]

  4. #4
    Member Contributor
    Join Date
    Aug 2001
    Location
    Berkeley, Ca., USA
    Posts
    52

    Re: What do the numbers in the matrix mean?

    Originally posted by lbonafide:
    Can somebody tell me what the numbers in the transformation matrices actually represent? This is a system of linear equations, right? What are the equations?
    If you _really_ want to know exactly what's going on, I highly recommend reading Computer Graphics : Principles and Practice, Second Edition in C. (Available at Amazon: http://www.amazon.com/exec/obidos/ASIN/0201848406 )

    It's not specifically about OpenGL, but it explains (in great detail) how to build a rendering engine. It starts with a discussion of rasterizing lines and goes from there. Not exactly a light read, but you'll really know what's happening by the time you're done.

    I'm going though it now (I've had it for years, but this is the first full read through) and I can't say enough good things about it...

    Hope this helps

  5. #5
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    12

    Re: What do the numbers in the matrix mean?

    The top-left 3x3 numbers are the rotation part. They're actually 3 vectors, telling you which way up, left, and back (or the other way are facing. They should be of length 1. Other lengths give make your object larger or smaller.
    The top 3 numbers on the right are x y and z scale I believe.
    The 3 bottom-left numbers are x y and z translation.
    I may have mixed the last 2 rows up, can't check right now.
    What the last number (bottom right) is for, I don't know. Don't know if it's even used, I certainly never used it

  6. #6
    Senior Member Regular Contributor
    Join Date
    Dec 1969
    Location
    Munich,Germany
    Posts
    227

    Re: What do the numbers in the matrix mean?

    Check this link for further Information about the matrices: http://www.opengl.org/discussion_boards/cgi_directory/
    yes

  7. #7
    Junior Member Newbie
    Join Date
    Aug 2001
    Location
    Thessaloniki,Macedonia,Greece
    Posts
    11

    Re: What do the numbers in the matrix mean?

    [quote]Originally posted by john:
    [B]er, well, if you have a matrix * vector:

    Code :
    [x'] = [ A B ] * [ x ]
    [y'] = [ C D ] * [ y ]
    then this forms two linear equations:

    x'=Ax + By
    y'=Cx + Dy

    the matrix represents the coefficients of the linear equations.

    cheers,
    John

    If you examine a specific point then that's true John-although it's not quite like that because here x and y are known!If it were a linear system then x and y would be the unknown variables!

  8. #8
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: What do the numbers in the matrix mean?

    A, B, C and D build the matrix, i.e. the coeficients in the equation system. x and y are two unknown variables building a 2D coordinate, can be any value you like, which are transformed by the matrix, i.e. the equation system, and results in a new 2D point represented by x' and y'.

    So what do you mean by John examining a specific point? If x and y are know, can you tell me their values?

  9. #9
    Senior Member Regular Contributor nickels's Avatar
    Join Date
    Feb 2000
    Location
    Colorado
    Posts
    284

    Re: What do the numbers in the matrix mean?

    Your opengl matrix looks like (forget about homogeneous coordinates):

    a b c
    d e f
    g h i

    and, of course, your points looks like:
    x
    y
    z

    Now when the matrix "acts" on your point, what is meant is your point is multiplied by the matrix. The formula for this is:

    a b c x (a*x + b*y + c*z)
    d e f * y = (d*x + e*y + f*z)
    g h i z (g*x + h*y + i*z)

    So, for instance, pretend the matrix was:
    2 0 0
    0 2 0
    0 0 2

    Multiplying this matrix by your point gives:

    (2*x + 0*y + 0*z) 2x
    (0*x + 2*y + 0*z) = 2y
    (0*x + 0*y + 0*z) 2z

    In other words, it scales your point by 2.

    Now I don't attempt to explain why, but to rotate around the z axis by an angle A, the matrix looks like:

    cos(A) -sin(A) 0 x (cos(A)*x - sin(A)*y )
    sin(A) cos(A) 0 * y = (sin(A)*x + cos(A)*y)
    0 0 1 z z

    Notice the z coord stays fixed, as it should for a rotation around z.

    Many transformations are possible, but a matrix multiply is a "linear" operation, meaning it basically squishes and rotates your object. Translations can also be done with a matrix, but only one in a higher dimension that your vector space.

    Blah blah blah...

Similar Threads

  1. numbers to screen
    By phil67rpg in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-19-2006, 11:54 PM
  2. numbers range
    By Andrew Davey in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-14-2004, 03:50 AM
  3. displaying numbers
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-13-2001, 09:17 AM
  4. Random numbers help plz
    By iNsaNEiVaN in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-29-2001, 01:37 AM
  5. 3d text and numbers
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-15-2000, 02:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean