OpenStructure
build-dev-doc
stage
include
ost
geom
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-2020 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_GEOM_TRANSFORM_HH
20
#define OST_GEOM_TRANSFORM_HH
21
22
/*
23
Author: Ansgar Philippsen
24
*/
25
26
#include <
ost/config.hh
>
27
28
#include "
module_config.hh
"
29
#include "
vec3.hh
"
30
#include "
vec4.hh
"
31
#include "
mat3.hh
"
32
#include "
mat.hh
"
33
#include "
aligned_cuboid.hh
"
34
35
namespace
geom
{
36
39
class
DLLEXPORT_OST_GEOM
Transform
{
40
public
:
41
Transform
();
42
44
void
Reset
() {*
this
=
Transform
();}
45
47
Mat4
GetMatrix
()
const
{
return
tm_;}
49
Mat4
GetTransposedMatrix
()
const
{
return
ttm_;}
51
Mat4
GetInvertedMatrix
()
const
{
return
itm_;}
52
54
void
SetCenter
(
const
Vec3
& c);
56
Vec3
GetCenter
()
const
;
57
58
// directly set tm, messing up rot/trans/cen !
59
void
SetMatrix
(
const
Mat4
& m);
60
62
63
void
ApplyXAxisRotation(
float
delta);
65
void
ApplyYAxisRotation
(
float
delta);
66
void
ApplyZAxisRotation
(
float
delta);
67
void
ApplyAxisRotation
(
float
delta,
const
Vec3
& axis);
68
69
Mat3
GetXAxisRotation
(
float
delta);
70
Mat3
GetYAxisRotation
(
float
delta);
71
Mat3
GetZAxisRotation
(
float
delta);
72
73
Mat3
GetRot
()
const
;
74
void
SetRot
(
const
Mat3
& r);
76
78
void
ApplyXAxisTranslation
(
float
delta);
79
void
ApplyYAxisTranslation
(
float
delta);
80
void
ApplyZAxisTranslation
(
float
delta);
81
void
SetTrans
(
const
Vec3
& t);
82
Vec3
GetTrans
()
const
;
84
85
// apply to a vec3 and return result
86
Vec3
Apply
(
const
Vec3
& v)
const
;
87
// apply to a vec4 and return result
88
Vec4
Apply
(
const
Vec4
& v)
const
;
89
// apply inverse to a vec3 and return result
90
Vec3
ApplyInverse
(
const
Vec3
& v)
const
;
91
// apply inverse to a vec4 and return result
92
Vec4
ApplyInverse
(
const
Vec4
& v)
const
;
93
// apply to an aligned cuboid and return result
94
AlignedCuboid
Apply
(
const
AlignedCuboid
& c)
const
;
95
Transform
Apply
(
const
Transform
& tf)
const
;
96
97
private
:
98
Mat3
rot_;
99
Vec3
trans_;
100
Vec3
cen_;
101
Mat4
tm_;
102
Mat4
ttm_;
103
Mat4
itm_;
104
105
void
update_tm();
106
void
update_components();
107
};
108
109
}
// ns
110
111
#endif
aligned_cuboid.hh
config.hh
geom::AlignedCuboid
axis-aligned cuboid
Definition:
aligned_cuboid.hh:35
geom::Mat3
Definition:
mat3.hh:39
geom::Mat4
Definition:
mat4.hh:43
geom::Transform
basic and essential transformation class, including translation, rotation and center of rotation
Definition:
transform.hh:39
geom::Transform::ApplyYAxisRotation
void ApplyYAxisRotation(float delta)
geom::Transform::SetMatrix
void SetMatrix(const Mat4 &m)
geom::Transform::ApplyInverse
Vec3 ApplyInverse(const Vec3 &v) const
geom::Transform::Apply
Vec3 Apply(const Vec3 &v) const
geom::Transform::Reset
void Reset()
reset to identity
Definition:
transform.hh:44
geom::Transform::GetCenter
Vec3 GetCenter() const
retrieve center of rotation
geom::Transform::GetTrans
Vec3 GetTrans() const
geom::Transform::ApplyYAxisTranslation
void ApplyYAxisTranslation(float delta)
geom::Transform::SetRot
void SetRot(const Mat3 &r)
geom::Transform::SetTrans
void SetTrans(const Vec3 &t)
geom::Transform::ApplyZAxisRotation
void ApplyZAxisRotation(float delta)
geom::Transform::ApplyXAxisTranslation
void ApplyXAxisTranslation(float delta)
translation
geom::Transform::GetTransposedMatrix
Mat4 GetTransposedMatrix() const
retrieve transposed transformation matrix
Definition:
transform.hh:49
geom::Transform::Apply
AlignedCuboid Apply(const AlignedCuboid &c) const
geom::Transform::GetMatrix
Mat4 GetMatrix() const
retrieve transformation matrix
Definition:
transform.hh:47
geom::Transform::GetZAxisRotation
Mat3 GetZAxisRotation(float delta)
geom::Transform::Transform
Transform()
geom::Transform::GetXAxisRotation
Mat3 GetXAxisRotation(float delta)
geom::Transform::Apply
Vec4 Apply(const Vec4 &v) const
geom::Transform::SetCenter
void SetCenter(const Vec3 &c)
set center of rotation
geom::Transform::GetYAxisRotation
Mat3 GetYAxisRotation(float delta)
geom::Transform::Apply
Transform Apply(const Transform &tf) const
geom::Transform::ApplyZAxisTranslation
void ApplyZAxisTranslation(float delta)
geom::Transform::GetRot
Mat3 GetRot() const
geom::Transform::ApplyAxisRotation
void ApplyAxisRotation(float delta, const Vec3 &axis)
geom::Transform::ApplyInverse
Vec4 ApplyInverse(const Vec4 &v) const
geom::Transform::GetInvertedMatrix
Mat4 GetInvertedMatrix() const
retrieve inverted transformation matrix
Definition:
transform.hh:51
geom::Vec3
Three dimensional vector class, using Real precision.
Definition:
vec3.hh:48
geom::Vec4
Definition:
vec4.hh:46
DLLEXPORT_OST_GEOM
#define DLLEXPORT_OST_GEOM
Definition:
module_config.hh:27
mat3.hh
mat.hh
geom
Definition:
aligned_cuboid.hh:29
ost::mol::Transform
geom::Transform Transform
Definition:
transform.hh:5
module_config.hh
vec3.hh
vec4.hh
Generated by
1.9.1