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_3_H_
00028 #define CEYLAN_VECTOR_3_H_
00029
00030 #include "CeylanVector.h"
00031 #include "CeylanLinear.h"
00032
00033 #include <string>
00034
00035
00036
00037 namespace Ceylan
00038 {
00039
00040
00041 namespace Maths
00042 {
00043
00044
00045 namespace Linear
00046 {
00047
00048
00049
00050
00051 class Tripoint ;
00052
00053
00054
00055 class Matrix3 ;
00056
00057
00058
00066 class CEYLAN_DLL Vector3: public Vector
00067 {
00068
00069
00070
00071
00072
00074 friend class Tripoint ;
00075
00076
00078 friend class Matrix3 ;
00079
00080
00081
00086 CEYLAN_DLL friend bool operator == ( const Vector3 & v1,
00087 const Vector3 & v2 ) ;
00088
00089
00090
00095 CEYLAN_DLL friend bool operator != ( const Vector3 & v1,
00096 const Vector3 & v2 ) ;
00097
00098
00099
00104 CEYLAN_DLL friend Tripoint operator + ( const Tripoint & t,
00105 const Vector3 & v ) ;
00106
00107
00108
00114 CEYLAN_DLL friend Tripoint operator - ( const Tripoint & t,
00115 const Vector3 & v ) ;
00116
00117
00118
00124 CEYLAN_DLL friend Vector3 vectorize( const Tripoint & t ) ;
00125
00126
00127
00133 CEYLAN_DLL friend Vector3 vectorize( const Tripoint & t1,
00134 const Tripoint & t2 ) ;
00135
00136
00137
00142 CEYLAN_DLL friend Vector3 operator + ( const Vector3 & v1,
00143 const Vector3 & v2 ) ;
00144
00145
00146
00151 CEYLAN_DLL friend Vector3 operator - ( const Vector3 & v1,
00152 const Vector3 & v2 ) ;
00153
00154
00155
00160 CEYLAN_DLL friend Vector3 operator * ( Real lambda,
00161 const Vector3 & v ) ;
00162
00163
00164
00169 CEYLAN_DLL friend Vector3 operator * ( const Matrix3 & m,
00170 const Vector3 & v ) ;
00171
00172
00173
00179 CEYLAN_DLL friend Real operator | ( const Vector3 & v1,
00180 const Vector3 & v2 ) ;
00181
00182
00188 CEYLAN_DLL friend Vector3 operator ^ ( const Vector3 & v1,
00189 const Vector3 & v2 ) ;
00190
00191
00192
00197 CEYLAN_DLL friend Real operator ~ ( const Vector3 & v ) ;
00198
00199
00200
00201
00202 public:
00203
00204
00212 explicit Vector3( Real x0 = 0, Real x1 = 0, Real x2 = 0 ) ;
00213
00214
00215
00217 virtual ~Vector3() throw() ;
00218
00219
00220
00222 virtual void setTo( Real x0, Real x1, Real x2 ) ;
00223
00224
00225
00231 virtual void nullify() ;
00232
00233
00234
00240 virtual void setAllElementsTo( Real commonValue ) ;
00241
00242
00243
00252 virtual Real getElementAt( MatrixIndex index ) const ;
00253
00254
00255
00264 virtual void setElementAt( MatrixIndex index,
00265 Real newValue ) ;
00266
00267
00268
00277 virtual void normalize() ;
00278
00279
00280
00287 virtual Real magnitude() const ;
00288
00289
00290
00303 virtual const std::string toString(
00304 VerbosityLevels level = high ) const ;
00305
00306
00307
00312 static const MatrixIndex Dimensions = 3 ;
00313
00314
00315
00316
00317 protected:
00318
00319
00321 Real _vec[ Dimensions ] ;
00322
00323
00324
00325 } ;
00326
00327
00328
00329
00330
00331
00332
00333
00334 CEYLAN_DLL Real operator | ( const Vector3 & v1,
00335 const Vector3 & v2 ) ;
00336
00337
00338
00339
00340
00341
00342
00343
00344 CEYLAN_DLL Vector3 operator ^ ( const Vector3 & v1,
00345 const Vector3 & v2 ) ;
00346
00347
00348 }
00349
00350 }
00351
00352 }
00353
00354
00355
00356 #endif // CEYLAN_VECTOR_3_H_
00357