Control Surface
main
MIDI Control Surface library for Arduino
Toggle main menu visibility
Loading...
Searching...
No Matches
src
AH
Math
Quaternion.cpp
Go to the documentation of this file.
1
#include "
Quaternion.hpp
"
2
3
#include <
AH/PrintStream/PrintStream.hpp
>
4
#ifndef ARDUINO
5
#include <ostream>
// std::ostream, <<
6
#endif
7
8
BEGIN_AH_NAMESPACE
9
10
// LCOV_EXCL_START
11
12
#ifndef ARDUINO
13
14
std::ostream &
operator<<
(std::ostream &os,
Quaternion
q) {
15
return
os <<
"("
<< q.
w
<<
", "
<< q.
x
<<
", "
<< q.
y
<<
", "
<< q.
z
<<
")"
;
16
}
17
18
std::ostream &
operator<<
(std::ostream &os,
EulerAngles
e) {
19
os <<
"("
<<
rad2deg
(e.
yaw
) <<
"°, "
<<
rad2deg
(e.
pitch
) <<
"°, "
20
<<
rad2deg
(e.
roll
) <<
"°)"
;
21
return
os;
22
}
23
24
#endif
// ARDUINO
25
26
Print &
operator<<
(Print &os,
Quaternion
q) {
27
return
os <<
"("
<< q.
w
<<
", "
<< q.
x
<<
", "
<< q.
y
<<
", "
<< q.
z
<<
")"
;
28
}
29
30
Print &
operator<<
(Print &os,
EulerAngles
e) {
31
os <<
"("
<<
rad2deg
(e.
yaw
) <<
"°, "
<<
rad2deg
(e.
pitch
) <<
"°, "
32
<<
rad2deg
(e.
roll
) <<
"°)"
;
33
return
os;
34
}
35
36
// LCOV_EXCL_STOP
37
38
END_AH_NAMESPACE
END_AH_NAMESPACE
#define END_AH_NAMESPACE
Definition
AH/Settings/NamespaceSettings.hpp:14
BEGIN_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
Definition
AH/Settings/NamespaceSettings.hpp:11
PrintStream.hpp
Quaternion.hpp
Definition of Quaternion and EulerAngles.
AH::rad2deg
constexpr std::enable_if< std::is_floating_point< T >::value, T >::type rad2deg(T r)
Convert radians to degrees.
Definition
Degrees.hpp:24
AH::operator<<
Print & operator<<(Print &os, Quaternion q)
Definition
Quaternion.cpp:26
::EulerAngles
Struct for Euler angles of floating point numbers.
Definition
Quaternion.hpp:288
AH::EulerAngles::roll
float roll
X": drone X = world +Y.
Definition
Quaternion.hpp:291
AH::EulerAngles::pitch
float pitch
Y': drone Y = world -X.
Definition
Quaternion.hpp:290
AH::EulerAngles::yaw
float yaw
Z : drone Z = world +Z.
Definition
Quaternion.hpp:289
AH::EulerAngles::EulerAngles
EulerAngles()=default
Create Euler angles that are initialized to (0 0 0), or upright.
::Quaternion
Type for quaternions of floating point numbers.
Definition
Quaternion.hpp:57
AH::Quaternion::w
float w
Scalar (real) component.
Definition
Quaternion.hpp:58
AH::Quaternion::y
float y
Second vector (imaginary) component .
Definition
Quaternion.hpp:60
AH::Quaternion::Quaternion
Quaternion()=default
Create a quaternion that is initialized to the identity quaternion.
AH::Quaternion::x
float x
First vector (imaginary) component .
Definition
Quaternion.hpp:59
AH::Quaternion::z
float z
Third vector (imaginary) component .
Definition
Quaternion.hpp:61
Generated by
1.17.0