glc_vector2df.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  http://glc-lib.sourceforge.net
00006 
00007  GLC-lib is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU Lesser General Public License as published by
00009  the Free Software Foundation; either version 3 of the License, or
00010  (at your option) any later version.
00011 
00012  GLC-lib 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 Lesser General Public License for more details.
00016 
00017  You should have received a copy of the GNU Lesser General Public License
00018  along with GLC-lib; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021 *****************************************************************************/
00022 
00024 
00025 #ifndef GLC_VECTOR2DF_H_
00026 #define GLC_VECTOR2DF_H_
00027 
00028 #include "glc_utils_maths.h"
00029 
00030 #include "../glc_config.h"
00031 
00033 // definition global
00035 
00038 
00042 
00043 
00044 class GLC_LIB_EXPORT GLC_Vector2df
00045 {
00046         friend class GLC_Vector2d;
00048 
00050 
00051 public:
00057         inline GLC_Vector2df()
00058         {
00059                 vector[0]= 0.0f;
00060                 vector[1]= 0.0f;
00061         }
00062 
00064         inline GLC_Vector2df(const float &dX, const float &dY)
00065         {
00066                 vector[0]= dX;
00067                 vector[1]= dY;
00068         }
00069 
00076         inline GLC_Vector2df(const GLC_Vector2df &Vect)
00077         {
00078                 vector[0]= Vect.vector[0];
00079                 vector[1]= Vect.vector[1];
00080         }
00082 
00084 
00086 
00087 public:
00089         inline GLC_Vector2df& setX(const float &dX)
00090         {
00091                 vector[0]= dX;
00092                 return *this;
00093         }
00094 
00096         inline GLC_Vector2df& setY(const float &dY)
00097         {
00098                 vector[1]= dY;
00099                 return *this;
00100         }
00101 
00103         inline GLC_Vector2df& setVect(const float &dX, const float &dY)
00104         {
00105                 vector[0]= dX;
00106                 vector[1]= dY;
00107                 return *this;
00108         }
00109 
00111         inline GLC_Vector2df& setVect(const GLC_Vector2df &Vect)
00112         {
00113                 vector[0]= Vect.vector[0];
00114                 vector[1]= Vect.vector[1];
00115                 return *this;
00116         }
00117 
00119 
00121 
00123 
00124 public:
00126         inline float X(void) const
00127         {
00128                 return vector[0];
00129         }
00131         inline float Y(void) const
00132         {
00133                 return vector[1];
00134         }
00136         inline const float *return_dVect(void) const
00137         {
00138                 return vector;
00139         }
00141         inline bool isNull(void) const
00142         {
00143                 return (qFuzzyCompare(vector[0], 0.0f) && qFuzzyCompare(vector[1], 0.0f));
00144         }
00145 
00147 
00149 //name Private attributes
00151 private:
00156         float vector[2];
00157 
00158 }; //class GLC_Vector2df
00159 
00161 typedef GLC_Vector2df GLC_Point2df;
00162 
00163 #endif /*GLC_VECTOR2DF_H_*/

SourceForge.net Logo

©2005-2011 Laurent Ribon