00001 /************************************************************************ 00002 * Copyright (C) 2012 Eindhoven University of Technology (TU/e). * 00003 * All rights reserved. * 00004 ************************************************************************ 00005 * Redistribution and use in source and binary forms, with or without * 00006 * modification, are permitted provided that the following conditions * 00007 * are met: * 00008 * * 00009 * 1. Redistributions of source code must retain the above * 00010 * copyright notice, this list of conditions and the following * 00011 * disclaimer. * 00012 * * 00013 * 2. Redistributions in binary form must reproduce the above * 00014 * copyright notice, this list of conditions and the following * 00015 * disclaimer in the documentation and/or other materials * 00016 * provided with the distribution. * 00017 * * 00018 * THIS SOFTWARE IS PROVIDED BY TU/e "AS IS" AND ANY EXPRESS OR * 00019 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * 00020 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * 00021 * ARE DISCLAIMED. IN NO EVENT SHALL TU/e OR CONTRIBUTORS BE LIABLE * 00022 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * 00023 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * 00024 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * 00025 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * 00026 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 00027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * 00028 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * 00029 * DAMAGE. * 00030 * * 00031 * The views and conclusions contained in the software and * 00032 * documentation are those of the authors and should not be * 00033 * interpreted as representing official policies, either expressed or * 00034 * implied, of TU/e. * 00035 ************************************************************************/ 00036 00037 #ifndef PROBLIB_DATATYPES_H_ 00038 #define PROBLIB_DATATYPES_H_ 00039 00040 #include <armadillo> 00041 00042 namespace pbl { 00043 00044 typedef arma::vec Vector; 00045 00046 typedef arma::mat Matrix; 00047 00048 class Scalar : public arma::vec::fixed<1> { 00049 00050 public: 00051 Scalar(double x) { 00052 (*this)(0) = x; 00053 } 00054 }; 00055 00056 class Vector3 : public arma::vec3 { 00057 00058 public: 00059 Vector3(double v0, double v1, double v2) { 00060 (*this)(0) = v0; 00061 (*this)(1) = v1; 00062 (*this)(2) = v2; 00063 } 00064 00065 }; 00066 00067 //class Vector3 : public Eigen::Vector3d { 00068 // 00069 //public: 00070 // Vector3(double v0, double v1, double v2) { 00071 // (*this)(0) = v0; 00072 // (*this)(1) = v1; 00073 // (*this)(2) = v2; 00074 // } 00075 // 00076 //}; 00077 00078 class Vector4 : public arma::vec4 { 00079 00080 public: 00081 Vector4(double v0, double v1, double v2, double v3) { 00082 (*this)(0) = v0; 00083 (*this)(1) = v1; 00084 (*this)(2) = v2; 00085 (*this)(3) = v3; 00086 } 00087 00088 }; 00089 00090 class Matrix3 : public arma::mat33 { 00091 00092 public: 00093 Matrix3(double m00, double m11, double m22) { 00094 this->zeros(); 00095 (*this)(0, 0) = m00; 00096 (*this)(1, 1) = m11; 00097 (*this)(2, 2) = m22; 00098 } 00099 }; 00100 00101 class Matrix4 : public arma::mat44 { 00102 00103 public: 00104 Matrix4(double m00, double m11, double m22, double m33) { 00105 this->zeros(); 00106 (*this)(0, 0) = m00; 00107 (*this)(1, 1) = m11; 00108 (*this)(2, 2) = m22; 00109 (*this)(3, 3) = m33; 00110 } 00111 }; 00112 00113 00114 } 00115 00116 #endif /* DATATYPES_H_ */