Thread: Points, vectors, matrices

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    Hmm, I hope I correctly understand what you're asking here.

    From any vector in n dimensions, you can represent the magnitude of that point with one dimension, and the direction in in n-1 directions. For example, we might change the expression...

    (3, 4) (Cartesian)
    to
    (5, ACOS(3 / 5)) (Polar)

    These are how we traditionally represent vectors, although really any means that we can use as acceptable. For example, we might not want to use the ACOS(), we could just as well use...
    (5, 3/5) (Fantasy System)
    Which obviously conveys as much information as the prior ones (although such a system might have difficulty representing say, a .1degree angle)

    For 3-dimensional coordinates, we do largely the same thing...

    (2, 3, 6) (Cartesian)
    to
    (7, ACOS(2/7), ACOS(3/7)) (Polar)

    From any point, we can get a direction, and how many dimensions it takes to represent that direction is the number of dimensions of the point - 1

    But that is all just coordinate systems. A vector doesn't have to be a magnitude and a direction, just as a point doesn't have to be rectangular coordinates. The only real difference in points and vectors is how they are used. For example, in telling the temperature, we would use a one-dimensional point...

    It is 75 degrees outside. (This is a point, 75)

    The temperature difference between outside and inside is 20 degrees. (This is a vector, 20)

    The difference between a point and a vector really is just a matter of context. You can change all your points to vectors from the origin and it won't make an ounce of difference.


    As for matrix multiplication and vectors... well, let's say I have a pyramid (4 sides, 4 corers) figure that I want to represent as 4 vectors (each vector will be pointing at a corner) These are the vectors...
    (2, 3, -5),
    (-2, 5, 6),
    (1, -4, 4), and
    (3, 4, -5)

    Notice that having the vectors point at the corners is one way in which we can represent any polygon as a set of vectors.

    Now if I want to turn this set of 4 3-dimensional vectors into a matrix, I just represent them vertically and put 'm next to each other...
    Code:
    //Matrix here...
    ( 2, -2,  1,  3)
    ( 3,  5, -4,  4)
    (-5,  6,  4,  5)
    // Each column is a vector, read from top to bottom
    The whole point of organizing vectors as a matrix is so that we can perform some operation on all the vectors at the same time, and thus be performing that operation on the polygon. Matrix multiplication only allows us to really add and multiply, but addition and multiplication is all that you really need to perform rotations, and that's just about all you'll find yourself caring about in graphics. Now, let's say we want to rotate this polygon by 90 degrees about the x axis. We just figure out the matrix which represents this operation...
    Code:
    ( 1,  0,  0)
    ( 0,  0, -1)
    ( 0,  1,  0)
    We multiply the matrix representing the operation by the one representing the polygon, and viola, we have a new set of vectors representing the original polygon rotated by 90 degrees.

    There are some properties affecting vectors as matrices. First off, for every vector that goes into the equation, a vector will come out. The dimension of the vectors may change, for example, we might pass 3 dimensional vectors to be operated on, and come out with 4 dimensional, or even 1 dimensional vectors, but the number of vectors will not change.
    Second, when we run together the vectors like this, the vectors don't affect each other. The only reason we clump them together for matrix multiplication is that since we're usually performing the same operation on all the vectors representing a polygon, it's efficient to just perform all the operations at once.
    Last edited by QuestionC; 01-03-2002 at 03:26 AM.
    Callou collei we'll code the way
    Of prime numbers and pings!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help it won't compile!!!!!
    By esbo in forum C Programming
    Replies: 58
    Last Post: 01-04-2009, 03:22 PM
  2. Replies: 8
    Last Post: 11-03-2008, 09:48 PM
  3. Vectors
    By naseerhaider in forum C++ Programming
    Replies: 11
    Last Post: 05-09-2008, 08:21 AM
  4. Yahtzee C++ programme help
    By kenneth_888 in forum C++ Programming
    Replies: 13
    Last Post: 09-05-2007, 02:14 PM
  5. CProg Fantasy Football version pi
    By Govtcheez in forum A Brief History of Cprogramming.com
    Replies: 155
    Last Post: 12-26-2006, 04:30 PM