Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Quaternion.cpp
Go to the documentation of this file.
1#include "Quaternion.hpp"
2
4#ifndef ARDUINO
5#include <ostream> // std::ostream, <<
6#endif
7
9
10// LCOV_EXCL_START
11
12#ifndef ARDUINO
13
14std::ostream &operator<<(std::ostream &os, Quaternion q) {
15 return os << "(" << q.w << ", " << q.x << ", " << q.y << ", " << q.z << ")";
16}
17
18std::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
26Print &operator<<(Print &os, Quaternion q) {
27 return os << "(" << q.w << ", " << q.x << ", " << q.y << ", " << q.z << ")";
28}
29
30Print &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
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
Print & operator<<(Print &os, Cable c)
Definition Cable.cpp:6
Definition of Quaternion and EulerAngles.
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
constexpr std::enable_if< std::is_floating_point< T >::value, T >::type rad2deg(T r)
Convert radians to degrees.
Definition Degrees.hpp:24
Struct for Euler angles of floating point numbers.
Type for quaternions of floating point numbers.