Index: trunk/src/libgrbs/route_remove.c =================================================================== --- trunk/src/libgrbs/route_remove.c (revision 1313) +++ trunk/src/libgrbs/route_remove.c (revision 1314) @@ -109,6 +109,30 @@ #warning TODO: do we need to do anything else? } +/* shrink any concave segment that is in overlap with our convex */ +static void shrink_seg_radii_concave_above_convex(grbs_t *grbs, grbs_arc_t *convex_sentinel) +{ + int conc_segi; + + for(conc_segi = 0; conc_segi < GRBS_MAX_SEG; conc_segi++) { + double newr; + grbs_arc_t *convex_last, *conc_first; + grbs_arc_t *conc_sentinel = gdl_first(&convex_sentinel->parent_pt->arcs[1][conc_segi]); + + if ((conc_sentinel == NULL) || (!grbs_arc_overlaps_arc(convex_sentinel, conc_sentinel))) continue; + + convex_last = gdl_last(&convex_sentinel->parent_pt->arcs[0][convex_sentinel->segi]); + conc_first = conc_sentinel->link_point.next; + + if (conc_first == NULL) + return; /* orphaned concave */ + + newr = convex_last->r + convex_last->copper + conc_first->copper + GRBS_MAX(convex_last->clearance, conc_first->clearance); /* new arc added on top of the previous */ + if (newr < conc_first->r) + bump_seg_radii(grbs, conc_first, newr - conc_first->r); + } +} + void grbs_path_remove_arc(grbs_t *grbs, grbs_arc_t *arc) { grbs_arc_t *narc, *a, *first, *sarc, *sentinel; @@ -115,7 +139,6 @@ int rev = 1, need_narc_post_update = 0; double narc_oldr; grbs_point_t *pt; - int is_concave = arc->concave; if (arc->r == 0) { grbs_path_remove_incident(grbs, arc); @@ -123,12 +146,12 @@ } pt = arc->parent_pt; - first = sentinel = gdl_first(&pt->arcs[is_concave][arc->segi]); + first = sentinel = gdl_first(&pt->arcs[arc->concave][arc->segi]); if (!first->new_in_use) - first = gdl_next(&pt->arcs[is_concave][arc->segi], first); /* for already realized arcs: first is the first above sentinel */ + first = gdl_next(&pt->arcs[arc->concave][arc->segi], first); /* for already realized arcs: first is the first above sentinel */ /* make room for the new arc */ - sarc = shrink_seg_radii_any(grbs, arc, &need_narc_post_update, &narc_oldr, is_concave); + sarc = shrink_seg_radii_any(grbs, arc, &need_narc_post_update, &narc_oldr, arc->concave); if (arc == first) { if (sarc != NULL) update_seg_sentinel_angles(sentinel, sarc); @@ -136,18 +159,9 @@ grbs_del_arc(grbs, sentinel); } -#warning TODO -#if 0 /* if we removed a convex, we need to bump any concave above it as well */ - if (!is_concave) { - /* have to set these up temporarily, because first concave radius - calculation depends on these if our arc is the highest orbit convex */ - narc->copper = tn->copper; - narc->clearance = tn->clearance; - + if (!arc->concave) shrink_seg_radii_concave_above_convex(grbs, first); - } -#endif grbs_del_arc(grbs, arc); }