gvector.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // This file is part of libgvectors.
00004 // libgvectors is a C++ library intended for visualizing mathematical vectors.
00005 // Copyright (C) 2007  Rafael Ostertag
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // This program is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with this program; if not, write to the Free Software
00019 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
00020 // USA.
00021 //
00022 // $Id: gvector_8h-source.html,v 1.1 2007-09-08 19:02:34 rafi Exp $
00023 //
00024 // File:   gvector.h
00025 // Author: Rafael Ostertag
00026 //
00027 // Created on March 10, 2007, 3:35 PM
00028 //
00029 
00030 
00040 #ifndef _gvector_H
00041 #define _gvector_H
00042 
00043 #include <gvenums.h>
00044 #include <coordinates.h>
00045 
00046 namespace GVectors {
00047     
00055     class GVector : public Coordinates {
00056     protected:
00062         double z_ord;
00063         
00064     public:
00066         GVector();
00068         GVector(double x, double y, double z);
00070         virtual ~GVector();
00072         GVector(const GVector &v);
00073         
00075         void setZ(double z);
00077         void Z(double z);
00079         void set(double x, double y, double z);
00080         
00082         double getZ() const;
00084         double Z() const;
00086         void get(double &x, double &y, double &z) const;
00087         
00089         bool iszero() const;
00090         
00092         double abs() const;
00094         const GVector cross(const GVector &v) const;
00096         const double angle(const GVector &v, Angle_Type at) const;
00098         const GVector connecting(const GVector &v) const;
00100         const GVector middle(const GVector &v) const;
00102         void invert();
00103         
00105         virtual void print() const;
00106         
00108         const GVector& operator=(const GVector &v);
00109         
00111         GVector operator+(const GVector &v) const;
00113         GVector operator-(const GVector &v) const;
00114         
00116         double operator*(const GVector &v) const;
00118         GVector operator*(const double &d) const;
00119         
00121         GVector operator/(const double &d) const;
00122         
00124         const GVector& operator+=(const GVector &v);
00126         const GVector& operator-=(const GVector &v);
00128         const GVector& operator*=(double d);
00129     };
00130 
00136     typedef GVector* gv_ptr_t;
00142     typedef GVector& gv_ref_t;
00143 
00149     typedef const GVector* const_gv_ptr_t;
00150 
00156     typedef const GVector& const_gv_ref_t;
00157 }
00158 
00159 #endif  /* _Gvector_H */

Generated on Sat Sep 8 19:37:29 2007 for libgvectors by  doxygen 1.4.7