Index: trunk/src/libgrbs/route_remove.c =================================================================== --- trunk/src/libgrbs/route_remove.c (revision 1310) +++ trunk/src/libgrbs/route_remove.c (revision 1311) @@ -38,24 +38,33 @@ above-arcs lower (by exactly as much as twonet tn took) */ static double shrink_seg_radii_any(grbs_t *grbs, grbs_arc_t *arc, int *need_narc_post_update, double *narc_oldr_out, int is_concave) { - grbs_arc_t *next; + grbs_arc_t *next, *prev; double prev_copper, prev_clearance, newr, incr, prevr; - double narc_oldr = 0, narcr = arc->new_r; + double narc_oldr = 0, narcr; + prev = grbs_prev_arc_in_use(arc); + /* simple case: either convex or concave without convex segments below: previous radius:copper:clearance is the same-segment arc below or the point */ - if (!arc->in_use) { + if ((!arc->in_use) || (prev == NULL)) { prev_copper = arc->parent_pt->copper; prev_clearance = arc->parent_pt->clearance; prevr = 0; } else { - prev_copper = arc->copper; - prev_clearance = arc->clearance; - prevr = arc->r; + prev_copper = prev->copper; + prev_clearance = prev->clearance; + prevr = prev->r; } + next = grbs_next_arc_in_use(arc); + if (next == NULL) { + *narc_oldr_out = 0; + return narcr; + } + narcr = next->r; + /* when removing a concave on bottom it's radius may depend on any convex region that overlaps with ours */ if (is_concave && (arc->link_point.prev == NULL)) { @@ -67,11 +76,6 @@ narcr = hnewr; } - next = grbs_next_arc_in_use(arc); - if (next == NULL) { - *narc_oldr_out = 0; - return narcr; - } newr = prevr + prev_copper + next->copper + GRBS_MAX(prev_clearance, next->clearance); /* new arc added on top of the previous */ tprintf("remove: newr=%f != %f (prev=%f/%f next=%f/%f)\n", newr, narcr, prev_copper, prev_clearance, next->copper, next->clearance);