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:
parent
62df377ba8
commit
30ab57ee79
12
cif/CIFgen.c
12
cif/CIFgen.c
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue