37 namespace coordinateRotations
70 const eulerOrder order,
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)
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
User specification of a coordinate rotation.
virtual tensor R() const
The rotation tensor calculated for the specified Euler angles.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Unit conversion functions.
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
virtual void clear()
Reset specification.
static const Enum< eulerOrder > eulerOrderNames
The names for Euler-angle and Tait-Bryan angles, including "rollPitchYaw" and "yawPitchRoll" aliases...
Macros for easy insertion into run-time selection tables.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
dimensionedScalar cos(const dimensionedScalar &ds)
A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
A class for handling words, derived from Foam::string.
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
Quaternion class used to perform rotations in 3D space.
addAliasToRunTimeSelectionTable(coordinateRotation, axes, dictionary, axes, axesRotation, 1806)
errorManip< error > abort(error &err)
eulerOrder
Euler-angle rotation order.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
dimensionedScalar sin(const dimensionedScalar &ds)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
static const SphericalTensor I
static tensor rotation(const vector &angles, bool degrees=false)
Rotation tensor calculated for the intrinsic Euler angles in z-x-z order.
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
euler()
Default construct - an identity transform.
addNamedToRunTimeSelectionTable(coordinateRotation, axes, dictionary, axes)
Tensor of scalars, i.e. Tensor<scalar>.
virtual void write(Ostream &os) const
Write information.
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
static constexpr const zero Zero
Global zero (0)