Index: trunk/src/find_any_isect.c =================================================================== --- trunk/src/find_any_isect.c (revision 21838) +++ trunk/src/find_any_isect.c (revision 21839) @@ -53,6 +53,7 @@ case PCB_OBJ_POLY: return pcb_isc_line_poly((pcb_line_t *)a, (pcb_poly_t *)b); case PCB_OBJ_ARC: return pcb_isc_line_arc((pcb_line_t *)a, (pcb_arc_t *)b); case PCB_OBJ_PSTK: return pcb_isc_pstk_line((pcb_pstk_t *)b, (pcb_line_t *)a); + case PCB_OBJ_RAT: return pcb_isc_rat_line((pcb_rat_t *)b, (pcb_line_t *)a); default:; } break; @@ -64,6 +65,7 @@ case PCB_OBJ_POLY: return pcb_isc_text_poly((pcb_text_t *)a, (pcb_poly_t *)b); case PCB_OBJ_ARC: return pcb_isc_text_arc((pcb_text_t *)a, (pcb_arc_t *)b); case PCB_OBJ_PSTK: return pcb_isc_text_pstk((pcb_text_t *)a, (pcb_pstk_t *)b); + case PCB_OBJ_RAT: return pcb_false; /* text is invisible to find for now */ default:; } break; @@ -76,6 +78,7 @@ case PCB_OBJ_POLY: return pcb_isc_poly_poly((pcb_poly_t *)a, (pcb_poly_t *)b); case PCB_OBJ_ARC: return pcb_isc_arc_poly((pcb_arc_t *)b, (pcb_poly_t *)a); case PCB_OBJ_PSTK: return pcb_isc_pstk_poly((pcb_pstk_t *)b, (pcb_poly_t *)a); + case PCB_OBJ_RAT: return pcb_isc_rat_poly((pcb_rat_t *)b, (pcb_poly_t *)a); default:; } break; @@ -87,6 +90,7 @@ case PCB_OBJ_POLY: return pcb_isc_arc_poly((pcb_arc_t *)a, (pcb_poly_t *)b); case PCB_OBJ_ARC: return pcb_isc_arc_arc((pcb_arc_t *)a, (pcb_arc_t *)b); case PCB_OBJ_PSTK: return pcb_isc_pstk_arc((pcb_pstk_t *)b, (pcb_arc_t *)a); + case PCB_OBJ_RAT: return pcb_isc_rat_arc((pcb_rat_t *)b, (pcb_arc_t *)a); default:; } break; @@ -98,9 +102,22 @@ case PCB_OBJ_POLY: return pcb_isc_pstk_poly((pcb_pstk_t *)a, (pcb_poly_t *)b); case PCB_OBJ_ARC: return pcb_isc_pstk_arc((pcb_pstk_t *)a, (pcb_arc_t *)b); case PCB_OBJ_PSTK: return pcb_isc_pstk_pstk((pcb_pstk_t *)a, (pcb_pstk_t *)b); + case PCB_OBJ_RAT: TODO("find: rat vs. padstack"); default:; } break; + case PCB_OBJ_RAT: + switch(b->type) { + case PCB_OBJ_VOID: return pcb_false; + case PCB_OBJ_LINE: return pcb_isc_rat_line((pcb_rat_t *)a, (pcb_line_t *)b); + case PCB_OBJ_TEXT: return pcb_false; /* text is invisible to find for now */ + case PCB_OBJ_POLY: return pcb_isc_rat_poly((pcb_rat_t *)a, (pcb_poly_t *)b); + case PCB_OBJ_ARC: return pcb_isc_rat_arc((pcb_rat_t *)a, (pcb_arc_t *)b); + case PCB_OBJ_PSTK: TODO("find: rat vs. padstack"); + case PCB_OBJ_RAT: TODO("find: rat vs. rat"); + default:; + } + break; default:; } assert(!"Don't know how to check intersection of these objet types"); Index: trunk/src/find_geo.c =================================================================== --- trunk/src/find_geo.c (revision 21838) +++ trunk/src/find_geo.c (revision 21839) @@ -238,6 +238,19 @@ return pcb_false; } +/* Tests any end of a rat line is on the line */ +static pcb_bool pcb_isc_rat_line(pcb_rat_t *rat, pcb_line_t *line) +{ + pcb_layergrp_id_t gid = pcb_layer_get_group_(line->parent.layer); + + if ((rat->group1 == gid) && pcb_isc_ratp_line(&rat->Point1, line)) + return pcb_true; + if ((rat->group2 == gid) && pcb_isc_ratp_line(&rat->Point2, line)) + return pcb_true; + + return pcb_false; +} + /* --------------------------------------------------------------------------- * Tests if point is same as arc end point or center point */ @@ -262,6 +275,19 @@ return pcb_false; } +/* Tests any end of a rat line is on the arc */ +static pcb_bool pcb_isc_rat_arc(pcb_rat_t *rat, pcb_arc_t *arc) +{ + pcb_layergrp_id_t gid = pcb_layer_get_group_(arc->parent.layer); + + if ((rat->group1 == gid) && pcb_isc_ratp_arc(&rat->Point1, arc)) + return pcb_true; + if ((rat->group2 == gid) && pcb_isc_ratp_arc(&rat->Point2, arc)) + return pcb_true; + + return pcb_false; +} + /* --------------------------------------------------------------------------- * Tests if rat line point is connected to a polygon */ @@ -283,6 +309,19 @@ return pcb_false; } +/* Tests any end of a rat line is on the arc */ +static pcb_bool pcb_isc_rat_poly(pcb_rat_t *rat, pcb_poly_t *poly) +{ + pcb_layergrp_id_t gid = pcb_layer_get_group_(poly->parent.layer); + + if ((rat->group1 == gid) && pcb_isc_ratp_poly(&rat->Point1, poly)) + return pcb_true; + if ((rat->group2 == gid) && pcb_isc_ratp_poly(&rat->Point2, poly)) + return pcb_true; + + return pcb_false; +} + static void form_slanted_rectangle(pcb_point_t p[4], pcb_line_t *l) /* writes vertices of a squared line */ {