EulerCoordinateRotation.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2017-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::coordinateRotations::euler
29
30Description
31 A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
32
33 The 3 rotations are defined in the Euler intrinsic convention
34 (around Z, around X' and around Z'').
35 The order of the parameter arguments matches this rotation order.
36
37 For reference and illustration, see
38 https://en.wikipedia.org/wiki/Euler_angles
39
40 \verbatim
41 rotation
42 {
43 type euler;
44 angles (0 0 180);
45 }
46 \endverbatim
47
48 \heading Dictionary entries
49 \table
50 Property | Description | Reqd | Default
51 type | Type name: euler | yes |
52 angles | Rotation angles (usually z-x-z order) | yes |
53 degrees | Angles are in degrees | no | true
54 order | Rotation order | no | zxz
55 \endtable
56
57Note
58 The rotation order is usually z-x-z, but can also be something like
59 "rollPitchYaw" etc.
60 Also accepts "EulerRotation" (OpenFOAM-v1806) for the type.
61
62SourceFiles
63 EulerCoordinateRotation.C
64
65\*---------------------------------------------------------------------------*/
66
67#ifndef Foam_coordinateRotations_euler_H
68#define Foam_coordinateRotations_euler_H
69
70#include "coordinateRotation.H"
71#include "quaternion.H"
72
73// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74
75namespace Foam
76{
77namespace coordinateRotations
78{
79
80/*---------------------------------------------------------------------------*\
81 Class coordinateRotations::euler Declaration
82\*---------------------------------------------------------------------------*/
83
84class euler
85:
86 public coordinateRotation
87{
88public:
89
90 // Public Types
91
92 //- Euler-angle rotation order
94
95
96private:
97
98 // Private Data
99
100 //- The rotation angles
101 vector angles_;
102
103 //- Angles measured in degrees
104 bool degrees_;
105
106 //- The Euler-angle rotation order (default: zxz)
107 eulerOrder order_;
109
110public:
111
112 //- Runtime type information
113 TypeNameNoDebug("euler");
114
115
116 // Constructors
118 //- Default construct - an identity transform
119 euler();
120
121 //- Copy construct
122 euler(const euler& crot);
123
124 //- Construct from Euler intrinsic rotation angles (z-x-z)
125 euler(const vector& angles, bool degrees);
126
127 //- Construct from Euler intrinsic rotation angles (z-x-z)
128 euler(scalar angle1, scalar angle2, scalar angle3, bool degrees);
129
130 //- Construct from dictionary
131 explicit euler(const dictionary& dict);
132
133 //- Return clone
135 {
136 return
139 }
140
141
142 //- Destructor
143 virtual ~euler() = default;
144
145
146 // Static Member Functions
147
148 //- Rotation tensor calculated for the intrinsic Euler
149 //- angles in z-x-z order
150 static tensor rotation(const vector& angles, bool degrees=false);
151
152 //- Rotation tensor calculated for given order and angles
153 static tensor rotation
154 (
155 const eulerOrder order,
156 const vector& angles,
157 bool degrees=false
158 );
159
160
161 // Member Functions
162
163 //- Reset specification
164 virtual void clear();
165
166 //- The rotation tensor calculated for the specified Euler angles.
167 virtual tensor R() const;
168
169 //- Write information
170 virtual void write(Ostream& os) const;
171
172 //- Write dictionary entry
173 virtual void writeEntry(const word& keyword, Ostream& os) const;
174};
175
176
177// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178
179} // End namespace coordinateRotations
180
181//- Compatibility typedef 1806
183
184} // End namespace Foam
185
186// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187
188#endif
189
190// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
User specification of a coordinate rotation.
A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
TypeNameNoDebug("euler")
Runtime type information.
static tensor rotation(const vector &angles, bool degrees=false)
virtual tensor R() const
The rotation tensor calculated for the specified Euler angles.
euler()
Default construct - an identity transform.
quaternion::eulerOrder eulerOrder
Euler-angle rotation order.
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
virtual ~euler()=default
Destructor.
virtual void clear()
Reset specification.
autoPtr< coordinateRotation > clone() const
Return clone.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
eulerOrder
Euler-angle rotation order.
Definition: quaternion.H:104
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
coordinateRotations::euler EulerCoordinateRotation
Compatibility typedef 1806.
runTime write()
dictionary dict
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition: typeInfo.H:68