# gcu::Sphere Class Reference

`#include <gcu/sphere.h>`

List of all members.

## Public Member Functions

void | setup (int detail)
void | draw (OpenBabel::vector3 const &center, double radius) const

## Protected Member Functions

unsigned short | indexOfVertex (int strip, int column, int row)
void | computeVertex (int strip, int column, int row)

## Detailed Description

This class represents and draws a sphere. The level of detail can be controlled. At level 0, the sphere is a octahedron. At levels >=1, the sphere is a "geosphere", that is, one starts with an icosahedron, which is the regular solid with 20 triangular faces, and one then sub-tesselates each face into smaller triangles. This is a classical tesselation, known to give a very good quality/complexity ratio.

Author:
  Benoit Jacob <jacob@math.jussieu.fr>

Definition at line 49 of file sphere.h.

## Member Function Documentation

unsigned short gcu::Sphere::indexOfVertex | ( | int | strip,
|  | int | column,
|  | int | row |
| ) |  |  | `[inline, protected]`

computes the index (position inside the index buffer) of a vertex given by its position (strip, column, row) inside a certain flat model of the sub-tesselated icosahedron

void gcu::Sphere::computeVertex | ( | int | strip,
|  | int | column,
|  | int | row |
| ) |  |  | `[protected]`

computes the coordinates of a vertex given by its position (strip, column, row) inside a certain flat model of the sub-tesselated icosahedron

void gcu::Sphere::setup | ( | int | detail | ) |

initializes the sphere with given level of detail. If the sphere was already initialized, any pre-allocated buffers are freed and then re-allocated.

Parameters:

  | detail | the wanted level of detail. See m_detail member

void gcu::Sphere::draw | ( | OpenBabel::vector3 const & | center,
|  | double | radius |
| ) |  |  | const

draws the sphere at specified position and with specified radius

The documentation for this class was generated from the following file:

- sphere.h