How to make transformation matrix for new origin + xyz-axis (vectors)?

Discussion in 'General Math' started by Erwin Moller, Dec 6, 2011.

  1. Erwin Moller

    Erwin Moller Guest

    Hi,

    I am new in this group, so if this question is not suitable in here,
    kindly direct me to a better group.

    Background:
    I am writing a 3D package with a friend in Javascript, just for the fun
    of it. We are able programmers, but not-so-able mathematicians. ;-)
    We refuse to use a ready-to-go lib, like Sylvester, because we *want* to
    re-invent the wheel and write everything from scratch. That way we are
    sure we understand everything we are doing.

    Situation:
    We have set up a "world" using positionvectors to point to points in our
    world. We can draw triangles with colors (and later surfaces from
    images) in that world.
    Now we need a way to look at the world.

    Hereunder I use PV and V. PV means Position Vector, V means Vector, but
    they both are just vectors of course, but it is easier to treat them
    different for us so the PV is a point, and a V is a direction (and length).
    Now we want to look at our world from a certain position.
    We defined:

    - PV-eye: The Eye positionvector (Where is the eye?).
    - PV-eyeLook: A positionvector that represents the place the Eye looks at.
    - V-eyeLook: the direction the eye looks at. (Simply calculated by
    subtracting PV-eyeLook from PV-eye)
    - V-eyeRight: The rightdirection according to eye-axis.
    - V-eyeUp: The updirection according to eye-axis.

    We made V-eyeLook, V-eyeRight and V-eyeUp unitvectors (length 1).
    We also made sure they are also perpendicular to each other.

    The problem:
    We need a way to transform points expressed in the world-axis to our
    eye-axis.
    World-axis uses:
    1
    x-vector:(0)
    0

    0
    y-vector:(1)
    0

    0
    z-vector:(0)
    1

    and origin 0,0,0 of course.

    And the Eye-axis are also defined with 3 vectors (V-eyeLook, V-eyeRight
    and V-eyeUp) and have their origin in PV-eye.

    EL1
    V-eyeLook:(EL2)
    EL3

    ER1
    V-eyeRight:(ER2)
    ER3

    EU1
    V-eyeUp:(EU2)
    EU3



    What we would like is to learn how to express any World-coordinate in
    Eye-coordinates, preferably using a Matrix that takes care of the
    transformation and translation.

    For example:
    The World-axis x must become V-eyeRight
    The World-axis y must become V-eyeUp
    The World-axis z must become V-eyeLook

    We understand that a 4x4 matrix that uses an extra w can do the trick,
    but I cannot find any online resource that explains in detail.
    Kahn academy helped a little but didn't exactly crack this puzzle.
    We have found solutions and such, but we want to understand the how and
    why before implementing.
    I expect this is standard material to learn for students working with 3D.

    Can anybody help or point us to a great online resource on the subject?

    Thanks for your time, and sorry for the lengthy post.

    Regards,
    Erwin Moller
     
    Erwin Moller, Dec 6, 2011
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.