• 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
  • astro
attlib.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 2013 Gerhard Holtkamp
9 //
10 
11 #if !defined(__attlib_h)
12 #define __attlib_h
13 
14 /***********************************************************************
15  3-Dim Vector and Matrix Definitions and Operations
16 
17  License: GNU LGPL Version 2+
18 
19  Author: Gerhard HOLTKAMP 14-JAN-2012
20  ***********************************************************************/
21 
22 #include <iostream>
23 #include "astrolib_export.h"
24 
25 ASTROLIB_EXPORT double atan20 (double y, double x);
26 
27 class ASTROLIB_EXPORT Vec3
28 {
29  private:
30  double v[3];
31 
32  public:
33 
34  friend class Mat3;
35 
36  Vec3(double x=0, double y=0, double z=0);
37  Vec3 (const Vec3& c);
38  void assign (double x=0, double y=0, double z=0);
39  double& operator [] (unsigned index);
40  Vec3& operator = (const Vec3& c);
41  Vec3& operator += (const Vec3& c);
42  Vec3& operator -= (const Vec3& c);
43  Vec3& operator *= (const Vec3& c); // cross product
44  Vec3& operator *= (double r);
45  Vec3& operator /= (double r);
46  friend double abs(const Vec3& c); // absolute value
47  friend double dot (const Vec3& c1, const Vec3& c2); // dot product
48  friend Vec3 operator + (const Vec3& c1, const Vec3& c2);
49  friend Vec3 operator - (const Vec3& c1, const Vec3& c2);
50  friend Vec3 operator * (double r, const Vec3& c1);
51  friend Vec3 operator * (const Vec3& c1, double r);
52  friend Vec3 operator * (const Vec3& c1, const Vec3& c2); // cross product
53  friend Vec3 operator / (const Vec3& c1, double r);
54  friend Vec3 vnorm(const Vec3& c); // norm vector
55  friend Vec3 carpol (const Vec3& c); // Cartesian -> Polar
56  friend Vec3 polcar (const Vec3& c); // Polar -> Cartesian
57  friend std::ostream& operator << (std::ostream& os, const Vec3& c);
58 };
59 
60 /********************************************************************/
61 
62 // class Mat3: public Vec3
63 class ASTROLIB_EXPORT Mat3
64 {
65  public:
66  double m[3][3];
67 
68  Mat3(double x=0);
69  Mat3 (const Mat3& c);
70  void assign (double x11, double x12, double x13, double x21, double x22,
71  double x23, double x31, double x32, double x33);
72  void assign (double x[3][3]); // assign matrix
73  void PutMij (double x, int i, int j); // put single matrix element
74  double GetMij (int i, int j) const; // get single matrix element
75  Mat3& operator = (const Mat3& c);
76  Mat3& operator += (const Mat3& c);
77  Mat3& operator -= (const Mat3& c);
78  Mat3& operator *= (const Mat3& c);
79  Mat3& operator *= (double r);
80  Mat3& operator /= (double r);
81  friend Mat3 mxtrn (const Mat3& m1); // transposed matrix
82  friend double mxdet (const Mat3& c); // determinant
83  friend Mat3 operator + (const Mat3& c1, const Mat3& c2);
84  friend Mat3 operator - (const Mat3& c1, const Mat3& c2);
85  friend Mat3 operator * (double r, const Mat3& c1);
86  friend Mat3 operator * (const Mat3& c1, double r);
87  friend Mat3 operator * (const Mat3& c1, const Mat3& c2);
88  friend Mat3 operator / (const Mat3& c1, double r);
89  friend Vec3 mxvct (const Mat3& m1, Vec3& v1); // multiply vector with matrix
90  friend void gpyr (const Mat3& m1, double& p, double& y, double& r); // get p/y/r
91  friend void mxevc (const Mat3& m, double& a, Vec3& v); // eigenvector
92  friend std::ostream& operator << (std::ostream& os, const Mat3& c);
93 };
94 
95 // ****************************************************************************
96 // defining the following functions here seems to make more compilers happy
97  Mat3 mxcon (double r); // constant matrix
98  Mat3 mxidn (); // identity matrix
99  // friend Mat3 mxtrn (const Mat3& m1); // transposed matrix
100  Mat3 xrot (double a); // rotation around x-axis
101  Mat3 yrot (double a); // rotation around y-axis
102  Mat3 zrot (double a); // rotation around z-axis
103 
104  Mat3 csmx (double p, double y, double r); // pitch/yaw/roll matrix
105  void vcpy (Vec3& v, double& p, double& y); // get pitch and yaw from vector
106  void vcrp (Vec3& v, double& p, double& r); // get pitch and roll from vector
107  Mat3 mxrox (double& a, Vec3& v); // get matrix from eigenvector and angle
108 
109 #endif // __attlib_h sentry.
110 
zrot
Mat3 zrot(double a)
Definition: attlib.cpp:530
Mat3
Definition: attlib.h:63
mxidn
Mat3 mxidn()
Definition: attlib.cpp:368
Vec3
Definition: attlib.h:27
vcpy
void vcpy(Vec3 &v, double &p, double &y)
Definition: attlib.cpp:578
Mat3::operator-=
Mat3 & operator-=(const Mat3 &c)
Definition: attlib.cpp:306
operator/
Vec3 operator/(const Vec3 &c1, double r)
Definition: attlib.cpp:159
ASTROLIB_EXPORT
#define ASTROLIB_EXPORT
Definition: astrolib_export.h:20
operator-
Vec3 operator-(const Vec3 &c1, const Vec3 &c2)
Definition: attlib.cpp:124
Mat3::operator+=
Mat3 & operator+=(const Mat3 &c)
Definition: attlib.cpp:297
gpyr
void gpyr(const Mat3 &m1, double &p, double &y, double &r)
Definition: attlib.cpp:568
carpol
Vec3 carpol(const Vec3 &c)
Definition: attlib.cpp:184
vnorm
Vec3 vnorm(const Vec3 &c)
Definition: attlib.cpp:170
operator+
Vec3 operator+(const Vec3 &c1, const Vec3 &c2)
Definition: attlib.cpp:116
Mat3::assign
void assign(double x11, double x12, double x13, double x21, double x22, double x23, double x31, double x32, double x33)
Definition: attlib.cpp:249
yrot
Mat3 yrot(double a)
Definition: attlib.cpp:509
Mat3::operator=
Mat3 & operator=(const Mat3 &c)
Definition: attlib.cpp:287
abs
double abs(const Vec3 &c)
Definition: attlib.cpp:100
Mat3::operator*=
Mat3 & operator*=(const Mat3 &c)
Definition: attlib.cpp:315
vcrp
void vcrp(Vec3 &v, double &p, double &r)
Definition: attlib.cpp:587
mxevc
void mxevc(const Mat3 &m, double &a, Vec3 &v)
Definition: attlib.cpp:596
mxdet
double mxdet(const Mat3 &c)
Definition: attlib.cpp:390
mxtrn
Mat3 mxtrn(const Mat3 &m1)
Definition: attlib.cpp:379
operator<<
ostream & operator<<(ostream &os, const Vec3 &c)
Definition: attlib.cpp:225
astrolib_export.h
mxrox
Mat3 mxrox(double &a, Vec3 &v)
Definition: attlib.cpp:631
mxcon
Mat3 mxcon(double r)
Definition: attlib.cpp:357
operator*
Vec3 operator*(double r, const Vec3 &c1)
Definition: attlib.cpp:133
Mat3::operator/=
Mat3 & operator/=(double r)
Definition: attlib.cpp:344
xrot
Mat3 xrot(double a)
Definition: attlib.cpp:488
atan20
ASTROLIB_EXPORT double atan20(double y, double x)
Definition: attlib.cpp:25
dot
double dot(const Vec3 &c1, const Vec3 &c2)
Definition: attlib.cpp:108
polcar
Vec3 polcar(const Vec3 &c)
Definition: attlib.cpp:207
mxvct
Vec3 mxvct(const Mat3 &m1, Vec3 &v1)
Definition: attlib.cpp:473
csmx
Mat3 csmx(double p, double y, double r)
Definition: attlib.cpp:551
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:38 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