Index: autoplace.c =================================================================== --- autoplace.c (revision 31019) +++ autoplace.c (revision 31020) @@ -111,8 +111,8 @@ 0.75, /* annealing schedule constant: 0.85 */ 40, /* halt when there are 60 times as many moves as good moves */ rnd_false, /* don't ignore SMD/pin conflicts */ - PCB_MIL_TO_COORD(100), /* coarse grid is 100 mils */ - PCB_MIL_TO_COORD(10), /* fine grid is 10 mils */ + RND_MIL_TO_COORD(100), /* coarse grid is 100 mils */ + RND_MIL_TO_COORD(10), /* fine grid is 10 mils */ }; enum ewhich { SHIFT, ROTATE, EXCHANGE }; @@ -363,7 +363,7 @@ allsameside = rnd_false; } /* okay, add half-perimeter to cost! */ - W += PCB_COORD_TO_MIL(maxx - minx) + PCB_COORD_TO_MIL(maxy - miny) + ((allpads && !allsameside) ? CostParameter.via_cost : 0); + W += RND_COORD_TO_MIL(maxx - minx) + RND_COORD_TO_MIL(maxy - miny) + ((allpads && !allsameside) ? CostParameter.via_cost : 0); } } @@ -548,7 +548,7 @@ } PCB_END_LOOP; if (minX < maxX && minY < maxY) - delta5 = CostParameter.overall_area_penalty * sqrt(PCB_COORD_TO_MIL(maxX - minX) * PCB_COORD_TO_MIL(maxY - minY)); + delta5 = CostParameter.overall_area_penalty * sqrt(RND_COORD_TO_MIL(maxX - minX) * RND_COORD_TO_MIL(maxY - minY)); } if (T == 5) { T = W + delta1 + delta2 + delta3 - delta4 + delta5; @@ -603,13 +603,13 @@ case 0: { /* shift! */ rnd_coord_t grid; - double scaleX = RND_CLAMP(sqrt(T), PCB_MIL_TO_COORD(2.5), PCB->hidlib.size_x / 3); - double scaleY = RND_CLAMP(sqrt(T), PCB_MIL_TO_COORD(2.5), PCB->hidlib.size_y / 3); + double scaleX = RND_CLAMP(sqrt(T), RND_MIL_TO_COORD(2.5), PCB->hidlib.size_x / 3); + double scaleY = RND_CLAMP(sqrt(T), RND_MIL_TO_COORD(2.5), PCB->hidlib.size_y / 3); pt.which = SHIFT; pt.DX = scaleX * 2 * ((((double) rnd_rand()) / RAND_MAX) - 0.5); pt.DY = scaleY * 2 * ((((double) rnd_rand()) / RAND_MAX) - 0.5); /* snap to grid. different grids for "high" and "low" T */ - grid = (T > PCB_MIL_TO_COORD(10)) ? CostParameter.large_grid_size : CostParameter.small_grid_size; + grid = (T > RND_MIL_TO_COORD(10)) ? CostParameter.large_grid_size : CostParameter.small_grid_size; /* (round away from zero) */ pt.DX = ((pt.DX / grid) + SGN(pt.DX)) * grid; pt.DY = ((pt.DY / grid) + SGN(pt.DY)) * grid; @@ -749,12 +749,12 @@ /* simulated annealing */ { /* compute T0 by doing a random series of moves. */ const int TRIALS = 10; - const double Tx = PCB_MIL_TO_COORD(300), P = 0.95; + const double Tx = RND_MIL_TO_COORD(300), P = 0.95; double Cs = 0.0; int i; C00 = C0 = ComputeCost(Tx, Tx); for (i = 0; i < TRIALS; i++) { - pt = createPerturbation(&Selected, PCB_INCH_TO_COORD(1)); + pt = createPerturbation(&Selected, RND_INCH_TO_COORD(1)); doPerturb(&Selected, &pt, rnd_false); Cs += fabs(ComputeCost(Tx, Tx) - C0); doPerturb(&Selected, &pt, rnd_true);