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         double X1 (void) {return m_dx;}
00107         double Y1 (void) {return m_dy;}
00111         double Z1 (void) {return m_dz;}
00115         double X2 (void) {return m_dx2;}
00119         double Y2 (void) {return m_dy2;}
00123         double Z2 (void) {return m_dz2;}
00127         double Xmax ();
00131         double Ymax ();
00135         double Zmax ();
00139         double Xmin ();
00143         double Ymin ();
00147         double Zmin ();
00151         double Long () {return m_dl;}
00155         CrystalLineType Type () {return m_nType;}
00166         void SetPosition (double x, double y, double z, double x1, double y1, double z1);
00175         void SetColor (float red, float green, float blue, float alpha);
00184         void GetColor (double *red, double *green, double *blue, double *alpha);
00190         void SetRadius (double r);
00194         double GetRadius () {return m_dr;};
00199         bool operator== (CrystalLine& clLine);
00207         virtual void Move (double x, double y, double z);
00218         double ScalProd (int h, int k, int l);
00223         void Cleave () {m_nCleave++;}
00236         void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma);
00249         double Distance (double x, double y, double z, bool bFixed);
00253         bool IsCleaved () {return m_nCleave != 0;}
00263         void GetRotation (double& x, double& y, double& z, double& th);
00270         virtual xmlNodePtr Save (xmlDocPtr xml);
00276         virtual bool Load (xmlNodePtr node);
00277         
00278 protected :
00282         float m_fBlue;
00286         float m_fRed;
00290         float m_fGreen;
00294         float m_fAlpha;
00298         double m_dx;
00302         double m_dy;
00306         double m_dz;
00310         double m_dx2;
00314         double m_dy2;
00318         double m_dz2;
00322         double m_dr;
00328         int m_nCleave; //0 if not cleaved
00337         CrystalLineType m_nType;
00338 
00339 private:
00340         double m_dl;
00341         double m_dxrot;
00342         double m_dyrot;
00343         double m_darot;//rotation axis coordinates (z = 0) and angle
00344 };
00345 
00349 typedef list<CrystalLine*> CrystalLineList;
00350 
00351 extern char const *LineTypeName[];
00352 
00353 }// namespace gcu
00354 
00355 #endif // CRYSTAL_BOND_H

Generated on Sun Sep 16 14:21:55 2007 for The Gnome Chemistry Utils by  doxygen 1.5.3