Results 1 to 7 of 7

Thread: reading longitude and latitude on 3d Sphere as earth

  1. #1

    Thread Starter
    Addicted Member BlueRose's Avatar
    Join Date
    Jan 2002
    Location
    ISTANBUL
    Posts
    245

    Question reading longitude and latitude on 3d Sphere as earth

    I'm working on a 3d sphere as accepted Earth, when mouse pointer over sphere, want to show earth longitude and latitude
    in degrees, therefore must know how i can convert 3d object to 2d object

    need anybody help
    You can do while you think that you can do

    If you think my answer solve your question, please rate it.

  2. #2
    Addicted Member Cuallito's Avatar
    Join Date
    Apr 2001
    Location
    You know that chest that you could never get opened? If you ever do, I'm there.
    Posts
    136
    First you'd have to do a ray-sphere colision detect, then you'd have to translate cartesian to spherical coordinates then to longitude and latitude.

    Good luck.
    BTW, Thanks for all your help

    Member of the anti-gay cross-dressing trans-species wolves alliance.

  3. #3

    Thread Starter
    Addicted Member BlueRose's Avatar
    Join Date
    Jan 2002
    Location
    ISTANBUL
    Posts
    245

    Talking

    what do you mean about "ray-sphere colision detect", sorry about me, i'm not have enough knowledge about 3d graphics.

    i'm using flat cartesian and spherical coordinates for my app. I am drawing a sphere with longitude and latitude on screen, but I could not succeed in reading inverse coordinate, i thing my formulas which i used to calculate longtitude and latýtude is not corrcect, because result is not true.

    if you could explain in detail, you will be much more help me
    You can do while you think that you can do

    If you think my answer solve your question, please rate it.

  4. #4
    Addicted Member Cuallito's Avatar
    Join Date
    Apr 2001
    Location
    You know that chest that you could never get opened? If you ever do, I'm there.
    Posts
    136
    How are you drawing your globe? DX? or something else.?
    BTW, Thanks for all your help

    Member of the anti-gay cross-dressing trans-species wolves alliance.

  5. #5

    Thread Starter
    Addicted Member BlueRose's Avatar
    Join Date
    Jan 2002
    Location
    ISTANBUL
    Posts
    245
    My Globe program is as follow

    Public Sub Globe3D()
    For teta = 0 To 180 Step 10
    stepalfa = 1
    For alfa = 0 To 180 Step 10
    GlobePoint(stepteta, stepalfa).x = GlobeRadius_
    * HSin(teta) * HCos(alfa)
    GlobePoint(stepteta, stepalfa).y = GlobeRadius_
    * HSin(teta) * HSin(alfa)
    GlobePoint(stepteta, stepalfa).z = GlobeRadius * HCos(teta)
    stepalfa = stepalfa + 1
    Next alfa
    stepteta = stepteta + 1
    Next teta
    End Sub
    Public Sub Rotate(anglex,angley)
    For m = 1 To 19
    For p = 1 To 19
    GlobeRotated(m, p).y = GlobePoint(m, p).z * HSin(anglex)_
    + GlobePoint(m, p).y * HCos(anglex)
    GlobeRotated(m, p).z = GlobePoint(m, p).z * HCos(anglex_
    ) - GlobePoint(m, p).y * HSin(anglex)

    GlobeRotated(m, p).x = GlobeRotated(m, p).z * HSin(angley_
    ) + GlobePoint(m, p).x * HCos(angley)
    GlobeRotated(m, p).z = GlobeRotated(m, p).z * HCos(angley_
    ) - GlobePoint(m, p).x * HSin(angley)

    GlobeScreen(m, p).x = centerx + GlobeRotated(m, p).x
    GlobeScreen(m, p).y = centery + GlobeRotated(m, p).z
    Next p
    Next m
    End Sub


    and the image on the screen is attached to e-mail

    my globe is 3d globe and is rotated
    You can do while you think that you can do

    If you think my answer solve your question, please rate it.

  6. #6

    Thread Starter
    Addicted Member BlueRose's Avatar
    Join Date
    Jan 2002
    Location
    ISTANBUL
    Posts
    245
    On my project the important point is the MOUSE POINTER

    when mouse pointer is on the globe, i must calculate long & latitude coords where the mouse pointer is, this means my ray is mouse pointer and always is hitting the globe.

    because mouse pointer always is moving on screen so my aim is to calculate long & latitude from mouse screen coords, but i don't know where can i start.

    thanks riis for your valuable answer, is the (x,y) screen coords?
    You can do while you think that you can do

    If you think my answer solve your question, please rate it.

  7. #7
    Fanatic Member riis's Avatar
    Join Date
    Nov 2001
    Posts
    551
    in LatLong2XYZ x, y and z are spherical coordinates (in 3d space)

    in Arctan2 x and y are just two variables, which are not related to coordinates

Posting Permissions

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



Click Here to Expand Forum to Full Width