Index: trunk/src/search.c =================================================================== --- trunk/src/search.c (revision 5991) +++ trunk/src/search.c (revision 5992) @@ -951,6 +951,16 @@ return range < Radius; } +pcb_bool pcb_arc_in_box(pcb_arc_t *arc, pcb_box_t *b) +{ + pcb_box_t ab = pcb_arc_mini_bbox(arc); + + pcb_printf("mini %mm %mm - %mm %mm\n", ab.X1, ab.Y1, ab.X2, ab.Y2); + pcb_printf(" %mm %mm - %mm %mm\n", b->X1, b->Y1, b->X2, b->Y2); + + return PCB_BOX_IN_BOX(&ab, b); +} + /* TODO: this code is BROKEN in the case of non-circular arcs, * and in the case that the arc thickness is greater than * the radius. Index: trunk/src/search.h =================================================================== --- trunk/src/search.h (revision 5991) +++ trunk/src/search.h (revision 5992) @@ -34,6 +34,7 @@ #include "misc_util.h" int pcb_lines_intersect(pcb_coord_t ax1, pcb_coord_t ay1, pcb_coord_t ax2, pcb_coord_t ay2, pcb_coord_t bx1, pcb_coord_t by1, pcb_coord_t bx2, pcb_coord_t by2); +pcb_bool pcb_arc_in_box(pcb_arc_t *arc, pcb_box_t *b); #define PCB_SLOP 5 /* --------------------------------------------------------------------------- @@ -70,8 +71,10 @@ #define PCB_ELEMENT_IN_BOX(e,b) \ (PCB_BOX_IN_BOX(&((e)->BoundingBox), (b))) +/* the bounding box is much larger than the minimum, use it to decide it + it is worth doing the expensive precise calculations */ #define PCB_ARC_IN_BOX(a,b) \ - (PCB_BOX_IN_BOX(&((a)->BoundingBox), (b))) + ((PCB_BOX_TOUCHES_BOX(&((a)->BoundingBox), (b))) && (pcb_arc_in_box(a,b))) /* == the same but accept if any part of the object touches the box == */ #define PCB_POINT_IN_CIRCLE(x, y, cx, cy, r) \