GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_vector2df.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21 *****************************************************************************/
22 
24 
25 #ifndef GLC_VECTOR2DF_H_
26 #define GLC_VECTOR2DF_H_
27 
28 #include "glc_utils_maths.h"
29 
30 #include "../glc_config.h"
31 
33 // definition global
35 
38 
42 
43 
45 {
46  friend class GLC_Vector2d;
48 
50 
51 public:
57  inline GLC_Vector2df()
58  {
59  vector[0]= 0.0f;
60  vector[1]= 0.0f;
61  }
62 
64  inline GLC_Vector2df(const float &dX, const float &dY)
65  {
66  vector[0]= dX;
67  vector[1]= dY;
68  }
69 
76  inline GLC_Vector2df(const GLC_Vector2df &Vect)
77  {
78  vector[0]= Vect.vector[0];
79  vector[1]= Vect.vector[1];
80  }
82 
84 
86 
87 public:
89  inline GLC_Vector2df& setX(const float &dX)
90  {
91  vector[0]= dX;
92  return *this;
93  }
94 
96  inline GLC_Vector2df& setY(const float &dY)
97  {
98  vector[1]= dY;
99  return *this;
100  }
101 
103  inline GLC_Vector2df& setVect(const float &dX, const float &dY)
104  {
105  vector[0]= dX;
106  vector[1]= dY;
107  return *this;
108  }
109 
111  inline GLC_Vector2df& setVect(const GLC_Vector2df &Vect)
112  {
113  vector[0]= Vect.vector[0];
114  vector[1]= Vect.vector[1];
115  return *this;
116  }
117 
119 
121 
123 
124 public:
126  inline float X(void) const
127  {
128  return vector[0];
129  }
131  inline float Y(void) const
132  {
133  return vector[1];
134  }
136  inline const float *return_dVect(void) const
137  {
138  return vector;
139  }
141  inline bool isNull(void) const
142  {
143  return (qFuzzyCompare(vector[0], 0.0f) && qFuzzyCompare(vector[1], 0.0f));
144  }
145 
147 
149 //name Private attributes
151 private:
156  float vector[2];
157 
158 }; //class GLC_Vector2df
159 
162 
163 #endif /*GLC_VECTOR2DF_H_*/

©2005-2013 Laurent Ribon