37namespace coordinateRotations
75 scalar angle1(angles.
x());
76 scalar angle2(angles.
y());
77 scalar angle3(angles.
z());
86 const scalar c1(
cos(angle1));
const scalar s1(
sin(angle1));
87 const scalar c2(
cos(angle2));
const scalar s2(
sin(angle2));
88 const scalar c3(
cos(angle3));
const scalar s3(
sin(angle3));
100 ( c2 ), ( -c3*s2 ), ( s2*s3 ),
101 ( c1*s2 ), ( c1*c2*c3 - s1*s3 ), ( -c3*s1 - c1*c2*s3 ),
102 ( s1*s2 ), ( c1*s3 + c2*c3*s1 ), ( c1*c3 - c2*s1*s3 )
107 case eulerOrder::XYX:
111 ( c2 ), ( s2*s3 ), ( c3*s2 ),
112 ( s1*s2 ), ( c1*c3 - c2*s1*s3 ), ( -c1*s3 - c2*c3*s1 ),
113 ( -c1*s2 ), ( c3*s1 + c1*c2*s3 ), ( c1*c2*c3 - s1*s3 )
118 case eulerOrder::YXY:
122 ( c1*c3 - c2*s1*s3 ), ( s1*s2 ), ( c1*s3 + c2*c3*s1 ),
123 ( s2*s3 ), ( c2 ), ( -c3*s2 ),
124 ( -c3*s1 -c1*c2*s3 ), ( c1*s2 ), ( c1*c2*c3 - s1*s3 )
129 case eulerOrder::YZY:
133 ( c1*c2*c3 - s1*s3 ), ( -c1*s2 ), ( c3*s1 + c1*c2*s3 ),
134 ( c3*s2 ), ( c2 ), ( s2*s3 ),
135 (-c1*s3 - c2*c3*s1 ), ( s1*s2 ), ( c1*c3 - c2*s1*s3 )
140 case eulerOrder::ZYZ:
144 ( c1*c2*c3 - s1*s3 ), ( -c3*s1 - c1*c2*s3 ), ( c1*s2 ),
145 ( c1*s3 + c2*c3*s1 ), ( c1*c3 - c2*s1*s3 ), ( s1*s2 ),
146 ( -c3*s2 ), ( s2*s3 ), ( c2 )
151 case eulerOrder::ZXZ:
155 ( c1*c3 - c2*s1*s3 ), ( -c1*s3 - c2*c3*s1 ), ( s1*s2 ),
156 ( c3*s1 + c1*c2*s3 ), ( c1*c2*c3 - s1*s3 ), ( -c1*s2 ),
157 ( s2*s3 ), ( c3*s2 ), ( c2 )
165 case eulerOrder::XZY:
169 ( c2*c3 ), ( -s2 ), ( c2*s3 ),
170 ( s1*s3 + c1*c3*s2 ), ( c1*c2 ), ( c1*s2*s3 - c3*s1 ),
171 ( c3*s1*s2 - c1*s3 ), ( c2*s1 ), ( c1*c3 + s1*s2*s3 )
176 case eulerOrder::XYZ:
180 ( c2*c3 ), ( -c2*s3 ), ( s2 ),
181 ( c1*s3 + c3*s1*s2 ), ( c1*c3 - s1*s2*s3 ), ( -c2*s1 ),
182 ( s1*s3 - c1*c3*s2 ), ( c3*s1 + c1*s2*s3 ), ( c1*c2 )
187 case eulerOrder::YXZ:
191 ( c1*c3 + s1*s2*s3 ), ( c3*s1*s2 - c1*s3 ), ( c2*s1 ),
192 ( c2*s3 ), ( c2*c3 ), ( -s2 ),
193 ( c1*s2*s3 - c3*s1 ), ( c1*c3*s2 + s1*s3 ), ( c1*c2 )
198 case eulerOrder::YZX:
202 ( c1*c2 ), ( s1*s3 - c1*c3*s2 ), ( c3*s1 + c1*s2*s3 ),
203 ( s2 ), ( c2*c3 ), ( -c2*s3 ),
204 ( -c2*s1 ), ( c1*s3 + c3*s1*s2 ), ( c1*c3 - s1*s2*s3 )
209 case eulerOrder::ZYX:
213 ( c1*c2 ), ( c1*s2*s3 - c3*s1 ), ( s1*s3 + c1*c3*s2 ),
214 ( c2*s1 ), ( c1*c3 + s1*s2*s3 ), ( c3*s1*s2 - c1*s3 ),
215 ( -s2 ), ( c2*s3 ), ( c2*c3 )
220 case eulerOrder::ZXY:
224 ( c1*c3 - s1*s2*s3 ), ( -c2*s1 ), ( c1*s3 + c3*s1*s2 ),
225 ( c3*s1 + c1*s2*s3 ), ( c1*c2 ), ( s1*s3 - c1*c3*s2 ),
226 ( -c2*s3 ), ( s2 ), ( c2*c3 )
233 <<
"Unknown euler rotation order "
247 return rotation(eulerOrder::ZXZ, angles, degrees);
265 angles_(crot.angles_),
266 degrees_(crot.degrees_),
293 angles_(angle1, angle2, angle3),
303 degrees_(
dict.getOrDefault(
"degrees", true)),
333 os <<
"euler-angles(" << (degrees_ ?
"deg" :
"rad") <<
"): " << angles_;
343 os.beginBlock(keyword);
345 os.writeEntry(
"type",
type());
346 os.writeEntry(
"angles", angles_);
349 os.writeEntry(
"degrees",
"false");
353 if (order_ != eulerOrder::ZXZ)
Macros for easy insertion into run-time selection tables.
#define addAliasToRunTimeSelectionTable(baseType, thisType, argNames, lookup, other, ver)
Add lookup alias for runTime selection.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static const SphericalTensor I
const Cmpt & z() const
Access to the vector z component.
const Cmpt & y() const
Access to the vector y component.
const Cmpt & x() const
Access to the vector x component.
User specification of a coordinate rotation.
A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
virtual tensor R() const
The rotation tensor calculated for the specified Euler angles.
euler()
Default construct - an identity transform.
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
virtual void clear()
Reset specification.
virtual const coordinateRotation & rotation() const
The rotation specification.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool write()
Write the output fields.
Quaternion class used to perform rotations in 3D space.
static const Enum< eulerOrder > eulerOrderNames
eulerOrder
Euler-angle rotation order.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
dimensionedScalar sin(const dimensionedScalar &ds)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
dimensionedScalar cos(const dimensionedScalar &ds)
Unit conversion functions.