Thread: Math..

Results 1 to 10 of 10
  1. #1
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow

    Math..

    Yo.

    I need some help with some world to screen calculations. If possible, using the least amount of API possible, having a couple wouldn't be a big deal but it'd be preferable if there was none.

    So.. if any of you mathematicians want to help me out here..

    Thanks.

    Note: All though I program a lot, I'm not that great in math...
    Last edited by Void; 06-21-2010 at 02:54 AM.

  2. #2
    Shark23's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Kansas
    Posts
    424
    Reputation
    10
    Thanks
    55
    My Mood
    Cool
    I can probably help. What do you need?
    Assembly Programmer

  3. #3
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Quote Originally Posted by Shark23 View Post
    I can probably help. What do you need?
    World to screen calculation/formula..

  4. The Following User Says Thank You to Void For This Useful Post:

    therofl (11-02-2010)

  5. #4
    Shark23's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Kansas
    Posts
    424
    Reputation
    10
    Thanks
    55
    My Mood
    Cool
    I haven't done any world to screen before. Sorry. What does it involve though?
    Assembly Programmer

  6. #5
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Quote Originally Posted by Shark23 View Post
    I haven't done any world to screen before. Sorry. What does it involve though?
    Converting 3D world coordinates to 2D screen coordinates.

  7. The Following User Says Thank You to Void For This Useful Post:

    therofl (11-02-2010)

  8. #6
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by Void View Post
    Converting 3D world coordinates to 2D screen coordinates.
    So it's similar to converting 3D vectors into cartesian 2D (x/y axis)?

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  9. #7
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Quote Originally Posted by J-Deezy View Post
    So it's similar to converting 3D vectors into cartesian 2D (x/y axis)?
    It's exactly that.

  10. The Following User Says Thank You to Void For This Useful Post:

    therofl (11-02-2010)

  11. #8
    Shark23's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Kansas
    Posts
    424
    Reputation
    10
    Thanks
    55
    My Mood
    Cool
    Nevermind then.
    Assembly Programmer

  12. #9
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    A much simpler solution than the perspective projection suggested in the
    comment below, and arguably a more attractive one, is the orthographic
    projection. I shall give you the formulas to convert (x, y, z) coordinates
    into (x, y) coordinates after rotation about the axes.

    Suppose that we rotate the cube by Rx degrees about the x axis, by Ry
    degrees about the y axis, and by Rz degrees about the z axis.

    First, apply the x-axis rotation to transform coordinates (x, y, z)
    into coordinates (x0, y0, z0).

    x0 = x

    y0 = y*cos(Rx) + z*sin(Rx)

    z0 = z*cos(Rx) - y*sin(Rx)

    Then apply the y-axis rotation to (x0, y0, z0) to obtain (x1, y1, z1).

    x1 = x0*cos(Ry) - z0*sin(Ry)

    y1 = y0

    z1 = z0*cos(Ry) + x0*sin(Ry)

    Finally, apply the z-axis rotation to obtain the point (x2, y2).

    x2 = x1*cos(Rz) + y1*sin(Rz)

    y2 = y1*cos(Rz) - x1*sin(Rz)

    Hey presto, you can now plot (x2, y2) in two dimensions.

    Regards,

    leapinglizard
    Found this around the web..

    Original: Google Answers: conversion of XYZ coordinates to XY

    not sure if is that what you are looking for. Not that good with maths either. (Googled..)
    Light travels faster than sound. That's why most people seem bright until you hear them speak.

  13. The Following User Says Thank You to 'Bruno For This Useful Post:

    Void (06-21-2010)

  14. #10
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    It just so happens that's what we've been doing in maths this year (I'm failing it but we'll overlook that /)

    Hmmm, well the only annoying thing is the (z) axis, but that's not too big of a deal if you can find angles and use sine/cosine to get lengths and shizniz. Sorry I can't help you right now it's 12:45AM and my brain just won't function properly, I'll look at it again tomorrow after I've thought about it some more, don't worry I won't forget. If I can be bothered I might be able to find a way to create a VB.NET program that receives x,y,z world co-ords and outputs x,y screen co-ords. I'll probably need to ask you a few questions about world co-ords first though (haven't ever done anything with them), but I'll save that for tomorrow.

    Sorry again that I can't help you right this second :S

    EDIT: Pwnt by Brinuz

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

Similar Threads

  1. I just ownd my math test =P
    By radnomguywfq3 in forum General
    Replies: 29
    Last Post: 11-01-2007, 11:56 AM
  2. Math Test
    By radnomguywfq3 in forum Flaming & Rage
    Replies: 2
    Last Post: 10-31-2007, 02:07 PM
  3. Hardest Math problem in the world
    By iverson954360 in forum General
    Replies: 10
    Last Post: 08-13-2007, 12:35 AM
  4. What you know about math?
    By arunforce in forum General
    Replies: 2
    Last Post: 04-07-2007, 07:47 AM
  5. This is what math class does to you
    By apitite.for.distruction in forum Art & Graphic Design
    Replies: 14
    Last Post: 10-28-2006, 11:44 AM