ML Reference
|
00001 // **InsertLicense** code 00002 //===================================================================================== 00004 00009 //===================================================================================== 00010 00011 #ifndef __mlVector6_H 00012 #define __mlVector6_H 00013 00014 // Include system independency file and project settings. 00015 #ifndef __mlLinearAlgebraSystem_H 00016 #include "mlLinearAlgebraSystem.h" 00017 #endif 00018 #ifndef __mlLinearAlgebraDefs_H 00019 #include "mlLinearAlgebraDefs.h" 00020 #endif 00021 #ifndef __mlFloatingPointVector_H 00022 #include "mlFloatingPointVector.h" 00023 #endif 00024 #ifndef __mlVector2_H 00025 #include "mlVector2.h" 00026 #endif 00027 #ifndef __mlVector3_H 00028 #include "mlVector3.h" 00029 #endif 00030 #ifndef __mlVector4_H 00031 #include "mlVector4.h" 00032 #endif 00033 00034 // All declarations of this header will be in the ML_LA_NAMESPACE namespace. 00035 ML_LA_START_NAMESPACE 00036 00037 //-------------------------------------------------------------------- 00039 // This is necessary because we do not known whether vector or 00040 // matrix header is included first and we cannot move template 00041 // code into C++ file. 00042 //-------------------------------------------------------------------- 00043 template <class DT> class Tvec2; 00044 template <class DT> class Tvec3; 00045 template <class DT> class Tvec4; 00047 00048 //-------------------------------------------------------------------- 00050 //-------------------------------------------------------------------- 00052 template <class DT> 00053 class Tvec6 : public FloatingPointVector<DT,6> { 00054 public: 00055 00057 typedef FloatingPointVector<DT,6> Superclass; 00058 00060 typedef DT ComponentType; 00061 00062 //-------------------------------------------------------------------- 00064 00065 //-------------------------------------------------------------------- 00068 inline explicit Tvec6(const DT value=0) : Superclass(value) 00069 { 00070 ML_TRACE_IN_TIME_CRITICAL("Tvec6::Tvec6(const DT value=0)"); 00071 } 00072 00074 inline Tvec6(const Tvec6<DT>& v) : Superclass(v) 00075 { 00076 ML_TRACE_IN_TIME_CRITICAL("Tvec6::Tvec6(const Tvec6<DT>& v)"); 00077 } 00078 00082 inline Tvec6(const Superclass &v) : Superclass(v) 00083 { 00084 ML_TRACE_IN_TIME_CRITICAL("Tvec6::Tvec6(const Superclass &v)"); 00085 } 00086 00089 inline Tvec6(const DT x, const DT y, const DT z, const DT c, const DT t, const DT u) 00090 { 00091 ML_TRACE_IN_TIME_CRITICAL("Tvec6::Tvec6(const DT x, ... , const DT u)"); 00092 00093 Superclass::_buffer[0] = x; 00094 Superclass::_buffer[1] = y; 00095 Superclass::_buffer[2] = z; 00096 Superclass::_buffer[3] = c; 00097 Superclass::_buffer[4] = t; 00098 Superclass::_buffer[5] = u; 00099 } 00100 00102 inline Tvec6(const Tvec2<DT>& v, const DT z, const DT c, const DT t, const DT u) 00103 { 00104 ML_TRACE_IN_TIME_CRITICAL("Tvec6::Tvec6(const Tvec2<DT>& v, const DT z, const DT c, const DT t, const DT u)"); 00105 00106 Superclass::_buffer[0] = v[0]; 00107 Superclass::_buffer[1] = v[1]; 00108 Superclass::_buffer[2] = z; 00109 Superclass::_buffer[3] = c; 00110 Superclass::_buffer[4] = t; 00111 Superclass::_buffer[5] = u; 00112 } 00113 00115 inline Tvec6(const Tvec3<DT>& v, const DT c, const DT t, const DT u) 00116 { 00117 ML_TRACE_IN_TIME_CRITICAL("Tvec6::Tvec6(const Tvec3<DT>& v, const DT c, const DT t, const DT u)"); 00118 00119 Superclass::_buffer[0] = v[0]; 00120 Superclass::_buffer[1] = v[1]; 00121 Superclass::_buffer[2] = v[2]; 00122 Superclass::_buffer[3] = c; 00123 Superclass::_buffer[4] = t; 00124 Superclass::_buffer[5] = u; 00125 } 00126 00128 inline Tvec6(const Tvec4<DT>& v, const DT t, const DT u) 00129 { 00130 ML_TRACE_IN_TIME_CRITICAL("Tvec6::Tvec6(const Tvec4<DT>& v, const DT t, const DT u)"); 00131 00132 Superclass::_buffer[0] = v[0]; 00133 Superclass::_buffer[1] = v[1]; 00134 Superclass::_buffer[2] = v[2]; 00135 Superclass::_buffer[3] = v[3]; 00136 Superclass::_buffer[4] = t; 00137 Superclass::_buffer[5] = u; 00138 } 00140 00141 //-------------------------------------------------------------------- 00143 00144 //-------------------------------------------------------------------- 00146 inline void assign(const DT x, const DT y, const DT z, const DT c, const DT t, const DT u) 00147 { 00148 ML_TRACE_IN_TIME_CRITICAL("Tvec6::Tvec6(const DT x, ... , const DT u)"); 00149 00150 Superclass::_buffer[0] = x; 00151 Superclass::_buffer[1] = y; 00152 Superclass::_buffer[2] = z; 00153 Superclass::_buffer[3] = c; 00154 Superclass::_buffer[4] = t; 00155 Superclass::_buffer[5] = u; 00156 } 00157 00159 inline Tvec6<DT>& operator+=(const Tvec2<DT>& v) 00160 { 00161 ML_TRACE_IN_TIME_CRITICAL("Tvec6::operator+=(const Tvec2<DT>& v)"); 00162 00163 Superclass::_buffer[0] += v[0]; 00164 Superclass::_buffer[1] += v[1]; 00165 return *this; 00166 } 00167 00169 inline Tvec6<DT>& operator+=(const Tvec3<DT>& v) 00170 { 00171 ML_TRACE_IN_TIME_CRITICAL("Tvec6::operator+=(const Tvec3<DT>& v)"); 00172 00173 Superclass::_buffer[0] += v[0]; 00174 Superclass::_buffer[1] += v[1]; 00175 Superclass::_buffer[2] += v[2]; 00176 return *this; 00177 } 00178 00180 inline Tvec6<DT>& operator+=(const Tvec4<DT>& v) 00181 { 00182 ML_TRACE_IN_TIME_CRITICAL("Tvec6::operator+=(const Tvec4<DT>& v)"); 00183 00184 Superclass::_buffer[0] += v[0]; 00185 Superclass::_buffer[1] += v[1]; 00186 Superclass::_buffer[2] += v[2]; 00187 Superclass::_buffer[3] += v[3]; 00188 return *this; 00189 } 00190 00192 inline const Tvec3<DT> getVec3() const 00193 { 00194 ML_TRACE_IN_TIME_CRITICAL("Tvec6::getVec3() const"); 00195 00196 return Tvec3<DT>(Superclass::_buffer[0], 00197 Superclass::_buffer[1], 00198 Superclass::_buffer[2]); 00199 } 00200 00202 inline const Tvec4<DT> getVec4() const 00203 { 00204 ML_TRACE_IN_TIME_CRITICAL("Tvec6::getVec4() const"); 00205 00206 return Tvec4<DT>(Superclass::_buffer[0], 00207 Superclass::_buffer[1], 00208 Superclass::_buffer[2], 00209 Superclass::_buffer[3]); 00210 } 00212 00213 // Note: Multiplications with Matrix6 are implemented with/in class Tmat6. 00214 00215 }; 00216 00217 00218 //----------------------------------------------------------------------------------- 00220 00221 //----------------------------------------------------------------------------------- 00223 typedef Tvec6<MLfloat> Vector6f; 00225 typedef Tvec6<MLdouble> Vector6d; 00227 typedef Tvec6<MLldouble> Vector6ld; 00229 typedef Tvec6<MLdouble> Vector6; 00231 00232 00233 #ifdef ML_DEPRECATED 00234 00235 00236 00237 00238 ML_DEPRECATED typedef Tvec6<MLfloat> vecf6; 00241 ML_DEPRECATED typedef Tvec6<MLdouble> vecd6; 00244 ML_DEPRECATED typedef Tvec6<MLldouble> vecld6; 00247 ML_DEPRECATED typedef Tvec6<MLdouble> vec6; 00249 00250 #endif // ML_DEPRECATED 00251 00252 00253 ML_LA_END_NAMESPACE 00254 00255 #endif //of __mlVector6_H 00256 00257 00258