00001 00002 #include <blort/Tracker/Particle.h> 00003 00004 using namespace Tracking; 00005 using namespace TomGine; 00006 00007 Particle::Particle(float val){ 00008 t.x = val; 00009 t.y = val; 00010 t.z = val; 00011 r.x = val; 00012 r.y = val; 00013 r.z = val; 00014 00015 z = val; 00016 00017 w = val; 00018 c = val; 00019 00020 q = tgQuaternion(); 00021 } 00022 00023 Particle::Particle( vec3 t, 00024 vec3 r, 00025 float z, 00026 float w, float c, 00027 TomGine::tgQuaternion q) 00028 { 00029 this->t = t; 00030 this->r = r; 00031 this->z = z; 00032 00033 this->w = w; 00034 this->c = c; 00035 00036 this->q = q; 00037 } 00038 00039 Particle::Particle(const Particle& p2){ 00040 t.x = p2.t.x; 00041 t.y = p2.t.y; 00042 t.z = p2.t.z; 00043 r.x = p2.r.x; 00044 r.y = p2.r.y; 00045 r.z = p2.r.z; 00046 00047 z = p2.z; 00048 00049 userData = p2.userData; 00050 00051 w = p2.w; 00052 c = p2.c; 00053 00054 q = p2.q; 00055 } 00056 00057 Particle::Particle(const tgPose& p2){ 00058 t = p2.t; 00059 r.x = 0.0; 00060 r.y = 0.0; 00061 r.z = 0.0; 00062 00063 z = 0.0; 00064 00065 w = 0.0; 00066 c = 0.0; 00067 00068 q = p2.q; 00069 } 00070 00071 Particle& Particle::operator=(const Particle& p2){ 00072 t.x = p2.t.x; 00073 t.y = p2.t.y; 00074 t.z = p2.t.z; 00075 r.x = p2.r.x; 00076 r.y = p2.r.y; 00077 r.z = p2.r.z; 00078 z = p2.z; 00079 00080 userData = p2.userData; 00081 00082 w = p2.w; 00083 c = p2.c; 00084 00085 q = p2.q; 00086 00087 return *this; 00088 } 00089 00090 Particle& Particle::operator=(const tgPose& p2){ 00091 t = p2.t; 00092 r.x = 0.0; 00093 r.y = 0.0; 00094 r.z = 0.0; 00095 00096 z = 0.0; 00097 00098 w = 0.0; 00099 c = 0.0; 00100 00101 q = p2.q; 00102 00103 return *this; 00104 } 00105 00106 Particle Particle::operator*(const float &f) const{ 00107 Particle p; 00108 p.r = r * f; 00109 p.t = t * f; 00110 p.z = z * f; 00111 00112 return p; 00113 } 00114 00115 Particle Particle::operator+(const Particle &p) const{ 00116 Particle res; 00117 res.t = t + p.t; 00118 res.q = q + p.q; 00119 res.r = r + p.r; 00120 res.z = z + p.z; 00121 res.w = w + p.w; 00122 res.c = c + p.c; 00123 return res; 00124 } 00125 00126 Particle Particle::operator-(const Particle &p) const{ 00127 Particle res; 00128 res.t = t - p.t; 00129 res.q = q - p.q; 00130 res.r = r - p.r; 00131 res.z = z - p.z; 00132 res.w = w - p.w; 00133 res.c = c - p.c; 00134 return res; 00135 }