vector4.h
Go to the documentation of this file.
00001 // HOG-Man - Hierarchical Optimization for Pose Graphs on Manifolds
00002 // Copyright (C) 2010 G. Grisetti, R. Kümmerle, C. Stachniss
00003 //
00004 // This file is part of HOG-Man.
00005 // 
00006 // HOG-Man is free software: you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License as published by
00008 // the Free Software Foundation, either version 3 of the License, or
00009 // (at your option) any later version.
00010 // 
00011 // HOG-Man is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU General Public License
00017 // along with HOG-Man.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 #ifndef VRML_VECTOR4_H
00020 #define VRML_VECTOR4_H
00021 
00022 #include <stdexcept>
00023 #include <iostream>
00024 
00025 namespace vrml {
00026 
00030 class Vector4
00031 {
00032   public:
00033     Vector4();
00034     ~Vector4();
00035 
00036     Vector4(const Vector4& other);
00037     Vector4(double d1, double d2, double d3, double d4);
00038     explicit Vector4(const double* data);
00039 
00040     double& operator[](unsigned int m) throw (std::runtime_error)
00041     {
00042       if (m > 4)
00043         throw std::runtime_error("index exceeds vector4 dimensions");
00044       return _data[m];
00045     }
00046 
00047     const double& operator[](unsigned int m) const throw (std::runtime_error)
00048     {
00049       if (m > 4)
00050         throw std::runtime_error("index exceeds vector4 dimensions");
00051       return _data[m];
00052     }
00053 
00054     Vector4& operator=(const Vector4& other);
00055     bool operator== (const Vector4&  other) const;
00056     bool operator!= (const Vector4& other) const;
00057 
00058     Vector4 operator+ (const Vector4& other) const;
00059     Vector4 operator- (const Vector4& other) const;
00060     Vector4 operator* (double x) const;
00061     Vector4 operator/ (double x) const;
00062     Vector4 operator- () const;
00063 //    operator double*() {return _data;}
00064 //    operator const double*() const {return _data;}
00065 
00066     Vector4& operator+= (const Vector4& other);
00067     Vector4& operator-= (const Vector4& other);
00068     Vector4& operator*= (double x);
00069     Vector4& operator/= (double x);
00070     friend Vector4 operator* (double x, const Vector4& v);
00071     friend Vector4 operator/ (double x, const Vector4& v);
00072 
00073   protected:
00074     double _data[4]; 
00075     void copy(const Vector4& other);
00076 };
00077 
00078 std::ostream& operator<<(std::ostream& os, const Vector4& v);
00079 
00080 }
00081 #endif


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Mon Oct 6 2014 00:06:59