• 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
  • plugins
  • render
  • satellites
  • mex
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 2012 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 
24 double atan20 (double y, double x);
25 
26 class Vec3
27 {
28  private:
29  double v[3];
30 
31  public:
32 
33  friend class Mat3;
34 
35  explicit Vec3(double x=0, double y=0, double z=0);
36  Vec3 (const Vec3& c);
37  void assign (double x=0, double y=0, double z=0);
38  double& operator [] (unsigned index);
39  Vec3& operator = (const Vec3& c);
40  Vec3& operator += (const Vec3& c);
41  Vec3& operator -= (const Vec3& c);
42  Vec3& operator *= (const Vec3& c); // cross product
43  Vec3& operator *= (double r);
44  Vec3& operator /= (double r);
45  friend double abs(const Vec3& c); // absolute value
46  friend double dot (const Vec3& c1, const Vec3& c2); // dot product
47  friend Vec3 operator + (const Vec3& c1, const Vec3& c2);
48  friend Vec3 operator - (const Vec3& c1, const Vec3& c2);
49  friend Vec3 operator * (double r, const Vec3& c1);
50  friend Vec3 operator * (const Vec3& c1, double r);
51  friend Vec3 operator * (const Vec3& c1, const Vec3& c2); // cross product
52  friend Vec3 operator / (const Vec3& c1, double r);
53  friend Vec3 vnorm(const Vec3& c); // norm vector
54  friend Vec3 carpol (const Vec3& c); // Cartesian -> Polar
55  friend Vec3 polcar (const Vec3& c); // Polar -> Cartesian
56  friend std::ostream& operator << (std::ostream& os, const Vec3& c);
57 };
58 
59 /********************************************************************/
60 
61 // class Mat3: public Vec3
62 class Mat3
63 {
64  public:
65  double m[3][3];
66 
67  explicit Mat3(double x=0);
68  Mat3 (const Mat3& c);
69  void assign (double x11, double x12, double x13, double x21, double x22,
70  double x23, double x31, double x32, double x33);
71  void assign (double x[3][3]); // assign matrix
72  void PutMij (double x, int i, int j); // put single matrix element
73  double GetMij (int i, int j); // get single matrix element
74  Mat3& operator = (const Mat3& c);
75  Mat3& operator += (const Mat3& c);
76  Mat3& operator -= (const Mat3& c);
77  Mat3& operator *= (const Mat3& c);
78  Mat3& operator *= (double r);
79  Mat3& operator /= (double r);
80  friend Mat3 mxtrn (const Mat3& m1); // transposed matrix
81  friend double mxdet (const Mat3& c); // determinant
82  friend Mat3 operator + (const Mat3& c1, const Mat3& c2);
83  friend Mat3 operator - (const Mat3& c1, const Mat3& c2);
84  friend Mat3 operator * (double r, const Mat3& c1);
85  friend Mat3 operator * (const Mat3& c1, double r);
86  friend Mat3 operator * (const Mat3& c1, const Mat3& c2);
87  friend Mat3 operator / (const Mat3& c1, double r);
88  friend Vec3 mxvct (const Mat3& m1, Vec3& v1); // multiply vector with matrix
89  friend void gpyr (const Mat3& m1, double& p, double& y, double& r); // get p/y/r
90  friend void mxevc (const Mat3& m, double& a, Vec3& v); // eigenvector
91  friend std::ostream& operator << (std::ostream& os, const Mat3& c);
92 };
93 
94 // ****************************************************************************
95 // defining the following functions here seems to make more compilers happy
96  Mat3 mxcon (double r); // constant matrix
97  Mat3 mxidn (); // identity matrix
98  // friend Mat3 mxtrn (const Mat3& m1); // transposed matrix
99  Mat3 xrot (double a); // rotation around x-axis
100  Mat3 yrot (double a); // rotation around y-axis
101  Mat3 zrot (double a); // rotation around z-axis
102 
103  Mat3 csmx (double p, double y, double r); // pitch/yaw/roll matrix
104  void vcpy (Vec3& v, double& p, double& y); // get pitch and yaw from vector
105  void vcrp (Vec3& v, double& p, double& r); // get pitch and roll from vector
106  Mat3 mxrox (double& a, Vec3& v); // get matrix from eigenvector and angle
107 
108 #endif // __attlib_h sentry.
109 
Mat3::GetMij
double GetMij(int i, int j)
Definition: attlib.cpp:278
zrot
Mat3 zrot(double a)
Definition: attlib.cpp:531
Vec3::operator[]
double & operator[](unsigned index)
Definition: attlib.cpp:52
Mat3
Definition: attlib.h:62
mxidn
Mat3 mxidn()
Definition: attlib.cpp:369
Vec3::operator+
friend Vec3 operator+(const Vec3 &c1, const Vec3 &c2)
Definition: attlib.cpp:117
Vec3::operator<<
friend std::ostream & operator<<(std::ostream &os, const Vec3 &c)
Mat3::mxevc
friend void mxevc(const Mat3 &m, double &a, Vec3 &v)
Definition: attlib.cpp:597
Vec3
Definition: attlib.h:26
vcpy
void vcpy(Vec3 &v, double &p, double &y)
Definition: attlib.cpp:579
Mat3::operator+
friend Mat3 operator+(const Mat3 &c1, const Mat3 &c2)
Definition: attlib.cpp:402
Mat3::operator-=
Mat3 & operator-=(const Mat3 &c)
Definition: attlib.cpp:307
Mat3::operator/
friend Mat3 operator/(const Mat3 &c1, double r)
Definition: attlib.cpp:460
Mat3::operator+=
Mat3 & operator+=(const Mat3 &c)
Definition: attlib.cpp:298
Vec3::abs
friend double abs(const Vec3 &c)
Definition: attlib.cpp:101
Mat3::Mat3
Mat3(double x=0)
Definition: attlib.cpp:234
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:250
Vec3::operator/
friend Vec3 operator/(const Vec3 &c1, double r)
Definition: attlib.cpp:160
yrot
Mat3 yrot(double a)
Definition: attlib.cpp:510
Mat3::operator*
friend Mat3 operator*(double r, const Mat3 &c1)
Definition: attlib.cpp:422
Mat3::operator=
Mat3 & operator=(const Mat3 &c)
Definition: attlib.cpp:288
Vec3::operator-
friend Vec3 operator-(const Vec3 &c1, const Vec3 &c2)
Definition: attlib.cpp:125
Mat3::mxdet
friend double mxdet(const Mat3 &c)
Definition: attlib.cpp:391
Vec3::operator*=
Vec3 & operator*=(const Vec3 &c)
Definition: attlib.cpp:75
Mat3::operator*=
Mat3 & operator*=(const Mat3 &c)
Definition: attlib.cpp:316
Mat3::mxvct
friend Vec3 mxvct(const Mat3 &m1, Vec3 &v1)
Definition: attlib.cpp:474
Vec3::operator*
friend Vec3 operator*(double r, const Vec3 &c1)
Definition: attlib.cpp:134
Mat3::mxtrn
friend Mat3 mxtrn(const Mat3 &m1)
Definition: attlib.cpp:380
vcrp
void vcrp(Vec3 &v, double &p, double &r)
Definition: attlib.cpp:588
Mat3::m
double m[3][3]
Definition: attlib.h:65
mxrox
Mat3 mxrox(double &a, Vec3 &v)
Definition: attlib.cpp:632
Vec3::operator/=
Vec3 & operator/=(double r)
Definition: attlib.cpp:91
mxcon
Mat3 mxcon(double r)
Definition: attlib.cpp:358
Mat3::operator/=
Mat3 & operator/=(double r)
Definition: attlib.cpp:345
Vec3::operator-=
Vec3 & operator-=(const Vec3 &c)
Definition: attlib.cpp:69
Mat3::operator<<
friend std::ostream & operator<<(std::ostream &os, const Mat3 &c)
Vec3::assign
void assign(double x=0, double y=0, double z=0)
Definition: attlib.cpp:47
xrot
Mat3 xrot(double a)
Definition: attlib.cpp:489
Vec3::vnorm
friend Vec3 vnorm(const Vec3 &c)
Definition: attlib.cpp:171
Vec3::dot
friend double dot(const Vec3 &c1, const Vec3 &c2)
Definition: attlib.cpp:109
Vec3::carpol
friend Vec3 carpol(const Vec3 &c)
Definition: attlib.cpp:185
Vec3::operator+=
Vec3 & operator+=(const Vec3 &c)
Definition: attlib.cpp:63
Vec3::operator=
Vec3 & operator=(const Vec3 &c)
Definition: attlib.cpp:57
atan20
double atan20(double y, double x)
Definition: attlib.cpp:26
Mat3::operator-
friend Mat3 operator-(const Mat3 &c1, const Mat3 &c2)
Definition: attlib.cpp:412
Mat3::gpyr
friend void gpyr(const Mat3 &m1, double &p, double &y, double &r)
Definition: attlib.cpp:569
Vec3::polcar
friend Vec3 polcar(const Vec3 &c)
Definition: attlib.cpp:208
Vec3::Vec3
Vec3(double x=0, double y=0, double z=0)
Definition: attlib.cpp:38
csmx
Mat3 csmx(double p, double y, double r)
Definition: attlib.cpp:552
Mat3::PutMij
void PutMij(double x, int i, int j)
Definition: attlib.cpp:273
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:49 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