User Manual, Developers Guide and API Documentation

Vector.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #ifndef WNS_GEOMETRY_VECTOR_HPP
00029 #define WNS_GEOMETRY_VECTOR_HPP
00030 
00031 #include <WNS/pyconfig/View.hpp>
00032 #include <valarray>
00033 
00034 namespace wns { namespace geometry {
00038     class Vector {
00039     public:
00040         // con-/destructor
00041         Vector();
00042 
00043         Vector(double dx, double dy, double dz);
00044 
00045         explicit
00046         Vector(const std::valarray<double>& other);
00047 
00053         Vector(const Point& p1, const Point& p2) :
00054             vec(p1.get()-p2.get())
00055         {
00056         }
00057 
00058         virtual
00059         ~Vector();
00060 
00061         // setter
00062         void
00063         set(double dx, double dy = 0.0, double dz = 0.0);
00064 
00065         void
00066         setPolar(double r, double phi, double theta);
00067 
00068         void
00069         set(const std::valarray<double>& posOffset);
00070 
00071         void
00072         setDeltaX(double dx);
00073 
00074         void
00075         setDeltaY(double dy);
00076 
00077         void
00078         setDeltaZ(double dz);
00079 
00080         void
00081         setR(double r);
00082 
00083         void
00084         setAzimuth(double phi);
00085 
00086         void
00087         setElevation(double theta);
00088 
00089         // getter
00094         double
00095         getPhi() const;
00100         double
00101         getTheta() const;
00102 
00103         const std::valarray<double>&
00104         get() const;
00105 
00106         double
00107         getDeltaX() const;
00108 
00109         double
00110         getDeltaY() const;
00111 
00112         double
00113         getDeltaZ() const;
00114 
00115         double
00116         getR() const;
00117 
00118         double
00119         getAzimuth() const;
00120 
00121         double
00122         getElevation() const;
00123 
00124         // operator
00125         Point
00126         operator+(const Point& point) const;
00127 
00128         Vector
00129         operator+(const Vector& other) const;
00130 
00131         Vector
00132         operator*(const int scale) const;
00133 
00134         Vector
00135         operator*(const double scale) const;
00136 
00137         void
00138         operator =(const Vector& other);
00139 
00140         bool
00141         operator==(const Vector& other) const;
00142 
00143         bool
00144         operator!=(const Vector& other) const;
00145 
00146         // misc
00147         Vector
00148         cross(const Vector& other) const;
00149 
00150         double
00151         dot(const Vector& other) const;
00152 
00153         double
00154         abs() const;
00155 
00156     private:
00157         std::valarray<double> vec;
00158     };
00159 } // geometry
00160 } // wns
00161 
00162 #endif // NOT defined WNS_GEOMETRY_VECTOR_HPP
00163 
00164 

Generated on Sat May 26 03:31:37 2012 for openWNS by  doxygen 1.5.5