Index: trunk/src/obj_common.h =================================================================== --- trunk/src/obj_common.h (revision 31073) +++ trunk/src/obj_common.h (revision 31074) @@ -296,6 +296,9 @@ #define pcb_obj_clearance(obj, in_poly) \ (RND_MAX((obj)->Clearance, (in_poly)->enforce_clearance)) +#define pcb_obj_clearance_p2(obj, in_poly) \ + (RND_MAX((obj)->Clearance, ((in_poly)->enforce_clearance)*2)) + #define pcb_obj_id_reg(data, obj) \ do { \ pcb_any_obj_t *__obj__ = (pcb_any_obj_t *)(obj); \ Index: trunk/src/polygon.c =================================================================== --- trunk/src/polygon.c (revision 31073) +++ trunk/src/polygon.c (revision 31074) @@ -358,7 +358,7 @@ if (!PCB_FLAG_TEST(PCB_FLAG_CLEARLINE, ps)) return 0; i = pcb_layer_id(d, l); - np = pcb_thermal_area_pstk(pcb_data_get_top(d), ps, i); + np = pcb_thermal_area_pstk(pcb_data_get_top(d), ps, i, p); if (np == 0) return 0; @@ -366,11 +366,11 @@ } /* return the clearance polygon for a line */ -static rnd_polyarea_t *line_clearance_poly(rnd_cardinal_t layernum, pcb_board_t *pcb, pcb_line_t *line) +static rnd_polyarea_t *line_clearance_poly(rnd_cardinal_t layernum, pcb_board_t *pcb, pcb_line_t *line, pcb_poly_t *in_poly) { if (line->thermal & PCB_THERMAL_ON) - return pcb_thermal_area_line(pcb, line, layernum); - return pcb_poly_from_pcb_line(line, line->Thickness + line->Clearance); + return pcb_thermal_area_line(pcb, line, layernum, in_poly); + return pcb_poly_from_pcb_line(line, line->Thickness + pcb_obj_clearance_p2(line, in_poly)); } static int SubtractLine(pcb_line_t * line, pcb_poly_t * p) @@ -379,7 +379,7 @@ if (!PCB_NONPOLY_HAS_CLEARANCE(line)) return 0; - if (!(np = line_clearance_poly(-1, NULL, line))) + if (!(np = line_clearance_poly(-1, NULL, line, p))) return -1; return Subtract(np, p, rnd_true); } @@ -503,7 +503,7 @@ i = pcb_layer_id(info->data, info->layer); - np = pcb_thermal_area_pstk(pcb_data_get_top(info->data), ps, i); + np = pcb_thermal_area_pstk(pcb_data_get_top(info->data), ps, i, polygon); if (np == 0) return RND_R_DIR_FOUND_CONTINUE; @@ -633,10 +633,10 @@ } /* return the clearance polygon for a line */ -static rnd_polyarea_t *poly_clearance_poly(rnd_cardinal_t layernum, pcb_board_t *pcb, pcb_poly_t *subpoly) +static rnd_polyarea_t *poly_clearance_poly(rnd_cardinal_t layernum, pcb_board_t *pcb, pcb_poly_t *subpoly, pcb_poly_t *in_poly) { if (subpoly->thermal & PCB_THERMAL_ON) - return pcb_thermal_area_poly(pcb, subpoly, layernum); + return pcb_thermal_area_poly(pcb, subpoly, layernum, in_poly); return pcb_poly_clearance_construct(subpoly, NULL); } @@ -648,7 +648,7 @@ if (PCB_FLAG_TEST(PCB_FLAG_CLEARPOLYPOLY, frompoly)) /* two clearing polys won't interact */ return 0; /* but it's not an error, that'd kill other clearances in the same poly */ - pa = poly_clearance_poly(-1, NULL, subpoly); + pa = poly_clearance_poly(-1, NULL, subpoly, frompoly); if (pa == NULL) return -1; @@ -665,7 +665,7 @@ if (PCB_FLAG_TEST(PCB_FLAG_CLEARPOLYPOLY, frompoly)) /* two clearing polys won't interact */ return 0; /* but it's not an error, that'd kill other clearances in the same poly */ - pa = poly_clearance_poly(-1, NULL, subpoly); + pa = poly_clearance_poly(-1, NULL, subpoly, frompoly); if (pa == NULL) return -1; @@ -718,7 +718,7 @@ POLY_CLIP_PROG(); - np = line_clearance_poly(-1, NULL, line); + np = line_clearance_poly(-1, NULL, line, polygon); if (!np) longjmp(info->env, 1); Index: trunk/src/thermal.c =================================================================== --- trunk/src/thermal.c (revision 31073) +++ trunk/src/thermal.c (revision 31074) @@ -150,7 +150,7 @@ return pcb_poly_from_pcb_arc(&atmp, clr); } -rnd_polyarea_t *pcb_thermal_area_line(pcb_board_t *pcb, pcb_line_t *line, rnd_layer_id_t lid) +rnd_polyarea_t *pcb_thermal_area_line(pcb_board_t *pcb, pcb_line_t *line, rnd_layer_id_t lid, pcb_poly_t *in_poly) { rnd_polyarea_t *pa, *pb, *pc; double dx, dy, len, vx, vy, nx, ny, clr, clrth, x1, y1, x2, y2, mx, my; @@ -649,7 +649,7 @@ polytherm_base(pres, it->pa); } -rnd_polyarea_t *pcb_thermal_area_poly(pcb_board_t *pcb, pcb_poly_t *poly, rnd_layer_id_t lid) +rnd_polyarea_t *pcb_thermal_area_poly(pcb_board_t *pcb, pcb_poly_t *poly, rnd_layer_id_t lid, pcb_poly_t *in_poly) { rnd_polyarea_t *pa, *pres = NULL; rnd_coord_t clr = poly->Clearance/2; @@ -705,7 +705,7 @@ return NULL; } -rnd_polyarea_t *pcb_thermal_area_pstk(pcb_board_t *pcb, pcb_pstk_t *ps, rnd_layer_id_t lid) +rnd_polyarea_t *pcb_thermal_area_pstk(pcb_board_t *pcb, pcb_pstk_t *ps, rnd_layer_id_t lid, pcb_poly_t *in_poly) { unsigned char thr; pcb_pstk_shape_t *shp, tmpshp; @@ -803,7 +803,7 @@ ltmp.Thickness = shp->data.line.thickness; ltmp.Clearance = clearance*2; ltmp.thermal = thr; - pres = pcb_thermal_area_line(pcb, <mp, lid); + pres = pcb_thermal_area_line(pcb, <mp, lid, in_poly); } return pres; @@ -831,18 +831,18 @@ return NULL; } -rnd_polyarea_t *pcb_thermal_area(pcb_board_t *pcb, pcb_any_obj_t *obj, rnd_layer_id_t lid) +rnd_polyarea_t *pcb_thermal_area(pcb_board_t *pcb, pcb_any_obj_t *obj, rnd_layer_id_t lid, pcb_poly_t *in_poly) { switch(obj->type) { case PCB_OBJ_LINE: - return pcb_thermal_area_line(pcb, (pcb_line_t *)obj, lid); + return pcb_thermal_area_line(pcb, (pcb_line_t *)obj, lid, in_poly); case PCB_OBJ_POLY: - return pcb_thermal_area_poly(pcb, (pcb_poly_t *)obj, lid); + return pcb_thermal_area_poly(pcb, (pcb_poly_t *)obj, lid, in_poly); case PCB_OBJ_PSTK: - return pcb_thermal_area_pstk(pcb, (pcb_pstk_t *)obj, lid); + return pcb_thermal_area_pstk(pcb, (pcb_pstk_t *)obj, lid, in_poly); case PCB_OBJ_ARC: break; Index: trunk/src/thermal.h =================================================================== --- trunk/src/thermal.h (revision 31073) +++ trunk/src/thermal.h (revision 31074) @@ -54,10 +54,10 @@ const char *pcb_thermal_bits2str(pcb_thermal_t *bits); -rnd_polyarea_t *pcb_thermal_area(pcb_board_t *p, pcb_any_obj_t *obj, rnd_layer_id_t lid); -rnd_polyarea_t *pcb_thermal_area_line(pcb_board_t *pcb, pcb_line_t *line, rnd_layer_id_t lid); -rnd_polyarea_t *pcb_thermal_area_poly(pcb_board_t *pcb, pcb_poly_t *poly, rnd_layer_id_t lid); -rnd_polyarea_t *pcb_thermal_area_pstk(pcb_board_t *pcb, pcb_pstk_t *ps, rnd_layer_id_t lid); +rnd_polyarea_t *pcb_thermal_area(pcb_board_t *p, pcb_any_obj_t *obj, rnd_layer_id_t lid, pcb_poly_t *in_poly); +rnd_polyarea_t *pcb_thermal_area_line(pcb_board_t *pcb, pcb_line_t *line, rnd_layer_id_t lid, pcb_poly_t *in_poly); +rnd_polyarea_t *pcb_thermal_area_poly(pcb_board_t *pcb, pcb_poly_t *poly, rnd_layer_id_t lid, pcb_poly_t *in_poly); +rnd_polyarea_t *pcb_thermal_area_pstk(pcb_board_t *pcb, pcb_pstk_t *ps, rnd_layer_id_t lid, pcb_poly_t *in_poly); unsigned char pcb_themal_style_old2new(rnd_cardinal_t t); rnd_cardinal_t pcb_themal_style_new2old(unsigned char t);