3d to 2d mapping

Discussion in 'Java' started by Miguel De Anda, Jun 27, 2003.

  1. I'm trying to write a little script that draws dots into a 3d space. It is
    very small and has only 30 dots (5 by 6). These dots are on fixed x, y
    positions but I need to position them on various z positions. I want to make
    the z axis to be vertical (on the screen) and the x to be to the right (and
    down a little bit) and the y to be back into the screen (and right a little
    bit). I took a linear algebra class that covered how to do such
    transformations but my brother has the book right now. Can anybody help me?
    I simply need some matrix or something that I can multiply my [x, y, z] by
    to get my new [x, y] positions that would appear to be in 3d on the screen.
    This is just going to be for a demo that I need to do. Thanks.
    Miguel De Anda, Jun 27, 2003
    #1
    1. Advertising

  2. Miguel De Anda

    pete kirkham Guest

    Miguel De Anda wrote:

    > I'm trying to write a little script that draws dots into a 3d space. It is
    > very small and has only 30 dots (5 by 6). These dots are on fixed x, y
    > positions but I need to position them on various z positions. I want to make
    > the z axis to be vertical (on the screen) and the x to be to the right (and
    > down a little bit) and the y to be back into the screen (and right a little
    > bit). I took a linear algebra class that covered how to do such
    > transformations but my brother has the book right now. Can anybody help me?
    > I simply need some matrix or something that I can multiply my [x, y, z] by
    > to get my new [x, y] positions that would appear to be in 3d on the screen.
    > This is just going to be for a demo that I need to do. Thanks.
    >
    >


    From a quick google,
    http://pages.infinit.net/jstlouis/3dbhole/mathematics_of_3d_graphics.html#Transformations
    has some sample transformation matrices which will do.

    Take your 3d point, translate and rotate so the translated x and y axes
    align to your screen x and y (eg: rot X 90, rot Y ~10, rot X ~10 for Z
    up, X right and down a bit, translate by <[screen-width - mean
    X]/2,[screen-height - mean Y]/2, [distance-to-eye + lowest-z]> will give
    about what you describe) , then (optionally) divide by the transformed z
    value for perspective, not plottin all points whose z-values are greater
    than the distance from the eye to the screen.

    Pete
    pete kirkham, Jun 27, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wes
    Replies:
    0
    Views:
    454
  2. David Stratton

    .Net mapping Network Drives

    David Stratton, Jan 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    629
    Chris Taylor
    Jan 21, 2004
  3. Ken Morrow
    Replies:
    2
    Views:
    7,916
    Jerold Green
    Jul 26, 2003
  4. dev ranjan das

    mapping bidirectional busses

    dev ranjan das, Nov 6, 2003, in forum: VHDL
    Replies:
    2
    Views:
    635
    Renaud Pacalet
    Nov 6, 2003
  5. Sachin
    Replies:
    1
    Views:
    660
Loading...

Share This Page