Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: why 4x4 matrix?

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    Mauritius
    Posts
    5

    why 4x4 matrix?

    elo people, i have a question. In fact I still can't get why we use a 4x4 matrix when working with homogeneous coordinates in opengl?? Please help...i've gone into some online tutorials but, still not clear.
    free thinkers are dangerous..

  2. #2
    Junior Member Newbie
    Join Date
    Mar 2004
    Location
    Bangalore
    Posts
    5

    Re: why 4x4 matrix?

    Well, 4x4 matrix is not only specifc to OpenGL. Wehn we recal our graphics fundamental for transformations, 4x4 matrix used to represent the coordinate system on which one of the row & column is dedicated for the x,y,z value.

    Originally posted by hanz:
    elo people, i have a question. In fact I still can't get why we use a 4x4 matrix when working with homogeneous coordinates in opengl?? Please help...i've gone into some online tutorials but, still not clear.

  3. #3
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,102

    Re: why 4x4 matrix?

    The matrix is used to transform your current coordinate system into the world coordinate system. The columns of the matrix gives the homogenous coordinates of the local coordinate system relative to the world coordinate system.

    To understand why you need 4 components instead of only 3, you have to understand how vectors and points are represented using homogenous coordinates. A coordinate system in 3D space is really composed of 4 components, not 3. They are the 3 axes (x,y,z) and the origin.

    Every vector in 3D space is a linear combination of the three axis, so (1,2,1,0) is really the vector 1*x+2*y+1*z+0*w, where x,y,z,w are the columns of the transformation matrix.

    Every point in 3D space is given by the origin plus a vector, so (1,2,3,1) is really the point 1*x+2*y*3*z+w, x,y,z,w are again the columns of the matrix.

    When you want to transform vertices, you really want to change the local coordinate system. The columns of the transformation matrix are the 4 components (x,y,z and the origin) of the new coordinate system relative to the old one. If you rotate or scale something, you only change the x,y,z components, but if you want to translate something, you need to change the coordinate origin, thus you need the fourth component of the matrix.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •