The Gnome Chemistry Utils: crystalline.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# crystalline.h

    00001 // -*- C++ -*-
    00002
    00003 /*
    00004  * Gnome Chemistry Utils
    00005  * crystalline.h
    00006  *
    00007  * Copyright (C) 2002-2004 Jean Bréfort <jean.brefort@normalesup.org>
    00008  *
    00009  * This program is free software; you can redistribute it and/or
    00010  * modify it under the terms of the GNU General Public License as
    00011  * published by the Free Software Foundation; either version 2 of the
    00012  * License, or (at your option) any later version.
    00013  *
    00014  * This program 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 St, Fifth Floor, Boston, MA  02110-1301
    00022  * USA
    00023  */
    00024
    00025 #ifndef CRYSTAL_LINE_H
    00026 #define CRYSTAL_LINE_H
    00027
    00028 #include <libxml/parser.h>
    00029 #include <list>
    00030
    00031 using namespace std;
    00032
    00033 namespace gcu
    00034 {
    00035
    00044 enum CrystalLineType
    00045 {
    00046         edges = 0,
    00047         diagonals,
    00048         medians,
    00049         normal,
    00050         unique
    00051 };
    00052
    00056 class CrystalLine
    00057 {
    00058 public:
    00062         CrystalLine ();
    00066         virtual ~CrystalLine ();
    00067
    00068 public :
    00085         CrystalLine (CrystalLineType Type, double X1, double Y1, double Z1, double X2, double Y2, double Z2, double r, float red, float green, float blue, float alpha);
    00091         CrystalLine (CrystalLine& clLine);
    00098         CrystalLine& operator= (CrystalLine& clLine);
    00099
    00103         void Draw ();
    00107         double X1 (void) {return m_dx;}
    00111         double Y1 (void) {return m_dy;}
    00115         double Z1 (void) {return m_dz;}
    00119         double X2 (void) {return m_dx2;}
    00123         double Y2 (void) {return m_dy2;}
    00127         double Z2 (void) {return m_dz2;}
    00131         double Xmax ();
    00135         double Ymax ();
    00139         double Zmax ();
    00143         double Xmin ();
    00147         double Ymin ();
    00151         double Zmin ();
    00155         double Long () {return m_dl;}
    00159         CrystalLineType Type () {return m_nType;}
    00170         void SetPosition (double x, double y, double z, double x1, double y1, double z1);
    00179         void SetColor (float red, float green, float blue, float alpha);
    00188         void GetColor (double *red, double *green, double *blue, double *alpha);
    00194         void SetRadius (double r);
    00198         double GetRadius () {return m_dr;};
    00203         bool operator== (CrystalLine& clLine);
    00211         virtual void Move (double x, double y, double z);
    00222         double ScalProd (int h, int k, int l);
    00227         void Cleave () {m_nCleave++;}
    00240         void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma);
    00253         double Distance (double x, double y, double z, bool bFixed);
    00257         bool IsCleaved () {return m_nCleave != 0;}
    00267         void GetRotation (double& x, double& y, double& z, double& th);
    00274         virtual xmlNodePtr Save (xmlDocPtr xml);
    00280         virtual bool Load (xmlNodePtr node);
    00281
    00282 protected :
    00286         float m_fBlue;
    00290         float m_fRed;
    00294         float m_fGreen;
    00298         float m_fAlpha;
    00302         double m_dx;
    00306         double m_dy;
    00310         double m_dz;
    00314         double m_dx2;
    00318         double m_dy2;
    00322         double m_dz2;
    00326         double m_dr;
    00332         int m_nCleave; //0 if not cleaved
    00341         CrystalLineType m_nType;
    00342
    00343 private:
    00344         double m_dl;
    00345         double m_dxrot;
    00346         double m_dyrot;
    00347         double m_darot;//rotation axis coordinates (z = 0) and angle
    00348 };
    00349
    00353 typedef list<CrystalLine*> CrystalLineList;
    00354
    00355 }// namespace gcu
    00356
    00357 #endif // CRYSTAL_BOND_H