Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
primitives
septernion
septernionI.H
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
11
OpenFOAM is free software: you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
\*---------------------------------------------------------------------------*/
25
26
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
27
28
inline
Foam::septernion::septernion
()
29
{}
30
31
inline
Foam::septernion::septernion
(
const
vector
& t,
const
quaternion
& r)
32
:
33
t_(t),
34
r_(r)
35
{}
36
37
inline
Foam::septernion::septernion
(
const
vector
& t)
38
:
39
t_(t),
40
r_(
quaternion
::
I
)
41
{}
42
43
inline
Foam::septernion::septernion
(
const
quaternion
& r)
44
:
45
t_(
vector
::
zero
),
46
r_(r)
47
{}
48
49
50
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
51
52
inline
const
Foam::vector
&
Foam::septernion::t
()
const
53
{
54
return
t_;
55
}
56
57
58
inline
const
Foam::quaternion
&
Foam::septernion::r
()
const
59
{
60
return
r_;
61
}
62
63
64
inline
Foam::vector
&
Foam::septernion::t
()
65
{
66
return
t_;
67
}
68
69
70
inline
Foam::quaternion
&
Foam::septernion::r
()
71
{
72
return
r_;
73
}
74
75
76
inline
Foam::vector
Foam::septernion::transform
(
const
vector
& v)
const
77
{
78
return
t() + r().
transform
(v);
79
}
80
81
82
inline
Foam::vector
Foam::septernion::invTransform
(
const
vector
& v)
const
83
{
84
return
r().invTransform(v - t());
85
}
86
87
88
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
89
90
inline
void
Foam::septernion::operator=
(
const
septernion
&
tr
)
91
{
92
t_ = tr.t_;
93
r_ = tr.r_;
94
}
95
96
inline
void
Foam::septernion::operator*=
(
const
septernion
&
tr
)
97
{
98
t_ += r().transform(tr.
t
());
99
r_ *= tr.
r
();
100
}
101
102
103
inline
void
Foam::septernion::operator=
(
const
vector
& t)
104
{
105
t_ = t;
106
}
107
108
inline
void
Foam::septernion::operator+=
(
const
vector
& t)
109
{
110
t_ += t;
111
}
112
113
inline
void
Foam::septernion::operator-=
(
const
vector
& t)
114
{
115
t_ -= t;
116
}
117
118
119
inline
void
Foam::septernion::operator=
(
const
quaternion
& r)
120
{
121
r_ = r;
122
}
123
124
inline
void
Foam::septernion::operator*=
(
const
quaternion
& r)
125
{
126
r_ *= r;
127
}
128
129
inline
void
Foam::septernion::operator/=
(
const
quaternion
& r)
130
{
131
r_ /= r;
132
}
133
134
135
inline
void
Foam::septernion::operator*=
(
const
scalar s)
136
{
137
t_ *= s;
138
r_ *= s;
139
}
140
141
inline
void
Foam::septernion::operator/=
(
const
scalar s)
142
{
143
t_ /= s;
144
r_ /= s;
145
}
146
147
148
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
149
150
inline
Foam::septernion
Foam::inv
(
const
septernion
&
tr
)
151
{
152
return
septernion
(-tr.
r
().
invTransform
(tr.
t
()),
conjugate
(tr.
r
()));
153
}
154
155
156
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
157
158
inline
bool
Foam::operator==
(
const
septernion
& tr1,
const
septernion
& tr2)
159
{
160
return
(tr1.
t
() == tr2.
t
() && tr1.
r
() == tr2.
r
());
161
}
162
163
164
inline
bool
Foam::operator!=
(
const
septernion
& tr1,
const
septernion
& tr2)
165
{
166
return
!
operator==
(tr1, tr2);
167
}
168
169
170
inline
Foam::septernion
Foam::operator+
171
(
172
const
septernion&
tr
,
173
const
vector
& t
174
)
175
{
176
return
septernion(
tr
.t() + t,
tr
.r());
177
}
178
179
180
inline
Foam::septernion
Foam::operator+
181
(
182
const
vector
& t,
183
const
septernion&
tr
184
)
185
{
186
return
septernion(t +
tr
.t(),
tr
.r());
187
}
188
189
190
inline
Foam::septernion
Foam::operator-
191
(
192
const
septernion&
tr
,
193
const
vector
& t
194
)
195
{
196
return
septernion(tr.t() - t, tr.r());
197
}
198
199
200
inline
Foam::septernion
Foam::operator*
201
(
202
const
quaternion
& r,
203
const
septernion
&
tr
204
)
205
{
206
return
septernion
(tr.t(), r*tr.r());
207
}
208
209
210
inline
Foam::septernion
Foam::operator*
211
(
212
const
septernion
&
tr
,
213
const
quaternion
& r
214
)
215
{
216
return
septernion
(tr.
t
(), tr.
r
()*r);
217
}
218
219
220
inline
Foam::septernion
Foam::operator/
221
(
222
const
septernion
&
tr
,
223
const
quaternion
& r
224
)
225
{
226
return
septernion
(tr.
t
(), tr.
r
()/r);
227
}
228
229
230
inline
Foam::septernion
Foam::operator*
231
(
232
const
septernion
& tr1,
233
const
septernion
& tr2
234
)
235
{
236
return
septernion
237
(
238
tr1.
t
() + tr1.
r
().
transform
(tr2.t()),
239
tr1.
r
().
transform
(tr2.r())
240
);
241
}
242
243
244
inline
Foam::septernion
Foam::operator/
245
(
246
const
septernion
& tr1,
247
const
septernion
& tr2
248
)
249
{
250
return
tr1*
inv
(tr2);
251
}
252
253
254
inline
Foam::septernion
Foam::operator*
(
const
scalar s,
const
septernion
& tr)
255
{
256
return
septernion
(s*tr.
t
(), s*tr.
r
());
257
}
258
259
260
inline
Foam::septernion
Foam::operator*
(
const
septernion
& tr,
const
scalar s)
261
{
262
return
septernion
(s*tr.
t
(), s*tr.
r
());
263
}
264
265
266
inline
Foam::septernion
Foam::operator/
(
const
septernion
& tr,
const
scalar s)
267
{
268
return
septernion
(tr.
t
()/s, tr.
r
()/s);
269
}
270
271
272
// ************************ vim: set sw=4 sts=4 et: ************************ //