Results 1 to 2 of 2

Thread: Spherical polar coordinates & OpenGL/C

  1. #1
    Huggable
    Join Date
    Jul 2004
    Location
    Manchester
    Posts
    688
    Thanks
    0
    Thanked
    0 times in 0 posts
    • Starburn's system
      • Motherboard:
      • Epox 9NPA+
      • CPU:
      • A64 4000+ (@ 12x210)
      • Memory:
      • 2x1gig Corsair XMS Pro (DDR400 @ 420)
      • Storage:
      • 2x80gig Raid0 & 1x200gig
      • Graphics card(s):
      • ATI Radeon X1800XT (above stock)
      • PSU:
      • Hiper Type-R Modular (580W)
      • Case:
      • Coolermaster Wave
      • Monitor(s):
      • 19" TFT & 50" TV (for games)
      • Internet:
      • Be 24mb

    Question Spherical polar coordinates & OpenGL/C

    I have two angles longitude which is the horizontal view angle (in the XZ plane) measured leftwards from the +Z direction & latitude which is the vertical view angle above or below the XZ plane and a coordinate XYZ which is the current eye point.

    I need to calculate a look point from this information so I can use it with gluLookAt.
    (then I can modify the angles, .. I'm making a 3d environment).

    I've forgotton enough of A-Level maths that I'm finding this impossible.. I have a small piece of paper with sin, cos and many lines scribbled onto it.. gah. Apparantly from the two angles and the point it is possible to calculate a point on the surface of a unit sphere (which would be, my look point)..

    Can anybody help?
    We cannot choose what we are.. but what are we but the sum of our choices?

  2. #2
    Huggable
    Join Date
    Jul 2004
    Location
    Manchester
    Posts
    688
    Thanks
    0
    Thanked
    0 times in 0 posts
    • Starburn's system
      • Motherboard:
      • Epox 9NPA+
      • CPU:
      • A64 4000+ (@ 12x210)
      • Memory:
      • 2x1gig Corsair XMS Pro (DDR400 @ 420)
      • Storage:
      • 2x80gig Raid0 & 1x200gig
      • Graphics card(s):
      • ATI Radeon X1800XT (above stock)
      • PSU:
      • Hiper Type-R Modular (580W)
      • Case:
      • Coolermaster Wave
      • Monitor(s):
      • 19" TFT & 50" TV (for games)
      • Internet:
      • Be 24mb
    Nvm, I figured it out in the end

    centerx = eyex + cos(lat * DEG_TO_RAD) * sin(lon * DEG_TO_RAD);
    centery = eyey + sin(lat * DEG_TO_RAD);
    centerz = eyez + cos(lat * DEG_TO_RAD) * cos(lon * DEG_TO_RAD);

    (* the constant as c expects the angles in radians).
    We cannot choose what we are.. but what are we but the sum of our choices?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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