Index: shape.c =================================================================== --- shape.c (revision 22426) +++ shape.c (revision 22427) @@ -97,7 +97,7 @@ static void elarc90(pcb_poly_t *p, pcb_coord_t ccx, pcb_coord_t ccy, pcb_coord_t cx, pcb_coord_t cy, pcb_coord_t sx, pcb_coord_t sy, pcb_coord_t ex, pcb_coord_t ey, pcb_coord_t rx, pcb_coord_t ry, double sa, int segs, int need_rot, double cosra, double sinra, pcb_coord_t rotcx, pcb_coord_t rotcy, pcb_shape_corner_t style) { pcb_coord_t lx, ly; - double da = M_PI/2.0/((double)segs-1); + double da = (M_PI/2.0/((double)segs-1)); int n; if (style == PCB_CORN_SQUARE) { @@ -139,7 +139,7 @@ #define CORNER(outx, outy, rect_signx, rect_signy, rsignx, rsigny) \ outx = pcb_round((double)cx + rect_signx * (double)w/2 + rsignx*rx); \ outy = pcb_round((double)cy + rect_signy * (double)h/2 + rsigny*ry); -static pcb_poly_t *roundrect(pcb_layer_t *layer, pcb_coord_t w, pcb_coord_t h, pcb_coord_t rx, pcb_coord_t ry, double rot_deg, pcb_coord_t cx, pcb_coord_t cy, pcb_shape_corner_t corner[4]) +static pcb_poly_t *roundrect(pcb_layer_t *layer, pcb_coord_t w, pcb_coord_t h, pcb_coord_t rx, pcb_coord_t ry, double rot_deg, pcb_coord_t cx, pcb_coord_t cy, pcb_shape_corner_t corner[4], double roundres) { pcb_poly_t *p; pcb_coord_t maxr = (w < h ? w : h) / 2, x, y, ex, ey, acx, acy, ccx, ccy; @@ -164,6 +164,8 @@ if (segs < 3) segs = 3; if (segs > 15) segs = 15; + segs = pcb_round((double)segs * roundres); + p = pcb_poly_new(layer, 2 * conf_core.design.clearance, pcb_flag_make(flags)); if (p == NULL) return NULL; @@ -232,7 +234,7 @@ return any_poly_place(data, layer, p); } -static pcb_poly_t *roundrect_place(pcb_data_t *data, pcb_layer_t *layer, pcb_coord_t w, pcb_coord_t h, pcb_coord_t rx, pcb_coord_t ry, double rot_deg, pcb_coord_t cx, pcb_coord_t cy, pcb_shape_corner_t corner[4]) +static pcb_poly_t *roundrect_place(pcb_data_t *data, pcb_layer_t *layer, pcb_coord_t w, pcb_coord_t h, pcb_coord_t rx, pcb_coord_t ry, double rot_deg, pcb_coord_t cx, pcb_coord_t cy, pcb_shape_corner_t corner[4], double roundres) { pcb_poly_t *p; @@ -239,7 +241,7 @@ if (layer == pcb_shape_current_layer) layer = CURRENT; - p = roundrect(layer, w, h, rx, ry, rot_deg, cx, cy, corner); + p = roundrect(layer, w, h, rx, ry, rot_deg, cx, cy, corner, roundres); return any_poly_place(data, layer, p); } @@ -415,7 +417,7 @@ pcb_data_t *data; pcb_bool succ, have_coords = pcb_false; pcb_coord_t x = 0, y = 0, w, h, rx, ry; - double rot = 0.0; + double rot = 0.0, roundres = 1.0; char *end; pcb_shape_corner_t corner[4] = { PCB_CORN_ROUND, PCB_CORN_ROUND, PCB_CORN_ROUND, PCB_CORN_ROUND}; @@ -482,7 +484,7 @@ if ((data == PCB->Data) && (!have_coords)) pcb_hid_get_coords("Click on the center of the polygon", &x, &y, 0); - if (roundrect_place(data, CURRENT, w, h, rx, ry, rot, x, y, corner) == NULL) + if (roundrect_place(data, CURRENT, w, h, rx, ry, rot, x, y, corner, roundres) == NULL) pcb_message(PCB_MSG_ERROR, "roundrect(): failed to create the polygon\n"); PCB_ACT_IRES(0); Index: shape_dialog.c =================================================================== --- shape_dialog.c (revision 22426) +++ shape_dialog.c (revision 22427) @@ -14,7 +14,7 @@ int prx, pry, corners, pcx, pcy, prot, pell; /* roundrect */ - int w, h, rrect, rcx, rcy, rx, ry, rrot, rell, corner[4]; + int w, h, rrect, rcx, rcy, rx, ry, rres, rrot, rell, corner[4]; /* circle */ int dia, ccx, ccy; @@ -95,7 +95,7 @@ shp->dlg[shp->rx].default_val.coord_value, shp->dlg[shp->ry].default_val.coord_value, shp->dlg[shp->rrot].default_val.real_value, shp->dlg[shp->rcx].default_val.coord_value, shp->dlg[shp->rcy].default_val.coord_value, - corner); + corner, shp->dlg[shp->rres].default_val.real_value); } static void shp_chg_circle(void *hid_ctx, void *caller_data, pcb_hid_attribute_t *attr) @@ -285,6 +285,16 @@ PCB_DAD_LABEL(shp->dlg, "elliptical"); PCB_DAD_END(shp->dlg); + PCB_DAD_LABEL(shp->dlg, "Arc resolution factor:"); + PCB_DAD_BEGIN_HBOX(shp->dlg); + PCB_DAD_REAL(shp->dlg, ""); + shp->rres = PCB_DAD_CURRENT(shp->dlg); + PCB_DAD_MINVAL(shp->dlg, 0.1); + PCB_DAD_MAXVAL(shp->dlg, 5); + PCB_DAD_DEFAULT(shp->dlg, 1); + PCB_DAD_CHANGE_CB(shp->dlg, shp_chg_roundrect); + PCB_DAD_END(shp->dlg); + PCB_DAD_LABEL(shp->dlg, "Rotation angle:"); PCB_DAD_BEGIN_HBOX(shp->dlg); PCB_DAD_REAL(shp->dlg, "");