Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: sphere

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2003
    Location
    Leszno, Wielkopolska, Poland
    Posts
    16

    sphere

    Hello everyone,

    I've got a question. I want to make my own functions to drawing primitives - I want to have access to particular points. Does anybody know formula to create sphere? I searched many pages but result is none...

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,074

    Re: sphere

    Take some aequi-surfaced polyhedron (is that the english word?) (there was this 12 sided thingy, that is well triangulizable?) and subdivide it until some expected face-size is achieved and then project the vertices to a perfect sphere. This will yield into a sphere without much distortion and without poles.
    - Michael Steinberg

  3. #3
    Advanced Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    739

    Re: sphere

    Another approach is to specify the sphere vertices in spherical coordinates.

    For any azimuth in [0,2 PI], any elevation in [-PI/2,PI/2], and a sphere radius of R

    x = R * cos(azimuth) * cos(elevation)
    y = R * sin(azimuth) * cos(elevation)
    z = R * sin(elevation)

    where the z axis goes through the poles.

    You could specify an angular grid and iterate over the angles to build triangle strips, for example. Depending on the grid, this would give you so many slices and stacks in your sphere.

  4. #4
    Junior Member Newbie
    Join Date
    Oct 2003
    Location
    Leszno, Wielkopolska, Poland
    Posts
    16

    Re: sphere

    Thanks for advices. The second method seems quite natural. I didn't 'discover' polyhedrons yet

    Greets,
    Ray

Posting Permissions

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