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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #include "Posture.h"
00046
00047 Posture::Posture(unsigned int ID, unsigned int num)
00048 {
00049 postureID = ID;
00050 numNodes = num;
00051
00052 nodePs = new Coord[numNodes];
00053 nodeRadius = new double[numNodes];
00054 nodeSpeed = new double[numNodes];
00055
00056 alphaMean = new double*[numNodes];
00057 for (unsigned int i=0;i<numNodes;++i)
00058 alphaMean[i] = new double[numNodes];
00059
00060 alphaSD = new double*[numNodes];
00061 for (unsigned int i=0;i<numNodes;++i)
00062 alphaSD[i] = new double[numNodes];
00063 }
00064
00065 bool Posture::setPs(unsigned int i , Coord ps)
00066 {
00067 if (i<numNodes){
00068 nodePs[i] = ps;
00069 return true;
00070 }
00071 return false;
00072 }
00073
00074 bool Posture::setPostureName(char *str)
00075 {
00076 strcpy(posture_name,str);
00077 return true;
00078 }
00079
00080
00081 bool Posture::setAlphaMean(unsigned int i, unsigned int j, double alpha_mean)
00082 {
00083 if (i<numNodes && j<numNodes){
00084 alphaMean[i][j] = alpha_mean;
00085 return true;
00086 }
00087 return false;
00088 }
00089
00090 bool Posture::setAlphaSD(unsigned int i, unsigned int j, double alpha_sd)
00091 {
00092 if (i<numNodes && j<numNodes){
00093 alphaSD[i][j] = alpha_sd;
00094 return true;
00095 }
00096 return false;
00097 }
00098
00099 bool Posture::setRadius(unsigned int i, double radius)
00100 {
00101 if (i<numNodes){
00102 nodeRadius[i] = radius;
00103 return true;
00104 }
00105 return false;
00106 }
00107
00108 bool Posture::setSpeed(unsigned int i , double speed)
00109 {
00110 if (i<numNodes){
00111 nodeSpeed[i] = speed;
00112 return true;
00113 }
00114 return false;
00115 }
00116
00117 bool Posture::setPostureSpeed(double min, double max)
00118 {
00119 if (max < min)
00120 return false;
00121
00122 postureMaxSpeed = max;
00123 postureMinSpeed = min;
00124 return true;
00125 }
00126
00127 Coord Posture::getPs(unsigned int i)
00128 {
00129 if (i<numNodes)
00130 return nodePs[i];
00131
00132 return Coord(-1,-1,-1);
00133 }
00134
00135 double Posture::getAlphaMean(unsigned int i, unsigned int j)
00136 {
00137 if (i<numNodes && j<numNodes)
00138 return alphaMean[i][j];
00139
00140 return -1;
00141 }
00142
00143 double Posture::getAlphaSD(unsigned int i, unsigned int j)
00144 {
00145 if (i<numNodes && j<numNodes)
00146 return alphaSD[i][j];
00147
00148 return -1;
00149 }
00150
00151 double Posture::getRadius(unsigned int i)
00152 {
00153 if (i<numNodes)
00154 return nodeRadius[i];
00155
00156 return -1;
00157 }
00158
00159 double Posture::getSpeed(unsigned int i)
00160 {
00161 if (i<numNodes)
00162 return nodeSpeed[i];
00163
00164 return -1;
00165 }
00166
00167 char* Posture::getPostureName()
00168 {
00169 return posture_name;
00170 }
00171
00172 int Posture::getPostureID()
00173 {
00174 return postureID;
00175 }
00176
00177 double Posture::getMaxSpeed()
00178 {
00179 return postureMaxSpeed;
00180 }
00181
00182 double Posture::getMinSpeed()
00183 {
00184 return postureMinSpeed;
00185 }
00186
00187 bool Posture::isMobile()
00188 {
00189 return postureMaxSpeed > 0;
00190 }