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

marble

  • sources
  • kde-4.12
  • 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 //
12 
13 //
14 // Quaternions provides a class that deals with quaternion operations.
15 
16 // krazy:excludeall=dpointer,inline
17 
18 #ifndef MARBLE_QUATERNION_H
19 #define MARBLE_QUATERNION_H
20 
21 #include "marble_export.h"
22 #include <cmath>
23 
24 namespace Marble
25 {
26 
27 using std::cos;
28 using std::sin;
29 
30 enum
31 {
32  Q_X = 0,
33  Q_Y = 1,
34  Q_Z = 2,
35  Q_W = 3
36 };
37 
38 
39 typedef qreal xmmfloat[4];
40 typedef xmmfloat matrix[3];
41 
42 
43 class MARBLE_EXPORT Quaternion
44 {
45  public:
46  Quaternion();
47  Quaternion(qreal w, qreal x, qreal y, qreal z);
48 
54  static Quaternion fromSpherical(qreal lon, qreal lat);
55  static Quaternion fromEuler(qreal pitch, qreal yaw, qreal roll);
56 
57  static Quaternion slerp(const Quaternion &q1, const Quaternion &q2, qreal t);
58  static Quaternion nlerp(const Quaternion &q1, const Quaternion &q2, qreal t);
59 
60  // Operators
61  Quaternion operator*(const Quaternion &q) const;
62  Quaternion operator*(qreal factor) const;
63  bool operator==(const Quaternion &q) const;
64  Quaternion& operator*=(const Quaternion &q);
65  Quaternion& operator*=(qreal);
66 
67  void getSpherical(qreal &lon, qreal &lat) const;
68 
69  void normalize();
70 
71  qreal length() const;
72 
73  Quaternion inverse() const;
74 
75  qreal pitch() const;
76  qreal yaw() const;
77  qreal roll() const;
78 
79 
80  void rotateAroundAxis(const Quaternion &q);
81 
82  void toMatrix(matrix &m) const;
83  void rotateAroundAxis(const matrix &m);
84 
85  // TODO: Better add accessors...
86  xmmfloat v;
87 };
88 
89 }
90 
91 #ifndef QT_NO_DEBUG_STREAM
92 MARBLE_EXPORT QDebug operator<<(QDebug, const Marble::Quaternion &);
93 #endif
94 
95 #endif // MARBLE_QUATERNION_H
Marble::matrix
xmmfloat matrix[3]
Definition: Quaternion.h:40
Marble::xmmfloat
qreal xmmfloat[4]
Definition: Quaternion.h:39
operator<<
MARBLE_EXPORT QDebug operator<<(QDebug, const Marble::Quaternion &)
Definition: Quaternion.cpp:125
Marble::Q_W
Definition: Quaternion.h:35
Marble::operator==
bool operator==(const DownloadPolicyKey &lhs, const DownloadPolicyKey &rhs)
Definition: DownloadPolicy.h:49
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:34
Marble::Q_Y
Definition: Quaternion.h:33
Marble::Q_X
Definition: Quaternion.h:32
marble_export.h
operator*
Vec3 operator*(double r, const Vec3 &c1)
Definition: attlib.cpp:134
Marble::Quaternion
Definition: Quaternion.h:43
Marble::Quaternion::v
xmmfloat v
Definition: Quaternion.h:86
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:52 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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