knowL: Knowledge Libraries
Loading...
Searching...
No Matches
Quaternion.h
1#pragma once
2
3#include <QtGlobal>
4
5#include <knowCore/ReturnValue.h>
6
7namespace knowGIS
8{
10 {
11 public:
12 Quaternion() : Quaternion(identity()) {}
13 Quaternion(qreal _x, qreal _y, qreal _z, qreal _w) : m_x(_x), m_y(_y), m_z(_z), m_w(_w) {}
14 static Quaternion identity() { return Quaternion(0.0, 0.0, 0.0, 1.0); }
15 ~Quaternion() {}
16 qreal x() const { return m_x; }
17 qreal y() const { return m_y; }
18 qreal z() const { return m_z; }
19 qreal w() const { return m_w; }
20 bool operator==(const Quaternion& _rhs) const { return m_x == _rhs.m_x and m_y == _rhs.m_y and m_z == _rhs.m_z and m_w == _rhs.m_w; }
21 QByteArray md5() const;
22 QJsonValue toJsonValue() const;
23 static knowCore::ReturnValue<Quaternion> fromJsonValue(const QJsonValue& _value);
24 QCborValue toCborValue() const;
25 static knowCore::ReturnValue<Quaternion> fromCborValue(const QCborValue& _value);
26 private:
27 qreal m_x, m_y, m_z, m_w;
28 };
29}
30
31#include <knowCore/Formatter.h>
32KNOWCORE_CORE_DECLARE_FORMATTER(knowGIS::Quaternion)
33{
34 return format_to(ctx.out(), "(x={} y={} z={} w={})", p.x(), p.y(), p.z(), p.w());
35}
36
37#include <knowCore/MetaType.h>
38KNOWCORE_DECLARE_FULL_METATYPE(knowGIS, Quaternion)
Definition ReturnValue.h:29
Definition Quaternion.h:10