Index: trunk/src/librnd/pcb_compat.h =================================================================== --- trunk/src/librnd/pcb_compat.h (revision 31035) +++ trunk/src/librnd/pcb_compat.h (revision 31036) @@ -1210,3 +1210,11 @@ #define pcb_events_init rnd_events_init #define pcb_events_uninit rnd_events_uninit #define PCB_DAD_UNIT RND_DAD_UNIT +#define pcb_polo_t rnd_polo_t +#define pcb_polo_norms rnd_polo_norms +#define pcb_polo_2area rnd_polo_2area +#define pcb_polo_offs rnd_polo_offs +#define pcb_pline_keepout_offs rnd_pline_keepout_offs +#define pcb_polo_edge_shift rnd_polo_edge_shift +#define pcb_pline_dup_offsets rnd_pline_dup_offsets +#define pcb_pline_dup_offset rnd_pline_dup_offset Index: trunk/src/librnd/poly/offset.c =================================================================== --- trunk/src/librnd/poly/offset.c (revision 31035) +++ trunk/src/librnd/poly/offset.c (revision 31036) @@ -59,7 +59,7 @@ return n; } -void pcb_polo_edge_shift(double offs, +void rnd_polo_edge_shift(double offs, double *x0, double *y0, double nx, double ny, double *x1, double *y1, double prev_x, double prev_y, double prev_nx, double prev_ny, @@ -97,13 +97,13 @@ (*y1) += a1y; } -void pcb_polo_offs(double offs, pcb_polo_t *pcsh, long num_pts) +void rnd_polo_offs(double offs, rnd_polo_t *pcsh, long num_pts) { long n; for(n = 0; n < num_pts; n++) { long np = warp(n-1, num_pts), nn1 = warp(n+1, num_pts), nn2 = warp(n+2, num_pts); - pcb_polo_edge_shift(offs, + rnd_polo_edge_shift(offs, &pcsh[n].x, &pcsh[n].y, pcsh[n].nx, pcsh[n].ny, &pcsh[nn1].x, &pcsh[nn1].y, pcsh[np].x, pcsh[np].y, pcsh[np].nx, pcsh[np].ny, @@ -113,7 +113,7 @@ } -void pcb_polo_norms(pcb_polo_t *pcsh, long num_pts) +void rnd_polo_norms(rnd_polo_t *pcsh, long num_pts) { long n; @@ -123,7 +123,7 @@ } } -double pcb_polo_2area(pcb_polo_t *pcsh, long num_pts) +double rnd_polo_2area(rnd_polo_t *pcsh, long num_pts) { double a = 0; long n; @@ -136,13 +136,13 @@ return a; } -void pcb_pline_dup_offsets(vtp0_t *dst, const pcb_pline_t *src, rnd_coord_t offs) +void rnd_pline_dup_offsets(vtp0_t *dst, const pcb_pline_t *src, rnd_coord_t offs) { const pcb_vnode_t *v; pcb_vector_t tmp; pcb_pline_t *res = NULL; long num_pts, n, from; - pcb_polo_t *pcsh; + rnd_polo_t *pcsh; /* count corners */ v = src->head; @@ -152,7 +152,7 @@ } while((v = v->next) != src->head); /* allocate the cache and copy all data */ - pcsh = malloc(sizeof(pcb_polo_t) * num_pts); + pcsh = malloc(sizeof(rnd_polo_t) * num_pts); for(n = 0, v = src->head; n < num_pts; n++, v = v->next) { pcsh[n].x = v->point[0]; pcsh[n].y = v->point[1]; @@ -160,7 +160,7 @@ } /* offset the cache */ - pcb_polo_offs(offs, pcsh, num_pts); + rnd_polo_offs(offs, pcsh, num_pts); /* create a new pline by copying the cache */ @@ -186,13 +186,13 @@ for(n = from; n < dst->used; n++) { res = dst->array[n]; pcb_poly_contour_pre(res, 1); - pcb_pline_keepout_offs(res, src, offs); /* avoid self-intersection */ + rnd_pline_keepout_offs(res, src, offs); /* avoid self-intersection */ res->tree = pcb_poly_make_edge_tree(res); dst->array[n] = res; } } -pcb_pline_t *pcb_pline_dup_offset(const pcb_pline_t *src, rnd_coord_t offs) +pcb_pline_t *rnd_pline_dup_offset(const pcb_pline_t *src, rnd_coord_t offs) { vtp0_t selfi; pcb_pline_t *res = NULL; @@ -200,7 +200,7 @@ double best = 0; vtp0_init(&selfi); - pcb_pline_dup_offsets(&selfi, src, offs); + rnd_pline_dup_offsets(&selfi, src, offs); for(n = 0; n < selfi.used; n++) { pcb_pline_t *pl = selfi.array[n]; @@ -306,7 +306,7 @@ return 0; } -void pcb_pline_keepout_offs(pcb_pline_t *dst, const pcb_pline_t *src, rnd_coord_t offs) +void rnd_pline_keepout_offs(pcb_pline_t *dst, const pcb_pline_t *src, rnd_coord_t offs) { pcb_vnode_t *v; double offs2 = (double)offs * (double)offs; Index: trunk/src/librnd/poly/offset.h =================================================================== --- trunk/src/librnd/poly/offset.h (revision 31035) +++ trunk/src/librnd/poly/offset.h (revision 31036) @@ -31,10 +31,10 @@ /* Calculate the offset plines of src and append the resulting plines to dst. Yields multiple islands in some corner cases. */ -void pcb_pline_dup_offsets(vtp0_t *dst, const pcb_pline_t *src, rnd_coord_t offs); +void rnd_pline_dup_offsets(vtp0_t *dst, const pcb_pline_t *src, rnd_coord_t offs); /* Same, but returns the largest island only */ -pcb_pline_t *pcb_pline_dup_offset(const pcb_pline_t *src, rnd_coord_t offs); +pcb_pline_t *rnd_pline_dup_offset(const pcb_pline_t *src, rnd_coord_t offs); /* low level */ @@ -41,25 +41,25 @@ typedef struct { double x, y, nx, ny; -} pcb_polo_t; +} rnd_polo_t; /* Calculate the normal vectors of a cache */ -void pcb_polo_norms(pcb_polo_t *pcsh, long num_pts); +void rnd_polo_norms(rnd_polo_t *pcsh, long num_pts); /* Calculate and return the double of the area of a cached polygon */ -double pcb_polo_2area(pcb_polo_t *pcsh, long num_pts); +double rnd_polo_2area(rnd_polo_t *pcsh, long num_pts); /* Ortho-shift all edges of a polygon. Positive offset means grow. */ -void pcb_polo_offs(double offs, pcb_polo_t *pcsh, long num_pts); +void rnd_polo_offs(double offs, rnd_polo_t *pcsh, long num_pts); /* modify dst so it is at least offs far from any point or line of src */ -void pcb_pline_keepout_offs(pcb_pline_t *dst, const pcb_pline_t *src, rnd_coord_t offs); +void rnd_pline_keepout_offs(pcb_pline_t *dst, const pcb_pline_t *src, rnd_coord_t offs); /* Orhto-shift an edge specified by x0;y0 and x1;y1. Calculate the new edge points by extending/shrinking the previous and next line segment. Modifies the target edge's start and end coords. Requires cached normals Positive offset means grow. */ -void pcb_polo_edge_shift(double offs, +void rnd_polo_edge_shift(double offs, double *x0, double *y0, double nx, double ny, double *x1, double *y1, double prev_x, double prev_y, double prev_nx, double prev_ny, Index: trunk/src/obj_poly.c =================================================================== --- trunk/src/obj_poly.c (revision 31035) +++ trunk/src/obj_poly.c (revision 31036) @@ -464,7 +464,7 @@ it.pa = src->Clipped; pcb_poly_island_first(src, &it); pl = pcb_poly_contour(&it); - it.cntr = pcb_pline_dup_offset(pl, offs); + it.cntr = rnd_pline_dup_offset(pl, offs); for(go = pcb_poly_vect_first(&it, &x, &y); go; go = pcb_poly_vect_next(&it, &x, &y)) pcb_poly_point_new(polygon, x, y); @@ -1261,7 +1261,7 @@ int go; long len, n; rnd_coord_t x, y; - pcb_polo_t *p, p_st[256]; + rnd_polo_t *p, p_st[256]; /* calculate length of the polyline */ for(go = pcb_poly_vect_first(it, &x, &y), len = 0; go; go = pcb_poly_vect_next(it, &x, &y)) @@ -1268,7 +1268,7 @@ len++; if (len >= sizeof(p_st) / sizeof(p_st[0])) - p = malloc(sizeof(pcb_polo_t) * len); + p = malloc(sizeof(rnd_polo_t) * len); else p = p_st; @@ -1277,8 +1277,8 @@ p[n].y = y; } - pcb_polo_norms(p, len); - pcb_polo_offs(offs, p, len); + rnd_polo_norms(p, len); + rnd_polo_offs(offs, p, len); for(go = pcb_poly_vect_first(it, &x, &y), n = 0; go; go = pcb_poly_vect_next(it, &x, &y), n++) { Index: trunk/src/obj_pstk.c =================================================================== --- trunk/src/obj_pstk.c (revision 31035) +++ trunk/src/obj_pstk.c (revision 31036) @@ -426,7 +426,7 @@ rnd_hid_set_line_cap(gc, rnd_cap_round); if (dthick != 0) { /* slow - but would be used on export mostly, not on-screen drawing */ - pcb_polo_t *p, p_st[32]; + rnd_polo_t *p, p_st[32]; rnd_coord_t *x, *y, xy_st[64]; double vl = rnd_round(-dthick/2); long n; @@ -436,7 +436,7 @@ vl = rnd_round(dthick/2); if (shape->data.poly.len >= sizeof(p_st) / sizeof(p_st[0])) { - p = malloc(sizeof(pcb_polo_t) * shape->data.poly.len); + p = malloc(sizeof(rnd_polo_t) * shape->data.poly.len); x = malloc(sizeof(rnd_coord_t) * shape->data.poly.len); } else { @@ -450,8 +450,8 @@ p[n].x = shape->data.poly.x[n]; p[n].y = shape->data.poly.y[n]; } - pcb_polo_norms(p, shape->data.poly.len); - pcb_polo_offs(vl, p, shape->data.poly.len); + rnd_polo_norms(p, shape->data.poly.len); + rnd_polo_offs(vl, p, shape->data.poly.len); for(n = 0; n < shape->data.poly.len; n++) { x[n] = rnd_round(p[n].x); y[n] = rnd_round(p[n].y); Index: trunk/src/obj_pstk_proto.c =================================================================== --- trunk/src/obj_pstk_proto.c (revision 31035) +++ trunk/src/obj_pstk_proto.c (revision 31036) @@ -1151,7 +1151,7 @@ TODO("TODO") } else { - pcb_polo_t *p, p_st[32]; + rnd_polo_t *p, p_st[32]; double vl = rnd_round(val/2); if (shp->data.poly.inverted) @@ -1158,7 +1158,7 @@ vl = -vl; if (shp->data.poly.len >= sizeof(p_st) / sizeof(p_st[0])) - p = malloc(sizeof(pcb_polo_t) * shp->data.poly.len); + p = malloc(sizeof(rnd_polo_t) * shp->data.poly.len); else p = p_st; @@ -1167,8 +1167,8 @@ p[n].x = shp->data.poly.x[n]; p[n].y = shp->data.poly.y[n]; } - pcb_polo_norms(p, shp->data.poly.len); - pcb_polo_offs(vl, p, shp->data.poly.len); + rnd_polo_norms(p, shp->data.poly.len); + rnd_polo_offs(vl, p, shp->data.poly.len); for(n = 0; n < shp->data.poly.len; n++) { shp->data.poly.x[n] = p[n].x; shp->data.poly.y[n] = p[n].y; Index: trunk/src/obj_text.c =================================================================== --- trunk/src/obj_text.c (revision 31035) +++ trunk/src/obj_text.c (revision 31036) @@ -1026,19 +1026,19 @@ } if ((info != NULL) && (info->xform != NULL) && (info->xform->bloat != 0)) { - pcb_polo_t *p, pp[MAX_SIMPLE_POLY_POINTS]; + rnd_polo_t *p, pp[MAX_SIMPLE_POLY_POINTS]; double a2, dv; for(n = 0, p = pp; n < max; n++,p++) { p->x = x[n]; p->y = y[n]; } - pcb_polo_norms(pp, max); - a2 = pcb_polo_2area(pp, max); + rnd_polo_norms(pp, max); + a2 = rnd_polo_2area(pp, max); if (a2 < 0) dv = -0.5; else dv = 0.5; - pcb_polo_offs(info->xform->bloat*dv, pp, max); + rnd_polo_offs(info->xform->bloat*dv, pp, max); for(n = 0, p = pp; n < max; n++,p++) { x[n] = rnd_round(p->x); y[n] = rnd_round(p->y); Index: trunk/src_plugins/io_autotrax/write.c =================================================================== --- trunk/src_plugins/io_autotrax/write.c (revision 31035) +++ trunk/src_plugins/io_autotrax/write.c (revision 31036) @@ -601,7 +601,7 @@ pl = pcb_poly_contour(&poly_it); if (pl != NULL) { const pcb_vnode_t *v, *n; - track = pcb_pline_dup_offset(pl, -((Thickness / 2) + 1)); + track = rnd_pline_dup_offset(pl, -((Thickness / 2) + 1)); v = track->head; do { n = v->next; @@ -612,7 +612,7 @@ /* iterate over all holes within this island */ for(pl = pcb_poly_hole_first(&poly_it); pl != NULL; pl = pcb_poly_hole_next(&poly_it)) { const pcb_vnode_t *v, *n; - track = pcb_pline_dup_offset(pl, -((Thickness / 2) + 1)); + track = rnd_pline_dup_offset(pl, -((Thickness / 2) + 1)); v = track->head; do { n = v->next; Index: trunk/src_plugins/io_dsn/read.c =================================================================== --- trunk/src_plugins/io_dsn/read.c (revision 31035) +++ trunk/src_plugins/io_dsn/read.c (revision 31036) @@ -1159,20 +1159,20 @@ if (aper != 0) { double dv; long n; - pcb_polo_t *p; + rnd_polo_t *p; /* this assumes there's no hole in the poly - but DSN doesn't support holes anyway */ - p = malloc(sizeof(pcb_polo_t) * len); + p = malloc(sizeof(rnd_polo_t) * len); for(n = 0; n < len; n++) { p[n].x = poly->Points[n].X; p[n].y = poly->Points[n].Y; } - pcb_polo_norms(p, len); - if (pcb_polo_2area(p, len) < 0) + rnd_polo_norms(p, len); + if (rnd_polo_2area(p, len) < 0) dv = -2.0; else dv = 2.0; - pcb_polo_offs((double)aper / dv, p, len); + rnd_polo_offs((double)aper / dv, p, len); for(n = 0; n < len; n++) { poly->Points[n].X = rnd_round(p[n].x); Index: trunk/src_plugins/lib_polyhelp/polyhelp.c =================================================================== --- trunk/src_plugins/lib_polyhelp/polyhelp.c (revision 31035) +++ trunk/src_plugins/lib_polyhelp/polyhelp.c (revision 31036) @@ -80,7 +80,7 @@ long i; vtp0_init(&tracks); - pcb_pline_dup_offsets(&tracks, src, -((thickness/2)+1)); + rnd_pline_dup_offsets(&tracks, src, -((thickness/2)+1)); for(i = 0; i < tracks.used; i++) { const pcb_vnode_t *v, *n; @@ -217,12 +217,12 @@ pl = pcb_poly_contour(&it); if (pl != NULL) { /* we have a contour */ - track = pcb_pline_dup_offset(pl, -offs); + track = rnd_pline_dup_offset(pl, -offs); add_track(res, track); pcb_poly_contour_del(&track); for(pl = pcb_poly_hole_first(&it); pl != NULL; pl = pcb_poly_hole_next(&it)) { - track = pcb_pline_dup_offset(pl, -offs); + track = rnd_pline_dup_offset(pl, -offs); add_track(res, track); pcb_poly_contour_del(&track); }