** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: phantom.cpp,v 1.20 2000/12/04 05:36:57 kevin Exp $
+** $Id: phantom.cpp,v 1.23 2000/12/21 03:40:58 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
#include "ct.h"
-const int Phantom::POINTS_PER_CIRCLE = 360;\r
-const double Phantom::SCALE_PELEM_EXTENT=0.005; // increase pelem limits by 0.5% \r
+const int PhantomElement::POINTS_PER_CIRCLE = 360;\r
+const double PhantomElement::SCALE_PELEM_EXTENT=0.005; // increase pelem limits by 0.5% \r
const int Phantom::PHM_INVALID = -1;
const int Phantom::PHM_HERMAN = 0;
show (sgp);
- cout << "Press return to continue";
+ std::cout << "Press return to continue";
cio_kb_getc();
}
for (int iy = 0; iy < ny; iy++) {
int iColStore = ix;
if (bStoreAtColumnPos)
- iColStore += colStart;
+ iColStore += colStart;
v[iColStore][iy] = 0;
}
for (kx = 0, xi = x + kxofs; kx < nsample; kx++, xi += kxinc) {
for (ky = 0, yi = y + kyofs; ky < nsample; ky++, yi += kyinc)
if (rPElem.isPointInside (xi, yi, PHM_COORD) == TRUE)
- v[iColStore][iy] += rPElem.atten();
+ v[iColStore][iy] += rPElem.atten();
} // for kx
} /* for iy */
} /* for ix */
if (nsample > 1) {
- double factor = 1.0 / (nsample * nsample);
-
- for (int ix = 0; ix < colCount; ix++)
- for (int iy = 0; iy < ny; iy++)
- v[ix][iy] *= factor;
+ double factor = 1.0 / static_cast<double>(nsample * nsample);
+
+\r
+ for (int ix = 0; ix < colCount; ix++) {
+ int iColStore = ix;\r
+ if (bStoreAtColumnPos)\r
+ iColStore += colStart;\r
+ for (int iy = 0; iy < ny; iy++)
+ v[iColStore][iy] *= factor;\r
+ }
}
}