The Gnome Chemistry Utils  0.14.0
sphere.h
Go to the documentation of this file.
1 /**********************************************************************
2  Sphere - Class for drawing spheres in OpenGL
3 
4  Copyright (C) 2007-2009 Jean Brefort <jean.brefort@normalesup.org>
5  Copyright (C) 2006,2007 Benoit Jacob <jacob@math.jussieu.fr>
6 
7  This file is part of the Avogadro molecular editor project.
8  For more information, see <http://avogadro.sourceforge.net/>
9 
10  Avogadro is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 3 of the License, or
13  (at your option) any later version.
14 
15  Avogadro is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23  02110-1301, USA.
24  **********************************************************************/
25 
26 #ifndef GCU_SPHERE_H
27 #define GCU_SPHERE_H
28 
30 namespace gcu {
31 
43 class Vector;
44 class SpherePrivate;
45 
46 class Sphere
47 {
48 private:
49  SpherePrivate * const d;
50 
51 protected:
52 
57  inline unsigned short indexOfVertex (int strip, int column, int row);
58 
63  void computeVertex (int strip, int column, int row);
64 
65  void freeBuffers ();
66  void initialize ();
67 
68 public:
69  Sphere (int detail = 0);
70  ~Sphere ();
71 
76  void setup (int detail);
77 
80  void draw (Vector const &center, double radius) const;
81 };
82 
83 }
84 
85 #endif // GCU_SPHERE_H