libs/base/src/base/axisangle.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <iostream> | ||
| 4 | |||
| 5 | #include "base/vec3.h" | ||
| 6 | #include "base/angle.h" | ||
| 7 | |||
| 8 | |||
| 9 | namespace eu | ||
| 10 | { | ||
| 11 | /** \addtogroup math | ||
| 12 | * @{ | ||
| 13 | */ | ||
| 14 | |||
| 15 | struct Q; | ||
| 16 | |||
| 17 | /// Axis + Angle | ||
| 18 | struct AA | ||
| 19 | { | ||
| 20 | /// a unit-vector | ||
| 21 | n3 axis; | ||
| 22 | |||
| 23 | /// rotation according to right-hand rule | ||
| 24 | An angle; | ||
| 25 | |||
| 26 | AA(const n3 &ax, const An &ang); | ||
| 27 | |||
| 28 | [[nodiscard]] static std::optional<AA> from(const Q& q); | ||
| 29 | }; | ||
| 30 | |||
| 31 | /// yaw + pitch + roll | ||
| 32 | struct Ypr | ||
| 33 | { | ||
| 34 | An yaw = no_rotation; | ||
| 35 | An pitch = no_rotation; | ||
| 36 | An roll = no_rotation; | ||
| 37 | }; | ||
| 38 | |||
| 39 | [[nodiscard]] AA | ||
| 40 | rha(const n3& axis, const An& angle); | ||
| 41 | |||
| 42 | std::string string_from(const AA &aa); | ||
| 43 | std::string string_from(const Ypr& ypr); | ||
| 44 | |||
| 45 | /** @}*/ | ||
| 46 | |||
| 47 | ADD_CATCH_FORMATTER_DEF(AA) | ||
| 48 | ADD_CATCH_FORMATTER_DEF(Ypr) | ||
| 49 | } | ||
| 50 | |||
| 51 | 4 | ADD_DEFAULT_FORMATTER(eu::AA, std::string, eu::string_from); | |
| 52 | 2 | ADD_DEFAULT_FORMATTER(eu::Ypr, std::string, eu::string_from); | |
| 53 |