OpenIndy-Core  0.2.0.43
oivec.h
Go to the documentation of this file.
1 #ifndef OIVEC_H
2 #define OIVEC_H
3 
4 #include <QDebug>
5 #include <QtCore/QtMath>
6 #include <vector>
7 #include <stdexcept>
8 
9 #include "global.h"
10 
11 namespace oi{
12 namespace math{
13 
14 class LinearAlgebra;
15 class OiMat;
16 
17 using namespace std;
18 
23 {
24 public:
25  OiVec();
26  OiVec(const int &size);
27  ~OiVec();
28 
30 
31 private:
32  vector<double> values;
33 
34 public:
35  double getAt(int pos) const;
36  int getSize() const;
37 
38  void set(vector<double> v);
39  void setAt(const int &pos, const double &value);
40 
41  void add(const double &value);
42  void removeLast();
43 
44  void replace(const OiVec&);
45 
46  OiVec& operator=(const OiVec&);
47  OiVec operator+(const OiVec&) const;
48  OiVec operator-(const OiVec&) const;
49  OiVec& operator+=(const OiVec&);
50  OiVec& operator-=(const OiVec&);
51  friend OiVec operator*(const OiVec &v, const double value){
52  return OiVec::mult(value, v);
53  }
54  friend OiVec operator*(const double value, const OiVec &v){
55  return OiVec::mult(value, v);
56  }
57  friend OiVec operator/(const OiVec &v, const double value){
58  return OiVec::mult((1.0 / value), v);
59  }
60 
61  void normalize();
62 
63  OiMat t() const;
64 
65  static void cross(OiVec &result, const OiVec &a, const OiVec &b);
66  static void dot(double &result, const OiVec &a, const OiVec &b);
67 
68 private:
69  static OiVec mult(const double &value, const OiVec &v);
70 
71 };
72 
73 }
74 }
75 
76 #endif // OIVEC_H
friend OiVec operator*(const double value, const OiVec &v)
Definition: oivec.h:54
friend OiVec operator/(const OiVec &v, const double value)
Definition: oivec.h:57
The OiVec class.
Definition: oivec.h:22
Definition: coordinatesystem.h:15
The OiMat class.
Definition: oimat.h:58
static LinearAlgebra * myLinearAlgebra
Definition: oivec.h:29
The LinearAlgebra class.
Definition: linearalgebra.h:15
friend OiVec operator*(const OiVec &v, const double value)
Definition: oivec.h:51
#define OI_MATH_EXPORT
Definition: global.h:9