datatypes.h
Go to the documentation of this file.
1 /************************************************************************
2  * Copyright (C) 2012 Eindhoven University of Technology (TU/e). *
3  * All rights reserved. *
4  ************************************************************************
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions *
7  * are met: *
8  * *
9  * 1. Redistributions of source code must retain the above *
10  * copyright notice, this list of conditions and the following *
11  * disclaimer. *
12  * *
13  * 2. Redistributions in binary form must reproduce the above *
14  * copyright notice, this list of conditions and the following *
15  * disclaimer in the documentation and/or other materials *
16  * provided with the distribution. *
17  * *
18  * THIS SOFTWARE IS PROVIDED BY TU/e "AS IS" AND ANY EXPRESS OR *
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
21  * ARE DISCLAIMED. IN NO EVENT SHALL TU/e OR CONTRIBUTORS BE LIABLE *
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
24  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
25  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
26  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
28  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
29  * DAMAGE. *
30  * *
31  * The views and conclusions contained in the software and *
32  * documentation are those of the authors and should not be *
33  * interpreted as representing official policies, either expressed or *
34  * implied, of TU/e. *
35  ************************************************************************/
36 
37 #ifndef PROBLIB_DATATYPES_H_
38 #define PROBLIB_DATATYPES_H_
39 
40 #include <armadillo>
41 
42 namespace pbl {
43 
44 typedef arma::vec Vector;
45 
46 typedef arma::mat Matrix;
47 
48 class Scalar : public arma::vec::fixed<1> {
49 
50 public:
51  Scalar(double x) {
52  (*this)(0) = x;
53  }
54 };
55 
56 class Vector3 : public arma::vec3 {
57 
58 public:
59  Vector3(double v0, double v1, double v2) {
60  (*this)(0) = v0;
61  (*this)(1) = v1;
62  (*this)(2) = v2;
63  }
64 
65 };
66 
67 //class Vector3 : public Eigen::Vector3d {
68 //
69 //public:
70 // Vector3(double v0, double v1, double v2) {
71 // (*this)(0) = v0;
72 // (*this)(1) = v1;
73 // (*this)(2) = v2;
74 // }
75 //
76 //};
77 
78 class Vector4 : public arma::vec4 {
79 
80 public:
81  Vector4(double v0, double v1, double v2, double v3) {
82  (*this)(0) = v0;
83  (*this)(1) = v1;
84  (*this)(2) = v2;
85  (*this)(3) = v3;
86  }
87 
88 };
89 
90 class Matrix3 : public arma::mat33 {
91 
92 public:
93  Matrix3(double m00, double m11, double m22) {
94  this->zeros();
95  (*this)(0, 0) = m00;
96  (*this)(1, 1) = m11;
97  (*this)(2, 2) = m22;
98  }
99 };
100 
101 class Matrix4 : public arma::mat44 {
102 
103 public:
104  Matrix4(double m00, double m11, double m22, double m33) {
105  this->zeros();
106  (*this)(0, 0) = m00;
107  (*this)(1, 1) = m11;
108  (*this)(2, 2) = m22;
109  (*this)(3, 3) = m33;
110  }
111 };
112 
113 
114 }
115 
116 #endif /* DATATYPES_H_ */
arma_hot const Col< eT > & zeros()
arma::vec Vector
Definition: datatypes.h:44
Vector4(double v0, double v1, double v2, double v3)
Definition: datatypes.h:81
Vector3(double v0, double v1, double v2)
Definition: datatypes.h:59
vec::fixed< 4 > vec4
mat::fixed< 3, 3 > mat33
Mat< double > mat
mat::fixed< 4, 4 > mat44
Matrix4(double m00, double m11, double m22, double m33)
Definition: datatypes.h:104
Scalar(double x)
Definition: datatypes.h:51
vec::fixed< 3 > vec3
Col< double > vec
arma::mat Matrix
Definition: datatypes.h:46
Matrix3(double m00, double m11, double m22)
Definition: datatypes.h:93
arma_inline fixed()


problib
Author(s): Sjoerd van den Dries, Jos Elfring
autogenerated on Fri Apr 16 2021 02:32:19