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  Version 2.0.0 Beta 1, packaged on April 2010.
00006 
00007  http://glc-lib.sourceforge.net
00008 
00009  GLC-lib is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  GLC-lib is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with GLC-lib; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023 *****************************************************************************/
00024 
00026 
00027 #ifndef GLC_VECTOR2DF_H_
00028 #define GLC_VECTOR2DF_H_
00029 
00030 #include "glc_utils_maths.h"
00031 
00032 #include "../glc_config.h"
00033 
00035 // definition global
00037 
00040 
00044 
00045 
00046 class GLC_LIB_EXPORT GLC_Vector2df
00047 {
00048         friend class GLC_Vector2d;
00050 
00052 
00053 public:
00059         inline GLC_Vector2df()
00060         {
00061                 vector[0]= 0.0f;
00062                 vector[1]= 0.0f;
00063         }
00064 
00066         inline GLC_Vector2df(const float &dX, const float &dY)
00067         {
00068                 vector[0]= dX;
00069                 vector[1]= dY;
00070         }
00071 
00078         inline GLC_Vector2df(const GLC_Vector2df &Vect)
00079         {
00080                 vector[0]= Vect.vector[0];
00081                 vector[1]= Vect.vector[1];
00082         }
00084 
00086 
00088 
00089 public:
00091         inline GLC_Vector2df& setX(const float &dX)
00092         {
00093                 vector[0]= dX;
00094                 return *this;
00095         }
00096 
00098         inline GLC_Vector2df& setY(const float &dY)
00099         {
00100                 vector[1]= dY;
00101                 return *this;
00102         }
00103 
00105         inline GLC_Vector2df& setVect(const float &dX, const float &dY)
00106         {
00107                 vector[0]= dX;
00108                 vector[1]= dY;
00109                 return *this;
00110         }
00111 
00113         inline GLC_Vector2df& setVect(const GLC_Vector2df &Vect)
00114         {
00115                 vector[0]= Vect.vector[0];
00116                 vector[1]= Vect.vector[1];
00117                 return *this;
00118         }
00119 
00121 
00123 
00125 
00126 public:
00128         inline float X(void) const
00129         {
00130                 return vector[0];
00131         }
00133         inline float Y(void) const
00134         {
00135                 return vector[1];
00136         }
00138         inline const float *return_dVect(void) const
00139         {
00140                 return vector;
00141         }
00143         inline bool isNull(void) const
00144         {
00145                 return (qFuzzyCompare(vector[0], 0.0f) && qFuzzyCompare(vector[1], 0.0f));
00146         }
00147 
00149 
00151 //name Private attributes
00153 private:
00158         float vector[2];
00159 
00160 }; //class GLC_Vector2df
00161 
00163 typedef GLC_Vector2df GLC_Point2df;
00164 
00165 #endif /*GLC_VECTOR2DF_H_*/

SourceForge.net Logo

©2005 Laurent Ribon