#include <TAPsVector.hpp>


Public Member Functions | |
| T | Dot (Vector< T, N > const &v) const |
| T | Dot (Vector< T, N > const &v) const |
| double * | GetDataDouble () |
| const double * | GetDataDouble () const |
| float * | GetDataFloat () |
| const float * | GetDataFloat () const |
| long double * | GetDataLongDouble () |
| const long double * | GetDataLongDouble () const |
| Vector< T, N > | GetUnit (T tolerance=TAPs::Math< T >::EPSILON) const |
| Vector< T, N > | GetUnit (T tolerance=Math< T >::EPSILON) const |
| T | Length () const |
| T | Length () const |
| T | Magnitude () const |
| Vector< T, N > & | Normalized (T tolerance=TAPs::Math< T >::EPSILON) |
| Vector< T, N > & | Normalized (T tolerance=Math< T >::EPSILON) |
| operator const T * () const | |
| operator T * () | |
| bool | operator!= (Vector< T, N > const &v) const |
| bool | operator!= (Vector< T, N > const &v) const |
| T | operator* (Vector< T, N > const &v) const |
| Vector< T, N > | operator* (T s) const |
| T | operator* (Vector< T, N > const &v) const |
| Vector< T, N > | operator* (T s) const |
| Vector< T, N > & | operator*= (T s) |
| Vector< T, N > & | operator*= (T s) |
| Vector< T, N > | operator+ (Vector< T, N > const &v) const |
| Vector< T, N > | operator+ (Vector< T, N > const &v) const |
| Vector< T, N > & | operator+= (Vector< T, N > const &v) |
| Vector< T, N > & | operator+= (Vector< T, N > const &v) |
| Vector< T, N > | operator- (Vector< T, N > const &v) const |
| Vector< T, N > | operator- () const |
| Vector< T, N > | operator- (Vector< T, N > const &v) const |
| Vector< T, N > | operator- () const |
| Vector< T, N > & | operator-= (Vector< T, N > const &v) |
| Vector< T, N > & | operator-= (Vector< T, N > const &v) |
| Vector< T, N > | operator/ (T s) const |
| Vector< T, N > | operator/ (T s) const |
| Vector< T, N > & | operator/= (T s) |
| Vector< T, N > & | operator/= (T s) |
| bool | operator< (Vector< T, N > const &v) const |
| bool | operator< (Vector< T, N > const &v) const |
| bool | operator<= (Vector< T, N > const &v) const |
| bool | operator<= (Vector< T, N > const &v) const |
| Vector< T, N > & | operator= (Vector< T, N > const &v) |
| Vector< T, N > & | operator= (Vector< T, N > const &v) |
| bool | operator== (Vector< T, N > const &v) const |
| bool | operator== (Vector< T, N > const &v) const |
| bool | operator> (Vector< T, N > const &v) const |
| bool | operator> (Vector< T, N > const &v) const |
| bool | operator>= (Vector< T, N > const &v) const |
| bool | operator>= (Vector< T, N > const &v) const |
| T const & | operator[] (int i) const |
| T & | operator[] (int i) |
| T const & | operator[] (int i) const |
| T & | operator[] (int i) |
| int | Size () const |
| T | SquaredLength () const |
| T | SquaredLength () const |
| Vector (Vector< T, N > const &v) | |
| Vector (T const af[N]) | |
| Vector () | |
| Vector (Vector< T, N > const &v) | |
| Vector (T const af[N]) | |
| Vector () | |
Protected Attributes | |
| T | t [N] |
Static Protected Attributes | |
| static double | g_d [N] |
| static float | g_f [N] |
| static long double | g_ld [N] |
Friends | |
| Vector< T, N > | operator* (T s, Vector< T, N > const &v) |
| Vector< T, N > | operator* (T s, Vector< T, N > const &v) |
| std::ostream & | operator<< (std::ostream &output, Vector< T, N > const &v) |
| std::ostream & | operator<< (std::ostream &output, Vector< T, N > const &v) |
Definition at line 18 of file TAPsVector.hpp.
Definition at line 26 of file TAPsVector.cpp.
00027 { 00028 for ( int i = 0; i < N; ++i ) 00029 t[i] = Math<T>::ZERO; 00030 }
Definition at line 33 of file TAPsVector.cpp.
00034 { 00035 for ( int i = 0; i < N; ++i ) 00036 t[i] = af[i]; 00037 }
Definition at line 260 of file TAPsVector.cpp.
00261 { 00262 T f = Math<T>::ZERO; 00263 for ( int i = 0; i < N; ++i ) f += t[i]*v.t[i]; 00264 return f; 00265 }
| double * Vector< T, N >::GetDataDouble | ( | ) | [inline] |
Definition at line 312 of file TAPsVector.cpp.
00313 { 00314 for ( int i = 0; i < N; ++i ) { 00315 g_d[i] = static_cast<double>( t[i] ); 00316 } 00317 return g_d; 00318 }
| const double * Vector< T, N >::GetDataDouble | ( | ) | const [inline] |
Definition at line 285 of file TAPsVector.cpp.
00286 { 00287 for ( int i = 0; i < N; ++i ) { 00288 g_d[i] = static_cast<double>( t[i] ); 00289 } 00290 return g_d; 00291 }
| float * Vector< T, N >::GetDataFloat | ( | ) | [inline] |
Definition at line 303 of file TAPsVector.cpp.
00304 { 00305 for ( int i = 0; i < N; ++i ) { 00306 g_f[i] = static_cast<float>( t[i] ); 00307 } 00308 return g_f; 00309 }
| const float * Vector< T, N >::GetDataFloat | ( | ) | const [inline] |
Definition at line 276 of file TAPsVector.cpp.
00277 { 00278 for ( int i = 0; i < N; ++i ) { 00279 g_f[i] = static_cast<float>( t[i] ); 00280 } 00281 return g_f; 00282 }
| long double * Vector< T, N >::GetDataLongDouble | ( | ) | [inline] |
Definition at line 321 of file TAPsVector.cpp.
00322 { 00323 for ( int i = 0; i < N; ++i ) { 00324 g_ld[i] = static_cast<long double>( t[i] ); 00325 } 00326 return g_ld; 00327 }
| const long double * Vector< T, N >::GetDataLongDouble | ( | ) | const [inline] |
Definition at line 294 of file TAPsVector.cpp.
00295 { 00296 for ( int i = 0; i < N; ++i ) { 00297 g_ld[i] = static_cast<long double>( t[i] ); 00298 } 00299 return g_ld; 00300 }
| Vector<T,N> Vector< T, N >::GetUnit | ( | T | tolerance = TAPs::Math< T >::EPSILON |
) | const [inline] |
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
| Vector< T, N > Vector< T, N >::GetUnit | ( | T | tolerance = Math<T>::EPSILON |
) | const [inline] |
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
Definition at line 237 of file TAPsVector.cpp.
00238 { 00239 T fLength = Vector<T,N>::Length(); 00240 Vector<T,N> retVector; 00241 if ( fLength > tolerance ) 00242 for ( int i = 0; i < N; ++i ) retVector.t[i] = t[i] / fLength; 00243 else 00244 for ( int i = 0; i < N; ++i ) retVector.t[i] = Math<T>::ZERO; 00245 return retVector; 00246 }
| T Vector< T, N >::Length | ( | ) | const [inline] |
Reimplemented in Vector2< T >, Vector3< T >, Vector4< T >, Vector3< int >, and Vector4< int >.
| T Vector< T, N >::Length | ( | ) | const [inline] |
Reimplemented in Vector2< T >, Vector3< T >, Vector4< T >, Vector3< int >, and Vector4< int >.
Definition at line 215 of file TAPsVector.cpp.
00216 { 00217 T f = Math<T>::ZERO; 00218 for ( int i = 0; i < N; ++i ) f += t[i]*t[i]; 00219 return Math<T>::Sqrt( f ); 00220 }
| T Vector< T, N >::Magnitude | ( | ) | const [inline] |
Reimplemented in Vector2< T >, Vector3< T >, Vector4< T >, Vector3< int >, and Vector4< int >.
Definition at line 223 of file TAPsVector.cpp.
00224 { 00225 return Length(); 00226 }
| Vector<T,N>& Vector< T, N >::Normalized | ( | T | tolerance = TAPs::Math< T >::EPSILON |
) | [inline] |
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
| Vector< T, N > & Vector< T, N >::Normalized | ( | T | tolerance = Math<T>::EPSILON |
) | [inline] |
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
Definition at line 249 of file TAPsVector.cpp.
00250 { 00251 T fLength = Vector<T,N>::Length(); 00252 if ( fLength > tolerance ) 00253 for ( int i = 0; i < N; ++i ) t[i] /= fLength; 00254 else 00255 for ( int i = 0; i < N; ++i ) t[i] = Math<T>::ZERO; 00256 return *this; 00257 }
| Vector< T, N >::operator const T * | ( | ) | const [inline] |
| Vector< T, N >::operator T * | ( | ) | [inline] |
| bool Vector< T, N >::operator!= | ( | Vector< T, N > const & | v | ) | const [inline] |
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
Definition at line 159 of file TAPsVector.cpp.
00160 { 00161 Vector<T,N> retVector; 00162 for ( int i = 0; i < N; ++i ) retVector.t[i] = t[i] * s; 00163 return retVector; 00164 }
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
Definition at line 195 of file TAPsVector.cpp.
00196 { 00197 for ( int i = 0; i < N; ++ i ) t[i] *= s; 00198 return *this; 00199 }
| Vector<T,N> Vector< T, N >::operator+ | ( | Vector< T, N > const & | v | ) | const [inline] |
| Vector< T, N > Vector< T, N >::operator+ | ( | Vector< T, N > const & | v | ) | const [inline] |
Definition at line 143 of file TAPsVector.cpp.
00144 { 00145 Vector<T,N> retVector; 00146 for ( int i = 0; i < N; ++i ) retVector.t[i] = t[i] + v.t[i]; 00147 return retVector; 00148 }
| Vector<T,N>& Vector< T, N >::operator+= | ( | Vector< T, N > const & | v | ) | [inline] |
| Vector< T, N > & Vector< T, N >::operator+= | ( | Vector< T, N > const & | v | ) | [inline] |
| Vector<T,N> Vector< T, N >::operator- | ( | Vector< T, N > const & | v | ) | const [inline] |
Reimplemented in Vector2< T >, Vector3< T >, Vector4< T >, Vector3< int >, and Vector4< int >.
| Vector< T, N > Vector< T, N >::operator- | ( | Vector< T, N > const & | v | ) | const [inline] |
Definition at line 151 of file TAPsVector.cpp.
00152 { 00153 Vector<T,N> retVector; 00154 for ( int i = 0; i < N; ++i ) retVector.t[i] = t[i] - v.t[i]; 00155 return retVector; 00156 }
Reimplemented in Vector2< T >, Vector3< T >, Vector4< T >, Vector3< int >, and Vector4< int >.
Definition at line 135 of file TAPsVector.cpp.
00136 { 00137 Vector<T,N> retVector; 00138 for ( int i = 0; i < N; ++i ) retVector.t[i] = -t[i]; 00139 return retVector; 00140 }
| Vector<T,N>& Vector< T, N >::operator-= | ( | Vector< T, N > const & | v | ) | [inline] |
| Vector< T, N > & Vector< T, N >::operator-= | ( | Vector< T, N > const & | v | ) | [inline] |
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
Definition at line 167 of file TAPsVector.cpp.
00168 { 00169 Vector<T,N> retVector; 00170 if ( s != Math<T>::ZERO ) 00171 for ( int i = 0; i < N; ++i ) retVector.t[i] = t[i] / s; 00172 else 00173 for ( int i = 0; i < N; ++i ) retVector.t[i] = Math<T>::INFINITY; 00174 return retVector; 00175 }
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
Reimplemented in Vector2< T >, Vector3< T >, and Vector4< T >.
Definition at line 202 of file TAPsVector.cpp.
00203 { 00204 if ( s != Math<T>::ZERO ) 00205 for ( int i = 0; i < N; ++ i ) t[i] /= s; 00206 else 00207 for ( int i = 0; i < N; ++ i ) t[i] = Math<T>::INFINITY; 00208 return *this; 00209 }
| bool Vector< T, N >::operator< | ( | Vector< T, N > const & | v | ) | const [inline] |
| bool Vector< T, N >::operator<= | ( | Vector< T, N > const & | v | ) | const [inline] |
| bool Vector< T, N >::operator<= | ( | Vector< T, N > const & | v | ) | const [inline] |
Definition at line 108 of file TAPsVector.cpp.
00109 { 00110 for ( int i = 0; i < N; ++i ) 00111 if ( t[i] > v.t[i] ) return false; 00112 return true; 00113 }
| Vector<T,N>& Vector< T, N >::operator= | ( | Vector< T, N > const & | v | ) | [inline] |
| Vector< T, N > & Vector< T, N >::operator= | ( | Vector< T, N > const & | v | ) | [inline] |
Definition at line 84 of file TAPsVector.cpp.
00085 { 00086 if ( this != &v ) 00087 { 00088 for ( int i = 0; i < N; ++i ) t[i] = v.t[i]; 00089 } 00090 return *this; 00091 }
| bool Vector< T, N >::operator== | ( | Vector< T, N > const & | v | ) | const [inline] |
| bool Vector< T, N >::operator== | ( | Vector< T, N > const & | v | ) | const [inline] |
Definition at line 96 of file TAPsVector.cpp.
00097 { 00098 for ( int i = 0; i < N; ++i ) 00099 if ( t[i] != v.t[i] ) return false; 00100 return true; 00101 }
| bool Vector< T, N >::operator> | ( | Vector< T, N > const & | v | ) | const [inline] |
| bool Vector< T, N >::operator>= | ( | Vector< T, N > const & | v | ) | const [inline] |
| bool Vector< T, N >::operator>= | ( | Vector< T, N > const & | v | ) | const [inline] |
Definition at line 120 of file TAPsVector.cpp.
00121 { 00122 for ( int i = 0; i < N; ++i ) 00123 if ( t[i] < v.t[i] ) return false; 00124 return true; 00125 }
| T const& Vector< T, N >::operator[] | ( | int | i | ) | const [inline] |
Reimplemented in Point3< T >.
| T& Vector< T, N >::operator[] | ( | int | i | ) | [inline] |
Reimplemented in Point3< T >.
| T const & Vector< T, N >::operator[] | ( | int | i | ) | const [inline] |
Reimplemented in Point3< T >.
Definition at line 57 of file TAPsVector.cpp.
00058 { 00059 assert( 0 <= i && i < N ); 00060 return t[i]; 00061 }
| T & Vector< T, N >::operator[] | ( | int | i | ) | [inline] |
Reimplemented in Point3< T >.
Definition at line 50 of file TAPsVector.cpp.
00051 { 00052 assert( 0 <= i && i < N ); 00053 return t[i]; 00054 }
| int Vector< T, N >::Size | ( | ) | const [inline] |
| T Vector< T, N >::SquaredLength | ( | ) | const [inline] |
Reimplemented in Vector2< T >, Vector3< T >, Vector4< T >, Vector3< int >, and Vector4< int >.
| T Vector< T, N >::SquaredLength | ( | ) | const [inline] |
Reimplemented in Vector2< T >, Vector3< T >, Vector4< T >, Vector3< int >, and Vector4< int >.
Definition at line 229 of file TAPsVector.cpp.
00230 { 00231 T f = Math<T>::ZERO; 00232 for ( int i = 0; i < N; ++i ) f += t[i]*t[i]; 00233 return f; 00234 }
| std::ostream& operator<< | ( | std::ostream & | output, | |
| Vector< T, N > const & | v | |||
| ) | [friend] |
Definition at line 27 of file TAPsPoint_.hpp.
00028 { 00029 //output << typeid(*this).name() << "( "; 00030 output << "Vector<" << typeid(T).name() << "," << N << ">( "; 00031 int i; 00032 for ( i = 0; i < N-1; ++i ) 00033 { 00034 output << v.t[i] << ", "; 00035 } 00036 output << v.t[i] << " )'"; //<< std::endl; 00037 return output; 00038 }
| std::ostream& operator<< | ( | std::ostream & | output, | |
| Vector< T, N > const & | v | |||
| ) | [friend] |
Definition at line 32 of file TAPsVector.hpp.
00033 { 00034 //output << typeid(*this).name() << "( "; 00035 output << "Vector<" << typeid(T).name() << "," << N << ">( "; 00036 int i; 00037 for ( i = 0; i < N-1; ++i ) 00038 { 00039 output << v.t[i] << ", "; 00040 } 00041 output << v.t[i] << " )'"; //<< std::endl; 00042 return output; 00043 }
Definition at line 26 of file TAPsVector.hpp.
BEGIN_NAMESPACE_TAPs float Vector< T, N >::g_f [inline, static, protected] |
Definition at line 25 of file TAPsVector.hpp.
Definition at line 27 of file TAPsVector.hpp.
Definition at line 22 of file TAPsVector.hpp.
1.5.6