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_VECTOR3DF_H_ 00026 #define GLC_VECTOR3DF_H_ 00027 #include "glc_utils_maths.h" 00028 00029 #include "../glc_config.h" 00030 00033 00037 00038 00039 class GLC_LIB_EXPORT GLC_Vector3df 00040 { 00041 friend class GLC_Vector4d; 00042 friend class GLC_Vector3d; 00044 00046 00047 public: 00054 inline GLC_Vector3df() 00055 { 00056 m_Vector[0]= 0.0f; 00057 m_Vector[1]= 0.0f; 00058 m_Vector[2]= 0.0f; 00059 } 00060 00062 inline GLC_Vector3df(const float &dX, const float &dY, const float &dZ) 00063 { 00064 setVect(dX, dY, dZ); 00065 } 00066 00073 inline GLC_Vector3df(const GLC_Vector3df &Vect) 00074 { 00075 m_Vector[0]= Vect.m_Vector[0]; 00076 m_Vector[1]= Vect.m_Vector[1]; 00077 m_Vector[2]= Vect.m_Vector[2]; 00078 } 00080 00081 00083 00085 00086 public: 00088 inline GLC_Vector3df& setX(const float &dX) 00089 { 00090 m_Vector[0]= dX; 00091 return *this; 00092 } 00093 00095 inline GLC_Vector3df& setY(const float &dY) 00096 { 00097 m_Vector[1]= dY; 00098 return *this; 00099 } 00100 00102 inline GLC_Vector3df& setZ(const float &dZ) 00103 { 00104 m_Vector[2]= dZ; 00105 return *this; 00106 } 00107 00109 inline GLC_Vector3df& setVect(const float &dX, const float &dY, const float &dZ) 00110 { 00111 m_Vector[0]= dX; 00112 m_Vector[1]= dY; 00113 m_Vector[2]= dZ; 00114 00115 return *this; 00116 } 00117 00119 GLC_Vector3df& setVect(const GLC_Vector3df &Vect) 00120 { 00121 m_Vector[0]= Vect.m_Vector[0]; 00122 m_Vector[1]= Vect.m_Vector[1]; 00123 m_Vector[2]= Vect.m_Vector[2]; 00124 return *this; 00125 } 00126 00128 inline GLC_Vector3df& setInv(void) 00129 { 00130 m_Vector[0]= - m_Vector[0]; 00131 m_Vector[1]= - m_Vector[1]; 00132 m_Vector[2]= - m_Vector[2]; 00133 return *this; 00134 } 00135 00137 00139 00141 00142 public: 00144 inline float x(void) const 00145 { 00146 return m_Vector[0]; 00147 } 00149 inline float y(void) const 00150 { 00151 return m_Vector[1]; 00152 } 00154 inline float z(void) const 00155 { 00156 return m_Vector[2]; 00157 } 00159 inline const float *data(void) const 00160 { 00161 return m_Vector; 00162 } 00164 inline bool isNull(void) const 00165 { 00166 return qFuzzyCompare(m_Vector[0], 0.0f) && qFuzzyCompare(m_Vector[1], 0.0f) 00167 && qFuzzyCompare(m_Vector[2], 0.0f); 00168 } 00169 00171 00173 //name Private attributes 00175 private: 00181 float m_Vector[3]; 00182 00183 }; //class GLC_Vector3d 00184 00186 typedef GLC_Vector3df GLC_Point3df; 00187 00188 #endif /*GLC_VECTOR3DF_H_*/