Changeset 178 for cpp/frams/genetics/fF/conv_fF.cpp
- Timestamp:
- 03/17/14 00:57:50 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/fF/conv_fF.cpp
r177 r178 16 16 cosines = new double[fF_LATITUDE_NUM]; 17 17 sines = new double[fF_LATITUDE_NUM]; 18 fill_cos_and_sin();18 precompute_cos_and_sin(); 19 19 } 20 20 … … 159 159 pun = find_hole(which, pzx, pzy, pzz, chambers, kx_, ky_, kz_); 160 160 161 chambers[which]->holeX = (float)chambers[which]->points[pun] [0];162 chambers[which]->holeY = (float)chambers[which]->points[pun] [1];163 chambers[which]->holeZ = (float)chambers[which]->points[pun] [2];164 } 165 } 166 167 void GenoConv_fF0:: fill_cos_and_sin()161 chambers[which]->holeX = (float)chambers[which]->points[pun].x; 162 chambers[which]->holeY = (float)chambers[which]->points[pun].y; 163 chambers[which]->holeZ = (float)chambers[which]->points[pun].z; 164 } 165 } 166 167 void GenoConv_fF0::precompute_cos_and_sin() 168 168 { 169 169 int i; … … 177 177 } 178 178 179 double** GenoConv_fF0::generate_points(fF_chamber3d *chamber, int which, double kx_, double ky_, double kz_)179 fF_point* GenoConv_fF0::generate_points(fF_chamber3d *chamber, int which, double kx_, double ky_, double kz_) 180 180 { 181 181 float radius = chamber->radius; … … 210 210 double rz = all_k_ones ? radius : kz; 211 211 212 double **points = new double*[fF_SIZE]; 213 for (int i = 0; i < fF_SIZE; i++) 214 { 215 points[i] = new double[4]; 216 } 212 fF_point *points = new fF_point[fF_SIZE]; 217 213 218 214 for (int i = 0; i < fF_LONGITUDE_NUM; i++) … … 224 220 double x = cenx + rx * cosines[j] * sines[i]; 225 221 double z = cenz + rz * sines[j] * sines[i]; 226 double *p = points[(i * fF_LATITUDE_NUM) + j];227 p [0]= x;228 p [1]= y;229 p [2]= z;230 p [3] = 1.0;222 fF_point &p = points[(i * fF_LATITUDE_NUM) + j]; 223 p.x = x; 224 p.y = y; 225 p.z = z; 226 p.inside = false; 231 227 232 228 if (x < minX) minX = x; … … 267 263 for (int j = 0; j < fF_AMOUNT; j++) 268 264 { 269 double *p = spheres[nr]->points[j]; 270 double X = p[0]; 271 double Y = p[1]; 272 double Z = p[2]; 273 274 double up1 = (X - srX0) * (X - srX0); 275 double up2 = (Y - srY0) * (Y - srY0); 276 double up3 = (Z - srZ0) * (Z - srZ0); 265 fF_point &p = spheres[nr]->points[j]; 266 267 double up1 = (p.x - srX0) * (p.x - srX0); 268 double up2 = (p.y - srY0) * (p.y - srY0); 269 double up3 = (p.z - srZ0) * (p.z - srZ0); 277 270 278 271 double exp1 = up1 / a2; … … 284 277 if (result < fF_THICK_RATIO) 285 278 { 286 p [3] = 0.0;279 p.inside = true; 287 280 } 288 281 } … … 301 294 for (int i = 0; i < fF_AMOUNT; i++) 302 295 { 303 double *p = chambers[which]->points[i];304 if ( p[3] != 0) //it is not inside another chamber305 { 306 double distancesq = (p [0] - x)*(p[0] - x) + (p[1] - y)*(p[1] - y) + (p[2] - z)*(p[2]- z);296 fF_point &p = chambers[which]->points[i]; 297 if (!p.inside) //it is not inside another chamber 298 { 299 double distancesq = (p.x - x)*(p.x - x) + (p.y - y)*(p.y - y) + (p.z - z)*(p.z - z); 307 300 if (found < 0) 308 301 { … … 314 307 if (which != 0) 315 308 { 316 double X = p[0];317 double Y = p[1];318 double Z = p[2];319 309 bool good = true; 320 310 for (int j = 0; j < which && good; j++) … … 330 320 double c2 = kzsq * radsq; 331 321 332 double up1 = ( X - srX0) * (X- srX0);333 double up2 = ( Y - srY0) * (Y- srY0);334 double up3 = ( Z - srZ0) * (Z- srZ0);322 double up1 = (p.x - srX0) * (p.x - srX0); 323 double up2 = (p.y - srY0) * (p.y - srY0); 324 double up3 = (p.z - srZ0) * (p.z - srZ0); 335 325 336 326 double exp1 = up1 / a2;
Note: See TracChangeset
for help on using the changeset viewer.