00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_VECTOR_2_H_
00028 #define CEYLAN_VECTOR_2_H_
00029
00030
00031 #include "CeylanVector.h"
00032 #include "CeylanLinear.h"
00033
00034 #include <string>
00035
00036
00037
00038
00039 namespace Ceylan
00040 {
00041
00042
00043 namespace Maths
00044 {
00045
00046
00047 namespace Linear
00048 {
00049
00050
00051
00052
00053 class Bipoint ;
00054
00055
00056
00057 class Matrix2 ;
00058
00059
00060
00061 class HomogeneousMatrix3 ;
00062
00063
00064
00072 class CEYLAN_DLL Vector2: public Vector
00073 {
00074
00075
00076
00077
00078
00080 friend class Bipoint ;
00081
00082
00084 friend class Matrix2 ;
00085
00086
00087
00092 CEYLAN_DLL friend bool operator == ( const Vector2 & v1,
00093 const Vector2 & v2 ) ;
00094
00095
00096
00102 CEYLAN_DLL friend bool operator != ( const Vector2 & v1,
00103 const Vector2 & v2 ) ;
00104
00105
00106
00112 CEYLAN_DLL friend Bipoint operator + ( const Bipoint & t,
00113 const Vector2 & v ) ;
00114
00115
00116
00122 CEYLAN_DLL friend Bipoint operator - ( const Bipoint & t,
00123 const Vector2 & v ) ;
00124
00125
00126
00132 CEYLAN_DLL friend Vector2 vectorize( const Bipoint & t ) ;
00133
00134
00135
00141 CEYLAN_DLL friend Vector2 vectorize( const Bipoint & t1,
00142 const Bipoint & t2 ) ;
00143
00144
00145
00150 CEYLAN_DLL friend Vector2 operator + ( const Vector2 & v1,
00151 const Vector2 & v2 ) ;
00152
00153
00154
00159 CEYLAN_DLL friend Vector2 operator - ( const Vector2 & v1,
00160 const Vector2 & v2 ) ;
00161
00162
00163
00169 CEYLAN_DLL friend Vector2 operator * ( Real lambda,
00170 const Vector2 & v ) ;
00171
00172
00173
00179 CEYLAN_DLL friend Vector2 operator * ( const Matrix2 & m,
00180 const Vector2 & v ) ;
00181
00182
00183
00189 CEYLAN_DLL friend Vector2 operator * (
00190 const HomogeneousMatrix3 & m, const Vector2 & v ) ;
00191
00192
00193
00199 CEYLAN_DLL friend Real operator | ( const Vector2 & v1,
00200 const Vector2 & v2 ) ;
00201
00202
00203
00204
00205
00206
00208 CEYLAN_DLL friend Real operator ~ ( const Vector2 & v ) ;
00209
00210
00211
00212
00213 public:
00214
00215
00216
00224 explicit Vector2( Real x0 = 0, Real x1 = 0 ) ;
00225
00226
00227
00229 virtual ~Vector2() throw() ;
00230
00231
00232
00234 virtual void setTo( Real x0, Real x1 ) ;
00235
00236
00237
00243 virtual void nullify() ;
00244
00245
00246
00252 virtual void setAllElementsTo( Real commonValue ) ;
00253
00254
00255
00257 virtual Real getX() const ;
00258
00259
00260
00262 virtual Real getY() const ;
00263
00264
00265
00274 virtual Real getElementAt( MatrixIndex index ) const ;
00275
00276
00277
00286 virtual void setElementAt( MatrixIndex index,
00287 Real newValue ) ;
00288
00289
00290
00299 virtual void normalize() ;
00300
00301
00302
00309 virtual Real magnitude() const ;
00310
00311
00312
00325 virtual const std::string toString(
00326 VerbosityLevels level = high ) const ;
00327
00328
00329
00334 static const MatrixIndex Dimensions = 2 ;
00335
00336
00337
00338 protected:
00339
00340
00342 Real _vec[ Dimensions ] ;
00343
00344
00345
00346 } ;
00347
00348
00349 }
00350
00351 }
00352
00353 }
00354
00355
00356
00357 #endif // CEYLAN_VECTOR_2_H_
00358