00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __CT_VECTOR__
00022 #define __CT_VECTOR__
00023
00024
00025
00026
00027 class ctVector3;
00028 class ctMatrix3;
00029
00030
00031
00032
00033
00034
00035
00036 #include <stdarg.h>
00037 #include <math.h>
00038 #include "csphyzik/phyztype.h"
00039 #include "csphyzik/debug.h"
00040
00041 class ctVectorTranspose3
00042 {
00043 public:
00044 ctVectorTranspose3 ()
00045 { elements[0] = elements[1] = elements[2] = 0.0; }
00046
00047 ctVectorTranspose3 ( real pfirst, real psecond, real pthird )
00048 {
00049 elements[0] = pfirst;
00050 elements[1] = psecond;
00051 elements[2] = pthird;
00052 }
00053
00054 void set ( real pfirst, real psecond, real pthird )
00055 {
00056 elements[0] = pfirst;
00057 elements[1] = psecond;
00058 elements[2] = pthird;
00059 }
00060
00061 void set ( int pnum, real *pele )
00062 {
00063 int idx;
00064 for(idx = 0; idx < pnum; idx++ )
00065 {
00066 elements[idx] = *pele;
00067 pele++;
00068 }
00069 }
00070
00071 void set ( real *pele )
00072 {
00073 int idx;
00074 for (idx = 0; idx < 3; idx++)
00075 {
00076 elements[idx] = *pele;
00077 pele++;
00078 }
00079 }
00080
00081 real operator[] (const int index) const
00082 { return elements[index]; }
00083
00084 real& operator[] (const int index)
00085 { return elements[index]; }
00086
00087 ctVectorTranspose3 operator* ( const real pk )
00088 {
00089 ctVectorTranspose3 scaled;
00090 int idx;
00091 for(idx = 0; idx < 3; idx++ )
00092 scaled.elements[idx] = elements[idx] * pk;
00093 return scaled;
00094 }
00095
00096 void operator*= (const real p)
00097 { int idx; for (idx=0; idx<3; ++idx) elements[idx] *= p; }
00098
00099 void operator/= (const real p)
00100 { int idx; for (idx=0; idx<3; ++idx) elements[idx] /= p; }
00101
00102 real operator* ( const ctVector3 &bs );
00103
00104 protected:
00105 real elements[ 3 ];
00106 };
00107
00108
00109 #include "csgeom/math3d_d.h"
00110 #define ctVector3 csDVector3
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00131
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150 #endif // __CT_VECTOR__