OpenStructure
transform.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_MOL_BASE_TRANSFORM_HH
20 #define OST_MOL_BASE_TRANSFORM_HH
21 
22 /*
23  Author: Ansgar Philippsen
24 */
25 
26 #include <ost/geom/geom.hh>
27 #include <ost/info/info_fw.hh>
28 #include <ost/mol/module_config.hh>
29 
30 namespace ost { namespace mol {
31 
35 public:
36  Transform();
37 
38  geom::Mat4 GetMatrix() const;
39  geom::Mat4 GetTransposedMatrix() const;
40 
41  void SetCenter(const geom::Vec3& c);
42  geom::Vec3 GetCenter() const;
43 
44 
45 
47 
48 
49  void ApplyXAxisRotation(float delta);
50  void ApplyYAxisRotation(float delta);
51  void ApplyZAxisRotation(float delta);
52  void ApplyAxisRotation(float delta, const geom::Vec3& axis);
53 
54  geom::Mat3 GetXAxisRotation(float delta);
55  geom::Mat3 GetYAxisRotation(float delta);
56  geom::Mat3 GetZAxisRotation(float delta);
57 
58  geom::Mat3 GetRot() const;
59  void SetRot(const geom::Mat3& r);
61 
62 
63  void ApplyXAxisTranslation(float delta);
64  void ApplyYAxisTranslation(float delta);
65  void ApplyZAxisTranslation(float delta);
66  void SetTrans(const geom::Vec3& t);
67  geom::Vec3 GetTrans() const;
69 
70  geom::Vec3 Apply(const geom::Vec3& v) const;
71  geom::Vec4 Apply(const geom::Vec4& v) const;
72 
73 private:
74  geom::Mat3 rot_;
75  geom::Vec3 trans_;
76  geom::Vec3 cen_;
77  geom::Mat4 tm_;
78  geom::Mat4 ttm_;
79 
80  void update_tm();
81 };
82 
85 Transform DLLEXPORT_OST_MOL TransformFromInfo(const info::InfoGroup& group);
88 void DLLEXPORT_OST_MOL TransformToInfo(const Transform& transform,
89  info::InfoGroup& group);
90 }} // ns
91 
92 #endif