crystalline.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * crystalline.h 
00006  *
00007  * Copyright (C) 2002-2008 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 namespace gcu
00032 {
00033 
00042 enum CrystalLineType
00043 {
00044         edges = 0,
00045         diagonals,
00046         medians,
00047         normal,
00048         unique
00049 };
00050 
00054 class CrystalLine
00055 {
00056 public:
00060         CrystalLine ();
00064         virtual ~CrystalLine ();
00065 
00066 public :
00083         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);
00089         CrystalLine (CrystalLine& clLine);
00096         CrystalLine& operator= (CrystalLine& clLine);
00097 
00101         double X1 (void) {return m_dx;}
00105         double Y1 (void) {return m_dy;}
00109         double Z1 (void) {return m_dz;}
00113         double X2 (void) {return m_dx2;}
00117         double Y2 (void) {return m_dy2;}
00121         double Z2 (void) {return m_dz2;}
00125         double Xmax ();
00129         double Ymax ();
00133         double Zmax ();
00137         double Xmin ();
00141         double Ymin ();
00145         double Zmin ();
00149         double Long () {return m_dl;}
00153         CrystalLineType Type () {return m_nType;}
00164         void SetPosition (double x, double y, double z, double x1, double y1, double z1);
00173         void SetColor (float red, float green, float blue, float alpha);
00182         void GetColor (double *red, double *green, double *blue, double *alpha);
00188         void SetRadius (double r);
00192         double GetRadius () {return m_dr;};
00197         bool operator== (CrystalLine& clLine);
00205         virtual void Move (double x, double y, double z);
00216         double ScalProd (int h, int k, int l);
00221         void Cleave () {m_nCleave++;}
00234         void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma);
00247         double Distance (double x, double y, double z, bool bFixed);
00251         bool IsCleaved () {return m_nCleave != 0;}
00261         void GetRotation (double& x, double& y, double& z, double& th);
00268         virtual xmlNodePtr Save (xmlDocPtr xml) const;
00274         virtual bool Load (xmlNodePtr node);
00275         
00276 protected :
00280         float m_fBlue;
00284         float m_fRed;
00288         float m_fGreen;
00292         float m_fAlpha;
00296         double m_dx;
00300         double m_dy;
00304         double m_dz;
00308         double m_dx2;
00312         double m_dy2;
00316         double m_dz2;
00320         double m_dr;
00326         int m_nCleave; //0 if not cleaved
00335         CrystalLineType m_nType;
00336 
00337 private:
00338         double m_dl;
00339         double m_dxrot;
00340         double m_dyrot;
00341         double m_darot;//rotation axis coordinates (z = 0) and angle
00342 };
00343 
00347 typedef std::list<CrystalLine*> CrystalLineList;
00348 
00349 extern char const *LineTypeName[];
00350 
00351 }// namespace gcu
00352 
00353 #endif // CRYSTAL_BOND_H

Generated on Sun Jun 22 13:26:05 2008 for The Gnome Chemistry Utils by  doxygen 1.5.6