Quantum GIS API Documentation
1.7.4
|
00001 /*************************************************************************** 00002 Vector3D.h - description 00003 ------------------- 00004 copyright : (C) 2004 by Marco Hugentobler 00005 email : mhugent@geo.unizh.ch 00006 ***************************************************************************/ 00007 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 00017 #ifndef VECTOR3D_H 00018 #define VECTOR3D_H 00019 00020 #include <cmath> 00021 00022 class ANALYSIS_EXPORT Vector3D 00027 { 00028 protected: 00030 double mX; 00032 double mY; 00034 double mZ; 00035 00036 public: 00038 Vector3D( double x, double y, double z ); 00040 Vector3D(); 00042 Vector3D( const Vector3D& v ); 00044 ~Vector3D(); 00045 Vector3D& operator=( const Vector3D& v ); 00046 bool operator==( const Vector3D& v ); 00047 bool operator!=( const Vector3D& v ); 00049 double getX() const; 00051 double getY() const; 00053 double getZ() const; 00055 double getLength() const; 00057 void setX( double x ); 00059 void setY( double y ); 00061 void setZ( double z ); 00063 void standardise(); 00064 }; 00065 00066 //------------------------------------------constructors------------------------------------ 00067 00068 inline Vector3D::Vector3D( double x, double y, double z ) : mX( x ), mY( y ), mZ( z ) 00069 { 00070 00071 } 00072 00073 inline Vector3D::Vector3D() : mX( 0 ), mY( 0 ), mZ( 0 )//using a list 00074 { 00075 00076 } 00077 00078 inline Vector3D::~Vector3D() 00079 { 00080 00081 } 00082 00083 //-------------------------------------------setter and getters------------------------------- 00084 00085 inline double Vector3D::getX() const 00086 { 00087 return mX; 00088 } 00089 00090 inline double Vector3D::getY() const 00091 { 00092 return mY; 00093 } 00094 00095 inline double Vector3D::getZ() const 00096 { 00097 return mZ; 00098 } 00099 00100 inline void Vector3D::setX( double x ) 00101 { 00102 mX = x; 00103 } 00104 00105 inline void Vector3D::setY( double y ) 00106 { 00107 mY = y; 00108 } 00109 00110 inline void Vector3D::setZ( double z ) 00111 { 00112 mZ = z; 00113 } 00114 00115 #endif