Found a problem with the calculation for the non-Euclidean grow/

shrink routine that over-computes the diagonal position (the
equation failed to divide the intersecting angle in half).
Rewrote the equation for the correct grow distance, still
accounting for the grid limit (if set).
This commit is contained in:
Tim Edwards 2022-04-19 18:20:58 -04:00
parent 62df377ba8
commit 30ab57ee79
2 changed files with 9 additions and 5 deletions

View File

@ -1 +1 @@
8.3.291
8.3.292

View File

@ -585,7 +585,7 @@ cifGrowEuclideanFunc(tile, table)
{
int growDistanceX, growDistanceY;
int height, width;
double hyp;
double frac, ratio;
int limit;
if (oldType & TT_SIDE)
@ -605,9 +605,13 @@ cifGrowEuclideanFunc(tile, table)
width = area.r_xtop - area.r_xbot;
height = area.r_ytop - area.r_ybot;
hyp = sqrt((double)(width * width + height * height));
growDistanceY = ceil((double)(growDistance * width) / hyp);
growDistanceX = ceil((double)(growDistance * height) / hyp);
ratio = (double)height / (double)width;
frac = ratio / (1 + sqrt(1 + ratio * ratio));
growDistanceX = ceil((double)growDistance * frac);
ratio = (double)width / (double)height;
frac = ratio / (1 + sqrt(1 + ratio * ratio));
growDistanceY = ceil((double)growDistance * frac);
/* Adjust for grid limit */
growDistanceX = SetValueGrid(growDistanceX);