Listing 3: Rewriting the accumulation loop.
x -= dx/2; y -= dy/2; for (thetaIndex=0; thetaIndex<cosTable.size(); thetaIndex++) { rho = rhoMax + x*cosTable[thetaIndex] + y*sinTable[thetaIndex]; rho >>= 1; // represents a rhoDivisor of 2 accum[thetaIndex][(int)rho]++; }