Fixed a bug when displaying rays (they were being offset by 1 on the X axis.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1033 c06c8d41-db1a-0410-9941-cceddc491573
BHG4L3FEW3UDCNBQ4GLEONTAKFIXTRFCLQ2BQ4YNPF3I6NRZXBGQC
for ( xangle = 1; xangle <= LOS_MAX_RANGE; ++xangle )
// Changing the order a bit. We want to order by the complexity
// of the beam, which is log(x) + log(y) ~ xy.
std::vector<std::pair<int,int> > xyangles;
for ( int xangle = 1; xangle <= LOS_MAX_RANGE; ++xangle )
for ( int yangle = 1; yangle <= LOS_MAX_RANGE; ++yangle )
if ( gcd(xangle, yangle) == 1 )
xyangles.push_back(std::pair<int,int>(xangle, yangle));
std::sort( xyangles.begin(), xyangles.end(), complexity_lt );
for ( unsigned int i = 0; i < xyangles.size(); ++i )
for ( yangle = 1; yangle <= LOS_MAX_RANGE; ++yangle )
const int xangle = xyangles[i].first;
const int yangle = xyangles[i].second;
const double slope = ((double)(yangle)) / xangle;
const double rslope = ((double)(xangle)) / yangle;
for ( int intercept = 0; intercept <= yangle; ++intercept )
if ( gcd(xangle, yangle) != 1 )
continue;
const double slope = ((double)(yangle)) / xangle;
const double rslope = ((double)(xangle)) / yangle;
for ( int intercept = 0; intercept <= yangle; ++intercept )
{
double xstart = ((double)(intercept)) / yangle;
if ( intercept == 0 )
xstart += EPSILON_VALUE / 10.0;
if ( intercept == yangle )
xstart -= EPSILON_VALUE / 10.0;
// y should be "about to change"
register_ray( xstart, 1.0 - EPSILON_VALUE / 10.0, slope );
// also draw the identical ray in octant 2
register_ray( 1.0 - EPSILON_VALUE / 10.0, xstart, rslope );
}
double xstart = ((double)(intercept)) / yangle;
if ( intercept == 0 )
xstart += EPSILON_VALUE / 10.0;
if ( intercept == yangle )
xstart -= EPSILON_VALUE / 10.0;
// y should be "about to change"
register_ray( xstart, 1.0 - EPSILON_VALUE / 10.0, slope );
// also draw the identical ray in octant 2
register_ray( 1.0 - EPSILON_VALUE / 10.0, xstart, rslope );