Avogadro  1.1.0
/home/kitware/dashboards/avogadro/libavogadro/src/sphere_p.h
00001 /**********************************************************************
00002   Sphere - Class for drawing spheres in OpenGL
00003 
00004   Copyright (C) 2006,2007 Benoit Jacob
00005 
00006   This file is part of the Avogadro molecular editor project.
00007   For more information, see <http://avogadro.openmolecules.net/>
00008 
00009   Avogadro is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation; either version 2 of the License, or
00012   (at your option) any later version.
00013 
00014   Avogadro is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018 
00019   You should have received a copy of the GNU General Public License
00020   along with this program; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00022   02110-1301, USA.
00023  **********************************************************************/
00024 
00025 #ifndef SPHERE_H
00026 #define SPHERE_H
00027 
00028 #include <avogadro/global.h>
00029 
00030 #include <Eigen/Core>
00031 
00032 namespace Avogadro {
00033 
00046   class SpherePrivate;
00047   class Sphere
00048   {
00049     private:
00050       SpherePrivate * const d;
00051 
00052     protected:
00053 
00058       inline unsigned short indexOfVertex(
00059           int strip, int column, int row);
00064       void computeVertex( int strip, int column, int row );
00065 
00066       void freeBuffers();
00067       void initialize();
00068 
00069     public:
00070       Sphere( int detail = 0 );
00071       ~Sphere();
00072 
00077       void setup( int detail );
00078 
00081       void draw( const Eigen::Vector3d &center, double radius ) const;
00082   };
00083 
00084 }
00085 
00086 #endif