• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
Quaternion.h
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2004-2007 Torsten Rahn <tackat@kde.org>
9 // Copyright 2007 Inge Wallin <ingwa@kde.org>
10 // Copyright 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
11 // Copyright 2014 Dennis Nienhüser <earthwings@gentoo.org>
12 //
13 
14 //
15 // Quaternions provides a class that deals with quaternion operations.
16 
17 // krazy:excludeall=dpointer,inline
18 
19 #ifndef MARBLE_QUATERNION_H
20 #define MARBLE_QUATERNION_H
21 
22 #include "marble_export.h"
23 #include <cmath>
24 
25 namespace Marble
26 {
27 
28 enum
29 {
30  Q_X = 0,
31  Q_Y = 1,
32  Q_Z = 2,
33  Q_W = 3
34 };
35 
36 
37 typedef qreal xmmfloat[4];
38 typedef xmmfloat matrix[3];
39 
40 
41 class MARBLE_EXPORT Quaternion
42 {
43  public:
44  Quaternion();
45  Quaternion(qreal w, qreal x, qreal y, qreal z);
46 
52  static Quaternion fromSpherical(qreal lon, qreal lat);
53  static Quaternion fromEuler(qreal pitch, qreal yaw, qreal roll);
54 
55  static Quaternion slerp(const Quaternion &q1, const Quaternion &q2, qreal t);
56  static Quaternion nlerp(const Quaternion &q1, const Quaternion &q2, qreal t);
57 
58  // Operators
59  Quaternion operator*(const Quaternion &q) const;
60  Quaternion operator+(const Quaternion &q) const;
61  Quaternion operator*(qreal factor) const;
62  bool operator==(const Quaternion &q) const;
63  Quaternion& operator*=(const Quaternion &q);
64  Quaternion& operator*=(qreal);
65 
66  void getSpherical(qreal &lon, qreal &lat) const;
67 
68  void normalize();
69 
70  qreal length() const;
71 
72  Quaternion inverse() const;
73  Quaternion log() const;
74  Quaternion exp() const;
75 
76  qreal pitch() const;
77  qreal yaw() const;
78  qreal roll() const;
79 
80 
81  void rotateAroundAxis(const Quaternion &q);
82 
83  void toMatrix(matrix &m) const;
84  void rotateAroundAxis(const matrix &m);
85 
86  // TODO: Better add accessors...
87  xmmfloat v;
88 };
89 
90 }
91 
92 #ifndef QT_NO_DEBUG_STREAM
93 MARBLE_EXPORT QDebug operator<<(QDebug, const Marble::Quaternion &);
94 #endif
95 
96 #endif // MARBLE_QUATERNION_H
Marble::matrix
xmmfloat matrix[3]
Definition: Quaternion.h:38
Marble::xmmfloat
qreal xmmfloat[4]
Definition: Quaternion.h:37
operator<<
MARBLE_EXPORT QDebug operator<<(QDebug, const Marble::Quaternion &)
Definition: Quaternion.cpp:141
Marble::Q_W
Definition: Quaternion.h:33
Marble::operator==
bool operator==(const DownloadPolicyKey &lhs, const DownloadPolicyKey &rhs)
Definition: DownloadPolicy.h:49
operator+
Vec3 operator+(const Vec3 &c1, const Vec3 &c2)
Definition: attlib.cpp:116
normalize
void normalize(const QString &output)
Definition: tools/speaker-files/main.cpp:135
MARBLE_EXPORT
#define MARBLE_EXPORT
Definition: marble_export.h:20
Marble::Q_Z
Definition: Quaternion.h:32
Marble::Q_Y
Definition: Quaternion.h:31
Marble::Q_X
Definition: Quaternion.h:30
QDebug
marble_export.h
operator*
Vec3 operator*(double r, const Vec3 &c1)
Definition: attlib.cpp:133
Marble::Quaternion
Definition: Quaternion.h:41
Marble::Quaternion::v
xmmfloat v
Definition: Quaternion.h:87
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal