1 /********************************************************************** 2 transform3d.h - Handle 3D transformations in space groups. 3 4 Copyright (C) 2007 by Jean Bréfort 5 6 This file is part of the Open Babel project. 7 For more information, see <http://openbabel.org/> 8 9 This program is free software; you can redistribute it and/or 10 modify it under the terms of the GNU General Public License as 11 published by the Free Software Foundation; either version 2 of the 12 License, or (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 ***********************************************************************/ 19 20 #ifndef OB_TRANSFORM_3D_H 21 #define OB_TRANSFORM_3D_H 22 23 #include <openbabel/math/matrix3x3.h> 24 #include <list> 25 #include <string> 26 27 namespace OpenBabel 28 { 29 30 /** \class transform3d transform3d.h <openbabel/math/transform3d.h> 31 \brief Handle 3D transformations, such as space group definitions 32 \since version 2.2 33 \sa SpaceGroup 34 */ 35 class OBAPI transform3d: private matrix3x3, private vector3 36 { 37 public: transform3d(void)38 transform3d(void): matrix3x3(), vector3() 39 { 40 } 41 transform3d(const matrix3x3 & m,const vector3 & v)42 transform3d(const matrix3x3 &m, const vector3 &v): matrix3x3(m), vector3(v) 43 { 44 Normalize(); 45 } 46 transform3d(double s)47 transform3d(double s): matrix3x3(s), vector3() 48 { 49 } 50 51 //! Constructs a matrix from row vectors transform3d(vector3 row1,vector3 row2,vector3 row3,vector3 translation)52 transform3d(vector3 row1,vector3 row2,vector3 row3,vector3 translation): 53 matrix3x3(row1, row2, row3), vector3(translation) 54 { 55 Normalize(); 56 } 57 58 //! \brief Constructs a matrix from a 3x3-array of doubles 59 /*! The first index represents the row, the second index the column */ transform3d(double d[3][3],double t[3])60 transform3d(double d[3][3], double t[3]): matrix3x3(d), vector3(t) 61 { 62 Normalize(); 63 } 64 65 vector3 operator *(const vector3 &) const; 66 67 transform3d operator *(const transform3d &) const; 68 69 std::string DescribeAsString() const; 70 std::string DescribeAsValues() const; 71 72 void Normalize(); 73 }; 74 75 typedef std::list<transform3d*>::const_iterator transform3dIterator; 76 77 } 78 79 #endif // OB_TRANSFORM_3D_H 80 81 //! \file transform3d.h 82 //! \brief Handle 3D transformations in space groups. 83