00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2010 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_MOL_BASE_TRANSFORM_HH 00020 #define OST_MOL_BASE_TRANSFORM_HH 00021 00022 /* 00023 Author: Ansgar Philippsen 00024 */ 00025 00026 #include <ost/geom/geom.hh> 00027 #include <ost/info/info_fw.hh> 00028 #include <ost/mol/module_config.hh> 00029 00030 namespace ost { namespace mol { 00031 00034 class DLLEXPORT_OST_MOL Transform { 00035 public: 00036 Transform(); 00037 00038 geom::Mat4 GetMatrix() const; 00039 geom::Mat4 GetTransposedMatrix() const; 00040 00041 void SetCenter(const geom::Vec3& c); 00042 geom::Vec3 GetCenter() const; 00043 00044 00045 00047 00048 00049 void ApplyXAxisRotation(float delta); 00050 void ApplyYAxisRotation(float delta); 00051 void ApplyZAxisRotation(float delta); 00052 void ApplyAxisRotation(float delta, const geom::Vec3& axis); 00053 00054 geom::Mat3 GetXAxisRotation(float delta); 00055 geom::Mat3 GetYAxisRotation(float delta); 00056 geom::Mat3 GetZAxisRotation(float delta); 00057 00058 geom::Mat3 GetRot() const; 00059 void SetRot(const geom::Mat3& r); 00061 00062 00063 void ApplyXAxisTranslation(float delta); 00064 void ApplyYAxisTranslation(float delta); 00065 void ApplyZAxisTranslation(float delta); 00066 void SetTrans(const geom::Vec3& t); 00067 geom::Vec3 GetTrans() const; 00069 00070 geom::Vec3 Apply(const geom::Vec3& v) const; 00071 geom::Vec4 Apply(const geom::Vec4& v) const; 00072 00073 private: 00074 geom::Mat3 rot_; 00075 geom::Vec3 trans_; 00076 geom::Vec3 cen_; 00077 geom::Mat4 tm_; 00078 geom::Mat4 ttm_; 00079 00080 void update_tm(); 00081 }; 00082 00085 Transform DLLEXPORT_OST_MOL TransformFromInfo(const info::InfoGroup& group); 00088 void DLLEXPORT_OST_MOL TransformToInfo(const Transform& transform, 00089 info::InfoGroup& group); 00090 }} // ns 00091 00092 #endif
1.5.8