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_VECTOR3DF_H_ 00028 #define GLC_VECTOR3DF_H_ 00029 #include "glc_utils_maths.h" 00030 00031 #include "../glc_config.h" 00032 00035 00039 00040 00041 class GLC_LIB_EXPORT GLC_Vector3df 00042 { 00043 friend class GLC_Vector4d; 00044 friend class GLC_Vector3d; 00046 00048 00049 public: 00056 inline GLC_Vector3df() 00057 { 00058 m_Vector[0]= 0.0f; 00059 m_Vector[1]= 0.0f; 00060 m_Vector[2]= 0.0f; 00061 } 00062 00064 inline GLC_Vector3df(const float &dX, const float &dY, const float &dZ) 00065 { 00066 setVect(dX, dY, dZ); 00067 } 00068 00075 inline GLC_Vector3df(const GLC_Vector3df &Vect) 00076 { 00077 m_Vector[0]= Vect.m_Vector[0]; 00078 m_Vector[1]= Vect.m_Vector[1]; 00079 m_Vector[2]= Vect.m_Vector[2]; 00080 } 00082 00083 00085 00087 00088 public: 00090 inline GLC_Vector3df& setX(const float &dX) 00091 { 00092 m_Vector[0]= dX; 00093 return *this; 00094 } 00095 00097 inline GLC_Vector3df& setY(const float &dY) 00098 { 00099 m_Vector[1]= dY; 00100 return *this; 00101 } 00102 00104 inline GLC_Vector3df& setZ(const float &dZ) 00105 { 00106 m_Vector[2]= dZ; 00107 return *this; 00108 } 00109 00111 inline GLC_Vector3df& setVect(const float &dX, const float &dY, const float &dZ) 00112 { 00113 m_Vector[0]= dX; 00114 m_Vector[1]= dY; 00115 m_Vector[2]= dZ; 00116 00117 return *this; 00118 } 00119 00121 GLC_Vector3df& setVect(const GLC_Vector3df &Vect) 00122 { 00123 m_Vector[0]= Vect.m_Vector[0]; 00124 m_Vector[1]= Vect.m_Vector[1]; 00125 m_Vector[2]= Vect.m_Vector[2]; 00126 return *this; 00127 } 00128 00130 inline GLC_Vector3df& setInv(void) 00131 { 00132 m_Vector[0]= - m_Vector[0]; 00133 m_Vector[1]= - m_Vector[1]; 00134 m_Vector[2]= - m_Vector[2]; 00135 return *this; 00136 } 00137 00139 00141 00143 00144 public: 00146 inline float X(void) const 00147 { 00148 return m_Vector[0]; 00149 } 00151 inline float Y(void) const 00152 { 00153 return m_Vector[1]; 00154 } 00156 inline float Z(void) const 00157 { 00158 return m_Vector[2]; 00159 } 00161 inline const float *data(void) const 00162 { 00163 return m_Vector; 00164 } 00166 inline bool isNull(void) const 00167 { 00168 return qFuzzyCompare(m_Vector[0], 0.0f) && qFuzzyCompare(m_Vector[1], 0.0f) 00169 && qFuzzyCompare(m_Vector[2], 0.0f); 00170 } 00171 00173 00175 //name Private attributes 00177 private: 00183 float m_Vector[3]; 00184 00185 }; //class GLC_Vector3d 00186 00188 typedef GLC_Vector3df GLC_Point3df; 00189 00190 #endif /*GLC_VECTOR3DF_H_*/