Index: trunk/src/find_geo.c =================================================================== --- trunk/src/find_geo.c (revision 31036) +++ trunk/src/find_geo.c (revision 31037) @@ -60,7 +60,7 @@ /* first, iterate over all islands of a polygon */ for(pa = pcb_poly_island_first(poly, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { - pcb_pline_t *c = pcb_poly_contour(&it); + rnd_pline_t *c = pcb_poly_contour(&it); if ((box->X1 <= c->xmax + Bloat) && (box->X2 >= c->xmin - Bloat) && (box->Y1 <= c->ymax + Bloat) && (box->Y2 >= c->ymin - Bloat)) { return 1; } if (first_only) @@ -83,13 +83,13 @@ /* first, iterate over all islands of a polygon */ for(pa = pcb_poly_island_first(poly, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { - ans = pcb_polyarea_touching(objpoly, pa); + ans = rnd_polyarea_touching(objpoly, pa); if (ans) break; if (first_only) break; } - pcb_polyarea_free(&objpoly); + rnd_polyarea_free(&objpoly); return ans; } @@ -360,7 +360,7 @@ /* expensive test: the rat can end on any contour point */ for(pa = pcb_poly_island_first(polygon, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { rnd_coord_t x, y; - pcb_pline_t *pl; + rnd_pline_t *pl; int go; pl = pcb_poly_contour(&it); @@ -677,8 +677,8 @@ if (!(arcp = pcb_poly_from_pcb_arc(Arc, Arc->Thickness + Bloat))) return rnd_false; /* error */ - res = pcb_polyarea_touching(arcp, pa); - pcb_polyarea_free(&arcp); + res = rnd_polyarea_touching(arcp, pa); + rnd_polyarea_free(&arcp); } return res; } @@ -740,9 +740,9 @@ /* first, iterate over all island pairs of the polygons to find if any of them has overlapping bbox */ for(pa1 = pcb_poly_island_first(P1, &it1); pa1 != NULL; pa1 = pcb_poly_island_next(&it1)) { - pcb_pline_t *c1 = pcb_poly_contour(&it1); + rnd_pline_t *c1 = pcb_poly_contour(&it1); for(pa2 = pcb_poly_island_first(P2, &it2); pa2 != NULL; pa2 = pcb_poly_island_next(&it2)) { - pcb_pline_t *c2 = pcb_poly_contour(&it2); + rnd_pline_t *c2 = pcb_poly_contour(&it2); if ((c1->xmin - Bloat <= c2->xmax) && (c2->xmin <= c1->xmax + Bloat) && (c1->ymin - Bloat <= c2->ymax) && (c2->ymin <= c1->ymax + Bloat)) { goto do_check; } if (!PCB_FLAG_TEST(PCB_FLAG_FULLPOLY, P2)) @@ -775,7 +775,7 @@ if (Bloat == 0) { for(pa1 = pcb_poly_island_first(P1, &it1); pa1 != NULL; pa1 = pcb_poly_island_next(&it1)) { for(pa2 = pcb_poly_island_first(P2, &it2); pa2 != NULL; pa2 = pcb_poly_island_next(&it2)) { - if (pcb_polyarea_touching(pa1, pa2)) + if (rnd_polyarea_touching(pa1, pa2)) return rnd_true; if (!PCB_FLAG_TEST(PCB_FLAG_FULLPOLY, P2)) break; @@ -788,15 +788,15 @@ /* now the difficult case of bloated for each island vs. island */ if (Bloat > 0) { for(pa1 = pcb_poly_island_first(P1, &it1); pa1 != NULL; pa1 = pcb_poly_island_next(&it1)) { - pcb_pline_t *c1 = pcb_poly_contour(&it1); + rnd_pline_t *c1 = pcb_poly_contour(&it1); for(pa2 = pcb_poly_island_first(P2, &it2); pa2 != NULL; pa2 = pcb_poly_island_next(&it2)) { - pcb_pline_t *c, *c2 = pcb_poly_contour(&it2); + rnd_pline_t *c, *c2 = pcb_poly_contour(&it2); if (!((c1->xmin - Bloat <= c2->xmax) && (c2->xmin <= c1->xmax + Bloat) && (c1->ymin - Bloat <= c2->ymax) && (c2->ymin <= c1->ymax + Bloat))) continue; for (c = c1; c; c = c->next) { pcb_line_t line; - pcb_vnode_t *v = c->head; + rnd_vnode_t *v = c->head; if (c->xmin - Bloat <= c2->xmax && c->xmax + Bloat >= c2->xmin && c->ymin - Bloat <= c2->ymax && c->ymax + Bloat >= c2->ymin) { @@ -829,7 +829,7 @@ /* returns whether a round-cap pcb line touches a polygon; assumes bounding boxes do touch */ -RND_INLINE rnd_bool_t pcb_isc_line_polyline(const pcb_find_t *ctx, pcb_pline_t *pl, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2, rnd_coord_t thick) +RND_INLINE rnd_bool_t pcb_isc_line_polyline(const pcb_find_t *ctx, rnd_pline_t *pl, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2, rnd_coord_t thick) { rnd_coord_t ox, oy, vx, vy; double dx, dy, h, l; @@ -862,7 +862,7 @@ are sure there's no contour intersection, so if any of the polyline points is in, the whole polyline is in. */ { - pcb_vector_t q[4]; + rnd_vector_t q[4]; q[0][0] = x1 + ox; q[0][1] = y1 + oy; q[1][0] = x2 + ox; q[1][1] = y2 + oy; @@ -1021,23 +1021,23 @@ RND_INLINE rnd_polyarea_t *pcb_pstk_shp_poly2area(pcb_pstk_t *ps, pcb_pstk_shape_t *shape) { int n; - pcb_pline_t *pl; - pcb_vector_t v; - rnd_polyarea_t *shp = pcb_polyarea_create(); + rnd_pline_t *pl; + rnd_vector_t v; + rnd_polyarea_t *shp = rnd_polyarea_create(); v[0] = shape->data.poly.x[0] + ps->x; v[1] = shape->data.poly.y[0] + ps->y; - pl = pcb_poly_contour_new(v); + pl = rnd_poly_contour_new(v); for(n = 1; n < shape->data.poly.len; n++) { v[0] = shape->data.poly.x[n] + ps->x; v[1] = shape->data.poly.y[n] + ps->y; - pcb_poly_vertex_include(pl->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(pl->head->prev, rnd_poly_node_create(v)); } - pcb_poly_contour_pre(pl, 1); - pcb_polyarea_contour_include(shp, pl); + rnd_poly_contour_pre(pl, 1); + rnd_polyarea_contour_include(shp, pl); - if (!pcb_poly_valid(shp)) { -/* pcb_polyarea_free(&shp); shp = pcb_polyarea_create();*/ - pcb_poly_contour_inv(pl); - pcb_polyarea_contour_include(shp, pl); + if (!rnd_poly_valid(shp)) { +/* rnd_polyarea_free(&shp); shp = rnd_polyarea_create();*/ + rnd_poly_contour_inv(pl); + rnd_polyarea_contour_include(shp, pl); } return shp; @@ -1053,8 +1053,8 @@ /* convert the shape poly to a new poly so that it can be intersected */ rnd_bool res; rnd_polyarea_t *shp = pcb_pstk_shp_poly2area(ps, shape); - res = pcb_polyarea_touching(shp, poly->Clipped); - pcb_polyarea_free(&shp); + res = rnd_polyarea_touching(shp, poly->Clipped); + rnd_polyarea_free(&shp); return res; } case PCB_PSSH_LINE: @@ -1149,9 +1149,9 @@ rnd_bool res; rnd_polyarea_t *shp1 = pcb_pstk_shp_poly2area(ps1, shape1); rnd_polyarea_t *shp2 = pcb_pstk_shp_poly2area(ps2, shape2); - res = pcb_polyarea_touching(shp1, shp2); - pcb_polyarea_free(&shp1); - pcb_polyarea_free(&shp2); + res = rnd_polyarea_touching(shp1, shp2); + rnd_polyarea_free(&shp1); + rnd_polyarea_free(&shp2); return res; } case PCB_PSSH_LINE: Index: trunk/src/librnd/pcb_compat.h =================================================================== --- trunk/src/librnd/pcb_compat.h (revision 31036) +++ trunk/src/librnd/pcb_compat.h (revision 31037) @@ -1218,3 +1218,71 @@ #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 +#define PCB_PLF_DIR RND_PLF_DIR +#define PCB_PLF_INV RND_PLF_INV +#define PCB_PLF_MARK RND_PLF_MARK +#define pcb_vertex_equ rnd_vertex_equ +#define pcb_vertex_cpy rnd_vertex_cpy +#define pcb_vertex_t rnd_vertex_t +#define pcb_vector_t rnd_vector_t +#define vect_zero rnd_vect_zero +#define pcb_err_no_memory rnd_err_no_memory +#define pcb_err_bad_parm rnd_err_bad_parm +#define pcb_err_ok rnd_err_ok +#define pcb_cvc_list_s rnd_cvc_list_s +#define pcb_cvc_list_t rnd_cvc_list_t +#define pcb_vnode_s rnd_vnode_s +#define pcb_vnode_t rnd_vnode_t +#define pcb_pline_s rnd_pline_s +#define pcb_pline_t rnd_pline_t +#define pcb_poly_contour_new rnd_poly_contour_new +#define pcb_poly_contour_init rnd_poly_contour_init +#define pcb_poly_contour_clear rnd_poly_contour_clear +#define pcb_poly_contour_del rnd_poly_contour_del +#define pcb_poly_contour_copy rnd_poly_contour_copy +#define pcb_poly_contour_pre rnd_poly_contour_pre +#define pcb_poly_contour_inv rnd_poly_contour_inv +#define pcb_poly_node_create rnd_poly_node_create +#define pcb_poly_vertex_include rnd_poly_vertex_include +#define pcb_poly_vertex_include_force rnd_poly_vertex_include_force +#define pcb_poly_vertex_exclude rnd_poly_vertex_exclude +#define pcb_poly_node_add_single rnd_poly_node_add_single +#define pcb_polyarea_m_copy0 rnd_polyarea_m_copy0 +#define pcb_polyarea_m_include rnd_polyarea_m_include +#define pcb_polyarea_copy0 rnd_polyarea_copy0 +#define pcb_polyarea_copy1 rnd_polyarea_copy1 +#define pcb_polyarea_contour_include rnd_polyarea_contour_include +#define pcb_polyarea_contour_exclude rnd_polyarea_contour_exclude +#define pcb_polyarea_contour_check rnd_polyarea_contour_check +#define pcb_polyarea_contour_inside rnd_polyarea_contour_inside +#define pcb_polyarea_touching rnd_polyarea_touching +#define pcb_poly_contour_inside rnd_poly_contour_inside +#define pcb_poly_contour_in_contour rnd_poly_contour_in_contour +#define pcb_polyarea_create rnd_polyarea_create +#define pcb_polyarea_free rnd_polyarea_free +#define pcb_polyarea_init rnd_polyarea_init +#define pcb_poly_contours_free rnd_poly_contours_free +#define pcb_poly_valid rnd_poly_valid +#define PCB_PBO_UNITE RND_PBO_UNITE +#define PCB_PBO_ISECT RND_PBO_ISECT +#define PCB_PBO_SUB RND_PBO_SUB +#define PCB_PBO_XOR RND_PBO_XOR +#define pcb_vect_dist2 rnd_vect_dist2 +#define pcb_vect_det2 rnd_vect_det2 +#define pcb_vect_len2 rnd_vect_len2 +#define pcb_vect_inters2 rnd_vect_inters2 +#define pcb_polyarea_boolean rnd_polyarea_boolean +#define pcb_polyarea_boolean_free rnd_polyarea_boolean_free +#define pcb_polyarea_and_subtract_free rnd_polyarea_and_subtract_free +#define pcb_polyarea_save rnd_polyarea_save +#define pcb_polyarea_bbox rnd_polyarea_bbox +#define pcb_polyarea_move rnd_polyarea_move +#define pcb_poly_bool_op_e rnd_poly_bool_op_e +#define pcb_arc_get_endpt rnd_arc_get_endpt +#define pcb_polyarea_get_tree_seg rnd_polyarea_get_tree_seg +#define pcb_poly_make_edge_tree rnd_poly_make_edge_tree +#define PCB_POLY_ARC_MAX_DEVIATION RND_POLY_ARC_MAX_DEVIATION +#define PCB_POLY_CIRC_SEGS RND_POLY_CIRC_SEGS +#define PCB_POLY_CIRC_SEGS_F RND_POLY_CIRC_SEGS_F +#define PCB_POLY_CIRC_RADIUS_ADJ RND_POLY_CIRC_RADIUS_ADJ +#define PCB_POLY_ENDP_EPSILON RND_POLY_ENDP_EPSILON Index: trunk/src/librnd/poly/offset.c =================================================================== --- trunk/src/librnd/poly/offset.c (revision 31036) +++ trunk/src/librnd/poly/offset.c (revision 31037) @@ -136,11 +136,11 @@ return a; } -void rnd_pline_dup_offsets(vtp0_t *dst, const pcb_pline_t *src, rnd_coord_t offs) +void rnd_pline_dup_offsets(vtp0_t *dst, const rnd_pline_t *src, rnd_coord_t offs) { - const pcb_vnode_t *v; - pcb_vector_t tmp; - pcb_pline_t *res = NULL; + const rnd_vnode_t *v; + rnd_vector_t tmp; + rnd_pline_t *res = NULL; long num_pts, n, from; rnd_polo_t *pcsh; @@ -166,11 +166,11 @@ /* create a new pline by copying the cache */ tmp[0] = rnd_round(pcsh[0].x); tmp[1] = rnd_round(pcsh[0].y); - res = pcb_poly_contour_new(tmp); + res = rnd_poly_contour_new(tmp); for(n = 1; n < num_pts; n++) { tmp[0] = rnd_round(pcsh[n].x); tmp[1] = rnd_round(pcsh[n].y); - pcb_poly_vertex_include(res->head->prev, pcb_poly_node_create(tmp)); + rnd_poly_vertex_include(res->head->prev, rnd_poly_node_create(tmp)); } free(pcsh); @@ -178,7 +178,7 @@ from = dst->used; if (pcb_pline_is_selfint(res)) { pcb_pline_split_selfint(res, dst); - pcb_poly_contour_del(&res); + rnd_poly_contour_del(&res); } else vtp0_append(dst, res); @@ -185,17 +185,17 @@ for(n = from; n < dst->used; n++) { res = dst->array[n]; - pcb_poly_contour_pre(res, 1); + rnd_poly_contour_pre(res, 1); rnd_pline_keepout_offs(res, src, offs); /* avoid self-intersection */ - res->tree = pcb_poly_make_edge_tree(res); + res->tree = rnd_poly_make_edge_tree(res); dst->array[n] = res; } } -pcb_pline_t *rnd_pline_dup_offset(const pcb_pline_t *src, rnd_coord_t offs) +rnd_pline_t *rnd_pline_dup_offset(const rnd_pline_t *src, rnd_coord_t offs) { vtp0_t selfi; - pcb_pline_t *res = NULL; + rnd_pline_t *res = NULL; int n; double best = 0; @@ -203,7 +203,7 @@ rnd_pline_dup_offsets(&selfi, src, offs); for(n = 0; n < selfi.used; n++) { - pcb_pline_t *pl = selfi.array[n]; + rnd_pline_t *pl = selfi.array[n]; if (pl->area > best) { best = pl->area; res = pl; @@ -211,9 +211,9 @@ } pcbo_trace("best area: %f out of %d\n", best, selfi.used); for(n = 0; n < selfi.used; n++) { - pcb_pline_t *pl = selfi.array[n]; + rnd_pline_t *pl = selfi.array[n]; if (res != pl) - pcb_poly_contour_del(&pl); + rnd_poly_contour_del(&pl); } vtp0_uninit(&selfi); return res; @@ -255,7 +255,7 @@ } /* Modify v, pulling it back toward vp so that the distance to line ldx;ldy is increased by tune */ -RND_INLINE int pull_back(pcb_vnode_t *v, const pcb_vnode_t *vp, double tune, double ldx, double ldy, double prjx, double prjy, int inside) +RND_INLINE int pull_back(rnd_vnode_t *v, const rnd_vnode_t *vp, double tune, double ldx, double ldy, double prjx, double prjy, int inside) { rnd_coord_t ox, oy; double c, vx, vy, vlen, prx, pry, prlen; @@ -306,9 +306,9 @@ return 0; } -void rnd_pline_keepout_offs(pcb_pline_t *dst, const pcb_pline_t *src, rnd_coord_t offs) +void rnd_pline_keepout_offs(rnd_pline_t *dst, const rnd_pline_t *src, rnd_coord_t offs) { - pcb_vnode_t *v; + rnd_vnode_t *v; double offs2 = (double)offs * (double)offs; int negoffs = offs < 0; @@ -333,17 +333,17 @@ pb.x1 = v->point[0] - offs+1; pb.y1 = v->point[1] - offs+1; pb.x2 = v->point[0] + offs-1; pb.y2 = v->point[1] + offs-1; if (!negoffs) - inside = pcb_poly_contour_inside(src, v->point); + inside = rnd_poly_contour_inside(src, v->point); for(seg = rnd_rtree_first(&it, src->tree, &pb); seg != NULL; seg = rnd_rtree_next(&it)) { rnd_coord_t x1, y1, x2, y2; double dist, tune, prjx, prjy, dx, dy, ax, ay, dotp, prevx, prevy, prevl; - pcb_polyarea_get_tree_seg(seg, &x1, &y1, &x2, &y2); + rnd_polyarea_get_tree_seg(seg, &x1, &y1, &x2, &y2); dist = dist_line_to_pt(v->point[0], v->point[1], x1, y1, x2, y2, &dx, &dy); if ((offs2 - dist) > 10) { - pcb_vector_t nv_; - pcb_vnode_t *nv; + rnd_vector_t nv_; + rnd_vnode_t *nv; /* calculate x0;y0 projected onto the line */ ax = v->point[0] - x1; @@ -387,17 +387,17 @@ nv_[0] = v->point[0]; nv_[1] = v->point[1]; - nv = pcb_poly_node_create(nv_); - pcb_poly_vertex_include_force(v, nv); + nv = rnd_poly_node_create(nv_); + rnd_poly_vertex_include_force(v, nv); if (pull_back(v, v->prev, tune, dx, dy, prjx, prjy, inside) != 0) { - pcb_poly_vertex_exclude(dst, nv); + rnd_poly_vertex_exclude(dst, nv); v = v->next; goto retry; } if (pull_back(nv, nv->next, tune, dx, dy, prjx, prjy, inside) != 0) { - pcb_poly_vertex_exclude(dst, nv); + rnd_poly_vertex_exclude(dst, nv); v = v->next; goto retry; } @@ -416,12 +416,12 @@ do { if ((v->prev->point[0] == v->point[0]) && (v->prev->point[1] == v->point[1])) { if (v->prev == dst->head) { - pcb_vnode_t *nv = v->next; - pcb_poly_vertex_exclude(dst, v); + rnd_vnode_t *nv = v->next; + rnd_poly_vertex_exclude(dst, v); v = nv; continue; } - pcb_poly_vertex_exclude(dst, v->prev); + rnd_poly_vertex_exclude(dst, v->prev); } } while((v = v->next) != dst->head); } Index: trunk/src/librnd/poly/offset.h =================================================================== --- trunk/src/librnd/poly/offset.h (revision 31036) +++ trunk/src/librnd/poly/offset.h (revision 31037) @@ -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 rnd_pline_dup_offsets(vtp0_t *dst, const pcb_pline_t *src, rnd_coord_t offs); +void rnd_pline_dup_offsets(vtp0_t *dst, const rnd_pline_t *src, rnd_coord_t offs); /* Same, but returns the largest island only */ -pcb_pline_t *rnd_pline_dup_offset(const pcb_pline_t *src, rnd_coord_t offs); +rnd_pline_t *rnd_pline_dup_offset(const rnd_pline_t *src, rnd_coord_t offs); /* low level */ @@ -53,7 +53,7 @@ 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 rnd_pline_keepout_offs(pcb_pline_t *dst, const pcb_pline_t *src, rnd_coord_t offs); +void rnd_pline_keepout_offs(rnd_pline_t *dst, const rnd_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. Index: trunk/src/librnd/poly/polyarea.c =================================================================== --- trunk/src/librnd/poly/polyarea.c (revision 31036) +++ trunk/src/librnd/poly/polyarea.c (revision 31037) @@ -71,18 +71,18 @@ /*********************************************************************/ #define Vcopy(a,b) {(a)[0]=(b)[0];(a)[1]=(b)[1];} -int vect_equal(pcb_vector_t v1, pcb_vector_t v2); -void vect_init(pcb_vector_t v, double x, double y); -void vect_sub(pcb_vector_t res, pcb_vector_t v2, pcb_vector_t v3); +int vect_equal(rnd_vector_t v1, rnd_vector_t v2); +void vect_init(rnd_vector_t v, double x, double y); +void vect_sub(rnd_vector_t res, rnd_vector_t v2, rnd_vector_t v3); -void vect_min(pcb_vector_t res, pcb_vector_t v2, pcb_vector_t v3); -void vect_max(pcb_vector_t res, pcb_vector_t v2, pcb_vector_t v3); +void vect_min(rnd_vector_t res, rnd_vector_t v2, rnd_vector_t v3); +void vect_max(rnd_vector_t res, rnd_vector_t v2, rnd_vector_t v3); -double pcb_vect_dist2(pcb_vector_t v1, pcb_vector_t v2); -double pcb_vect_det2(pcb_vector_t v1, pcb_vector_t v2); -double pcb_vect_len2(pcb_vector_t v1); +double rnd_vect_dist2(rnd_vector_t v1, rnd_vector_t v2); +double rnd_vect_det2(rnd_vector_t v1, rnd_vector_t v2); +double rnd_vect_len2(rnd_vector_t v1); -int pcb_vect_inters2(pcb_vector_t A, pcb_vector_t B, pcb_vector_t C, pcb_vector_t D, pcb_vector_t S1, pcb_vector_t S2); +int rnd_vect_inters2(rnd_vector_t A, rnd_vector_t B, rnd_vector_t C, rnd_vector_t D, rnd_vector_t S1, rnd_vector_t S2); /* note that a vertex v's Flags.status represents the edge defined by * v to v->next (i.e. the edge is forward of v) @@ -103,7 +103,7 @@ #define MemGet(ptr, type) \ if (RND_UNLIKELY(((ptr) = (type *)malloc(sizeof(type))) == NULL)) \ - error(pcb_err_no_memory); + error(rnd_err_no_memory); #undef DEBUG_LABEL #undef DEBUG_ALL_LABELS @@ -141,11 +141,11 @@ } #ifdef DEBUG -static char *theState(pcb_vnode_t * v); +static char *theState(rnd_vnode_t * v); -static void pline_dump(pcb_vnode_t * v) +static void pline_dump(rnd_vnode_t * v) { - pcb_vnode_t *s, *n; + rnd_vnode_t *s, *n; s = v; do { @@ -159,13 +159,13 @@ static void poly_dump(rnd_polyarea_t * p) { rnd_polyarea_t *f = p; - pcb_pline_t *pl; + rnd_pline_t *pl; do { pl = p->contours; do { pline_dump(pl->head); - fprintf(stderr, "NEXT pcb_pline_t\n"); + fprintf(stderr, "NEXT rnd_pline_t\n"); } while ((pl = pl->next) != NULL); fprintf(stderr, "NEXT POLY\n"); @@ -188,15 +188,15 @@ 1 means a new node was created and inserted 4 means the intersection was not on the dest point */ -pcb_vnode_t *pcb_poly_node_add_single(pcb_vnode_t *dest, pcb_vector_t po) +rnd_vnode_t *rnd_poly_node_add_single(rnd_vnode_t *dest, rnd_vector_t po) { - pcb_vnode_t *p; + rnd_vnode_t *p; if (vect_equal(po, dest->point)) return dest; if (vect_equal(po, dest->next->point)) return dest->next; - p = pcb_poly_node_create(po); + p = rnd_poly_node_create(po); if (p == NULL) return NULL; p->cvc_prev = p->cvc_next = NULL; @@ -212,10 +212,10 @@ new_descriptor (C) 2006 harry eaton */ -static pcb_cvc_list_t *new_descriptor(pcb_vnode_t * a, char poly, char side) +static rnd_cvc_list_t *new_descriptor(rnd_vnode_t * a, char poly, char side) { - pcb_cvc_list_t *l = (pcb_cvc_list_t *) malloc(sizeof(pcb_cvc_list_t)); - pcb_vector_t v; + rnd_cvc_list_t *l = (rnd_cvc_list_t *) malloc(sizeof(rnd_cvc_list_t)); + rnd_vector_t v; register double ang, dx, dy; if (!l) @@ -233,21 +233,21 @@ * It still has the same monotonic sort result * and is far less expensive to compute than the real angle. */ - if (vect_equal(v, vect_zero)) { + if (vect_equal(v, rnd_vect_zero)) { if (side == 'P') { - if (a->prev->cvc_prev == (pcb_cvc_list_t *) - 1) + if (a->prev->cvc_prev == (rnd_cvc_list_t *) - 1) a->prev->cvc_prev = a->prev->cvc_next = NULL; - pcb_poly_vertex_exclude(NULL, a->prev); + rnd_poly_vertex_exclude(NULL, a->prev); vect_sub(v, a->prev->point, a->point); } else { - if (a->next->cvc_prev == (pcb_cvc_list_t *) - 1) + if (a->next->cvc_prev == (rnd_cvc_list_t *) - 1) a->next->cvc_prev = a->next->cvc_next = NULL; - pcb_poly_vertex_exclude(NULL, a->next); + rnd_poly_vertex_exclude(NULL, a->next); vect_sub(v, a->next->point, a->point); } } - assert(!vect_equal(v, vect_zero)); + assert(!vect_equal(v, rnd_vect_zero)); dx = fabs((double) v[0]); dy = fabs((double) v[1]); ang = dy / (dy + dx); @@ -276,13 +276,13 @@ 'N' for next. argument start is the head of the list of cvclists */ -static pcb_cvc_list_t *insert_descriptor(pcb_vnode_t * a, char poly, char side, pcb_cvc_list_t * start) +static rnd_cvc_list_t *insert_descriptor(rnd_vnode_t * a, char poly, char side, rnd_cvc_list_t * start) { - pcb_cvc_list_t *l, *newone, *big, *small; + rnd_cvc_list_t *l, *newone, *big, *small; if (!(newone = new_descriptor(a, poly, side))) return NULL; - /* search for the pcb_cvc_list_t for this point */ + /* search for the rnd_cvc_list_t for this point */ if (!start) { start = newone; /* return is also new, so we know where start is */ start->head = newone; /* circular list */ @@ -293,7 +293,7 @@ do { assert(l->head); if (l->parent->point[0] == a->point[0] - && l->parent->point[1] == a->point[1]) { /* this pcb_cvc_list_t is at our point */ + && l->parent->point[1] == a->point[1]) { /* this rnd_cvc_list_t is at our point */ start = l; newone->head = l->head; break; @@ -349,16 +349,16 @@ return 1 if new node in b, 2 if new node in a and 3 if new node in both */ -static pcb_vnode_t *node_add_single_point(pcb_vnode_t * a, pcb_vector_t p) +static rnd_vnode_t *node_add_single_point(rnd_vnode_t * a, rnd_vector_t p) { - pcb_vnode_t *next_a, *new_node; + rnd_vnode_t *next_a, *new_node; next_a = a->next; - new_node = pcb_poly_node_add_single(a, p); + new_node = rnd_poly_node_add_single(a, p); assert(new_node != NULL); - new_node->cvc_prev = new_node->cvc_next = (pcb_cvc_list_t *) - 1; + new_node->cvc_prev = new_node->cvc_next = (rnd_cvc_list_t *) - 1; if (new_node == a || new_node == next_a) return NULL; @@ -370,9 +370,9 @@ node_label (C) 2006 harry eaton */ -static unsigned int node_label(pcb_vnode_t * pn) +static unsigned int node_label(rnd_vnode_t * pn) { - pcb_cvc_list_t *first_l, *l; + rnd_cvc_list_t *first_l, *l; char this_poly; int region = UNKNWN; @@ -437,13 +437,13 @@ add_descriptors (C) 2006 harry eaton */ -static pcb_cvc_list_t *add_descriptors(pcb_pline_t * pl, char poly, pcb_cvc_list_t * list) +static rnd_cvc_list_t *add_descriptors(rnd_pline_t * pl, char poly, rnd_cvc_list_t * list) { - pcb_vnode_t *node = pl->head; + rnd_vnode_t *node = pl->head; do { if (node->cvc_prev) { - assert(node->cvc_prev == (pcb_cvc_list_t *) - 1 && node->cvc_next == (pcb_cvc_list_t *) - 1); + assert(node->cvc_prev == (rnd_cvc_list_t *) - 1 && node->cvc_next == (rnd_cvc_list_t *) - 1); list = node->cvc_prev = insert_descriptor(node, poly, 'P', list); if (!node->cvc_prev) return NULL; @@ -456,7 +456,7 @@ return list; } -static inline void cntrbox_adjust(pcb_pline_t * c, const pcb_vector_t p) +static inline void cntrbox_adjust(rnd_pline_t * c, const rnd_vector_t p) { c->xmin = min(c->xmin, p[0]); c->xmax = max(c->xmax, p[0] + 1); @@ -468,8 +468,8 @@ typedef struct seg { rnd_rnd_box_t box; - pcb_vnode_t *v; - pcb_pline_t *p; + rnd_vnode_t *v; + rnd_pline_t *p; int intersected; } seg; @@ -478,13 +478,13 @@ struct _insert_node_task { insert_node_task *next; seg *node_seg; - pcb_vnode_t *new_node; + rnd_vnode_t *new_node; }; typedef struct info { double m, b; rnd_rtree_t *tree; - pcb_vnode_t *v; + rnd_vnode_t *v; struct seg *s; jmp_buf *env, sego, *touch; int need_restart; @@ -492,7 +492,7 @@ } info; typedef struct contour_info { - pcb_pline_t *pa; + rnd_pline_t *pa; jmp_buf restart; jmp_buf *getout; int need_restart; @@ -559,7 +559,7 @@ } /* Prepend a deferred node-insertion task to a list */ -static insert_node_task *prepend_insert_node_task(insert_node_task * list, seg * seg, pcb_vnode_t * new_node) +static insert_node_task *prepend_insert_node_task(insert_node_task * list, seg * seg, rnd_vnode_t * new_node) { insert_node_task *task = (insert_node_task *) malloc(sizeof(*task)); task->node_seg = seg; @@ -583,9 +583,9 @@ { struct info *i = (struct info *) cl; struct seg *s = (struct seg *) b; - pcb_vector_t s1, s2; + rnd_vector_t s1, s2; int cnt; - pcb_vnode_t *new_node; + rnd_vnode_t *new_node; /* When new nodes are added at the end of a pass due to an intersection * the segments may be altered. If either segment we're looking at has @@ -594,7 +594,7 @@ if (s->intersected || i->s->intersected) return PCB_R_DIR_NOT_FOUND; - cnt = pcb_vect_inters2(s->v->point, s->v->next->point, i->v->point, i->v->next->point, s1, s2); + cnt = rnd_vect_inters2(s->v->point, s->v->next->point, i->v->point, i->v->next->point, s1, s2); if (!cnt) return PCB_R_DIR_NOT_FOUND; if (i->touch) /* if checking touches one find and we're done */ @@ -630,10 +630,10 @@ return PCB_R_DIR_NOT_FOUND; } -void *pcb_poly_make_edge_tree(pcb_pline_t *pb) +void *rnd_poly_make_edge_tree(rnd_pline_t *pb) { struct seg *s; - pcb_vnode_t *bv; + rnd_vnode_t *bv; rnd_rtree_t *ans = pcb_r_create_tree(); bv = pb->head; do { @@ -695,11 +695,11 @@ static pcb_r_dir_t contour_bounds_touch(const rnd_rnd_box_t * b, void *cl) { contour_info *c_info = (contour_info *) cl; - pcb_pline_t *pa = c_info->pa; - pcb_pline_t *pb = (pcb_pline_t *) b; - pcb_pline_t *rtree_over; - pcb_pline_t *looping_over; - pcb_vnode_t *av; /* node iterators */ + rnd_pline_t *pa = c_info->pa; + rnd_pline_t *pb = (rnd_pline_t *) b; + rnd_pline_t *rtree_over; + rnd_pline_t *looping_over; + rnd_vnode_t *av; /* node iterators */ struct info info; rnd_rnd_box_t box; jmp_buf restart; @@ -771,7 +771,7 @@ static int intersect_impl(jmp_buf * jb, rnd_polyarea_t * b, rnd_polyarea_t * a, int add) { rnd_polyarea_t *t; - pcb_pline_t *pa; + rnd_pline_t *pa; contour_info c_info; int need_restart = 0; insert_node_task *task; @@ -851,11 +851,11 @@ static void M_pcb_polyarea_t_intersect(jmp_buf * e, rnd_polyarea_t * afst, rnd_polyarea_t * bfst, int add) { rnd_polyarea_t *a = afst, *b = bfst; - pcb_pline_t *curcA, *curcB; - pcb_cvc_list_t *the_list = NULL; + rnd_pline_t *curcA, *curcB; + rnd_cvc_list_t *the_list = NULL; if (a == NULL || b == NULL) - error(pcb_err_bad_parm); + error(rnd_err_bad_parm); do { do { if (a->contours->xmax >= b->contours->xmin && @@ -862,7 +862,7 @@ a->contours->ymax >= b->contours->ymin && a->contours->xmin <= b->contours->xmax && a->contours->ymin <= b->contours->ymax) { if (RND_UNLIKELY(intersect(e, a, b, add))) - error(pcb_err_no_memory); + error(rnd_err_no_memory); } } while (add && (a = a->f) != afst); @@ -870,7 +870,7 @@ if (curcB->Flags.status == ISECTED) { the_list = add_descriptors(curcB, 'B', the_list); if (RND_UNLIKELY(the_list == NULL)) - error(pcb_err_no_memory); + error(rnd_err_no_memory); } } while (add && (b = b->f) != bfst); @@ -879,13 +879,13 @@ if (curcA->Flags.status == ISECTED) { the_list = add_descriptors(curcA, 'A', the_list); if (RND_UNLIKELY(the_list == NULL)) - error(pcb_err_no_memory); + error(rnd_err_no_memory); } } while (add && (a = a->f) != afst); } /* M_pcb_polyarea_t_intersect */ -static inline int cntrbox_inside(pcb_pline_t * c1, pcb_pline_t * c2) +static inline int cntrbox_inside(rnd_pline_t * c1, rnd_pline_t * c2) { assert(c1 != NULL && c2 != NULL); return ((c1->xmin >= c2->xmin) && (c1->ymin >= c2->ymin) && (c1->xmax <= c2->xmax) && (c1->ymax <= c2->ymax)); @@ -896,10 +896,10 @@ static pcb_r_dir_t count_contours_i_am_inside(const rnd_rnd_box_t * b, void *cl) { - pcb_pline_t *me = (pcb_pline_t *) cl; - pcb_pline_t *check = (pcb_pline_t *) b; + rnd_pline_t *me = (rnd_pline_t *) cl; + rnd_pline_t *check = (rnd_pline_t *) b; - if (pcb_poly_contour_in_contour(check, me)) + if (rnd_poly_contour_in_contour(check, me)) return PCB_R_DIR_FOUND_CONTINUE; return PCB_R_DIR_NOT_FOUND; } @@ -906,7 +906,7 @@ /* cntr_in_M_pcb_polyarea_t returns poly is inside outfst ? rnd_true : rnd_false */ -static int cntr_in_M_pcb_polyarea_t(pcb_pline_t * poly, rnd_polyarea_t * outfst, rnd_bool test) +static int cntr_in_M_pcb_polyarea_t(rnd_pline_t * poly, rnd_polyarea_t * outfst, rnd_bool test) { rnd_polyarea_t *outer = outfst; rnd_heap_t *heap; @@ -953,7 +953,7 @@ #ifdef DEBUG -static char *theState(pcb_vnode_t * v) +static char *theState(rnd_vnode_t * v) { static char u[] = "UNKNOWN"; static char i[] = "INSIDE"; @@ -976,9 +976,9 @@ } #ifdef DEBUG_ALL_LABELS -static void print_labels(pcb_pline_t * a) +static void print_labels(rnd_pline_t * a) { - pcb_vnode_t *c = a->head; + rnd_vnode_t *c = a->head; do { DEBUGP("%#mD->%#mD labeled %s\n", c->point[0], c->point[1], c->next->point[0], c->next->point[1], theState(c)); @@ -995,10 +995,10 @@ (C) 1997 Alexey Nikitin, Michael Leonov */ -static rnd_bool label_contour(pcb_pline_t * a) +static rnd_bool label_contour(rnd_pline_t * a) { - pcb_vnode_t *cur = a->head; - pcb_vnode_t *first_labelled = NULL; + rnd_vnode_t *cur = a->head; + rnd_vnode_t *first_labelled = NULL; int label = UNKNWN; do { @@ -1024,7 +1024,7 @@ return rnd_false; } /* label_contour */ -static rnd_bool cntr_label_pcb_polyarea_t(pcb_pline_t * poly, rnd_polyarea_t * ppl, rnd_bool test) +static rnd_bool cntr_label_pcb_polyarea_t(rnd_pline_t * poly, rnd_polyarea_t * ppl, rnd_bool test) { assert(ppl != NULL && ppl->contours != NULL); if (poly->Flags.status == ISECTED) { @@ -1043,9 +1043,9 @@ return rnd_false; } /* cntr_label_pcb_polyarea_t */ -static rnd_bool M_pcb_polyarea_t_label_separated(pcb_pline_t * afst, rnd_polyarea_t * b, rnd_bool touch) +static rnd_bool M_pcb_polyarea_t_label_separated(rnd_pline_t * afst, rnd_polyarea_t * b, rnd_bool touch) { - pcb_pline_t *curc = afst; + rnd_pline_t *curc = afst; for (curc = afst; curc != NULL; curc = curc->next) { if (cntr_label_pcb_polyarea_t(curc, b, touch) && touch) @@ -1057,7 +1057,7 @@ static rnd_bool M_pcb_polyarea_t_label(rnd_polyarea_t * afst, rnd_polyarea_t * b, rnd_bool touch) { rnd_polyarea_t *a = afst; - pcb_pline_t *curc; + rnd_pline_t *curc; assert(a != NULL); do { @@ -1074,7 +1074,7 @@ /****************************************************************/ /* routines for temporary storing resulting contours */ -static void InsCntr(jmp_buf * e, pcb_pline_t * c, rnd_polyarea_t ** dst) +static void InsCntr(jmp_buf * e, rnd_pline_t * c, rnd_polyarea_t ** dst) { rnd_polyarea_t *newp; @@ -1096,14 +1096,14 @@ } /* InsCntr */ static void -PutContour(jmp_buf * e, pcb_pline_t * cntr, rnd_polyarea_t ** contours, pcb_pline_t ** holes, - rnd_polyarea_t * owner, rnd_polyarea_t * parent, pcb_pline_t * parent_contour) +PutContour(jmp_buf * e, rnd_pline_t * cntr, rnd_polyarea_t ** contours, rnd_pline_t ** holes, + rnd_polyarea_t * owner, rnd_polyarea_t * parent, rnd_pline_t * parent_contour) { assert(cntr != NULL); assert(cntr->Count > 2); cntr->next = NULL; - if (cntr->Flags.orient == PCB_PLF_DIR) { + if (cntr->Flags.orient == RND_PLF_DIR) { if (owner != NULL) pcb_r_delete_entry(owner->contour_tree, (rnd_rnd_box_t *) cntr); InsCntr(e, cntr, contours); @@ -1131,7 +1131,7 @@ } } /* PutContour */ -static inline void remove_contour(rnd_polyarea_t * piece, pcb_pline_t * prev_contour, pcb_pline_t * contour, int remove_rtree_entry) +static inline void remove_contour(rnd_polyarea_t * piece, rnd_pline_t * prev_contour, rnd_pline_t * contour, int remove_rtree_entry) { if (piece->contours == contour) piece->contours = contour->next; @@ -1155,7 +1155,7 @@ { rnd_heap_t *heap = (rnd_heap_t *) cl; struct polyarea_info *pa_info = (struct polyarea_info *) b; - pcb_pline_t *p = pa_info->pa->contours; + rnd_pline_t *p = pa_info->pa->contours; if (p->Count == 0) return PCB_R_DIR_NOT_FOUND; /* how did this happen? */ rnd_heap_insert(heap, p->area, pa_info); @@ -1164,20 +1164,20 @@ struct find_inside_info { jmp_buf jb; - pcb_pline_t *want_inside; - pcb_pline_t *result; + rnd_pline_t *want_inside; + rnd_pline_t *result; }; static pcb_r_dir_t find_inside(const rnd_rnd_box_t * b, void *cl) { struct find_inside_info *info = (struct find_inside_info *) cl; - pcb_pline_t *check = (pcb_pline_t *) b; + rnd_pline_t *check = (rnd_pline_t *) b; /* Do test on check to see if it inside info->want_inside */ /* If it is: */ - if (check->Flags.orient == PCB_PLF_DIR) { + if (check->Flags.orient == RND_PLF_DIR) { return PCB_R_DIR_NOT_FOUND; } - if (pcb_poly_contour_in_contour(info->want_inside, check)) { + if (rnd_poly_contour_in_contour(info->want_inside, check)) { info->result = check; longjmp(info->jb, 1); } @@ -1184,10 +1184,10 @@ return PCB_R_DIR_NOT_FOUND; } -void pcb_poly_insert_holes(jmp_buf * e, rnd_polyarea_t * dest, pcb_pline_t ** src) +void pcb_poly_insert_holes(jmp_buf * e, rnd_polyarea_t * dest, rnd_pline_t ** src) { rnd_polyarea_t *curc; - pcb_pline_t *curh, *container; + rnd_pline_t *curh, *container; rnd_heap_t *heap; rnd_rtree_t *tree; int i; @@ -1197,7 +1197,7 @@ if (*src == NULL) return; /* empty hole list */ if (dest == NULL) - error(pcb_err_bad_parm); /* empty contour list */ + error(rnd_err_bad_parm); /* empty contour list */ /* Count dest polyareas */ curc = dest; @@ -1237,8 +1237,8 @@ poly_dump(dest); #endif #endif - pcb_poly_contour_del(&curh); - error(pcb_err_bad_parm); + rnd_poly_contour_del(&curh); + error(rnd_err_bad_parm); } /* Now search the heap for the container. If there was only one item * in the heap, assume it is the container without the expense of @@ -1246,12 +1246,12 @@ */ pa_info = (struct polyarea_info *) rnd_heap_remove_smallest(heap); if (rnd_heap_is_empty(heap)) { /* only one possibility it must be the right one */ - assert(pcb_poly_contour_in_contour(pa_info->pa->contours, curh)); + assert(rnd_poly_contour_in_contour(pa_info->pa->contours, curh)); container = pa_info->pa->contours; } else { do { - if (pcb_poly_contour_in_contour(pa_info->pa->contours, curh)) { + if (rnd_poly_contour_in_contour(pa_info->pa->contours, curh)) { container = pa_info->pa->contours; break; } @@ -1270,14 +1270,14 @@ #endif #endif curh->next = NULL; - pcb_poly_contour_del(&curh); - error(pcb_err_bad_parm); + rnd_poly_contour_del(&curh); + error(rnd_err_bad_parm); } else { /* Need to check if this new hole means we need to kick out any old ones for reprocessing */ while (1) { struct find_inside_info info; - pcb_pline_t *prev; + rnd_pline_t *prev; info.want_inside = curh; @@ -1330,30 +1330,30 @@ } DIRECTION; /* Start Rule */ -typedef int (*S_Rule) (pcb_vnode_t *, DIRECTION *); +typedef int (*S_Rule) (rnd_vnode_t *, DIRECTION *); /* Jump Rule */ -typedef int (*J_Rule) (char, pcb_vnode_t *, DIRECTION *); +typedef int (*J_Rule) (char, rnd_vnode_t *, DIRECTION *); -static int UniteS_Rule(pcb_vnode_t * cur, DIRECTION * initdir) +static int UniteS_Rule(rnd_vnode_t * cur, DIRECTION * initdir) { *initdir = FORW; return (NODE_LABEL(cur) == OUTSIDE) || (NODE_LABEL(cur) == SHARED); } -static int IsectS_Rule(pcb_vnode_t * cur, DIRECTION * initdir) +static int IsectS_Rule(rnd_vnode_t * cur, DIRECTION * initdir) { *initdir = FORW; return (NODE_LABEL(cur) == INSIDE) || (NODE_LABEL(cur) == SHARED); } -static int SubS_Rule(pcb_vnode_t * cur, DIRECTION * initdir) +static int SubS_Rule(rnd_vnode_t * cur, DIRECTION * initdir) { *initdir = FORW; return (NODE_LABEL(cur) == OUTSIDE) || (NODE_LABEL(cur) == SHARED2); } -static int XorS_Rule(pcb_vnode_t * cur, DIRECTION * initdir) +static int XorS_Rule(rnd_vnode_t * cur, DIRECTION * initdir) { if (cur->Flags.status == INSIDE) { *initdir = BACKW; @@ -1366,19 +1366,19 @@ return rnd_false; } -static int IsectJ_Rule(char p, pcb_vnode_t * v, DIRECTION * cdir) +static int IsectJ_Rule(char p, rnd_vnode_t * v, DIRECTION * cdir) { assert(*cdir == FORW); return (v->Flags.status == INSIDE || v->Flags.status == SHARED); } -static int UniteJ_Rule(char p, pcb_vnode_t * v, DIRECTION * cdir) +static int UniteJ_Rule(char p, rnd_vnode_t * v, DIRECTION * cdir) { assert(*cdir == FORW); return (v->Flags.status == OUTSIDE || v->Flags.status == SHARED); } -static int XorJ_Rule(char p, pcb_vnode_t * v, DIRECTION * cdir) +static int XorJ_Rule(char p, rnd_vnode_t * v, DIRECTION * cdir) { if (v->Flags.status == INSIDE) { *cdir = BACKW; @@ -1391,7 +1391,7 @@ return rnd_false; } -static int SubJ_Rule(char p, pcb_vnode_t * v, DIRECTION * cdir) +static int SubJ_Rule(char p, rnd_vnode_t * v, DIRECTION * cdir) { if (p == 'B' && v->Flags.status == INSIDE) { *cdir = BACKW; @@ -1417,10 +1417,10 @@ * * returns rnd_true if an edge is found, rnd_false otherwise */ -static int jump(pcb_vnode_t ** cur, DIRECTION * cdir, J_Rule rule) +static int jump(rnd_vnode_t ** cur, DIRECTION * cdir, J_Rule rule) { - pcb_cvc_list_t *d, *start; - pcb_vnode_t *e; + rnd_cvc_list_t *d, *start; + rnd_vnode_t *e; DIRECTION newone; if (!(*cur)->cvc_prev) { /* not a cross-vertex */ @@ -1459,9 +1459,9 @@ return rnd_false; } -static int Gather(pcb_vnode_t * start, pcb_pline_t ** result, J_Rule v_rule, DIRECTION initdir) +static int Gather(rnd_vnode_t * start, rnd_pline_t ** result, J_Rule v_rule, DIRECTION initdir) { - pcb_vnode_t *cur = start, *newn; + rnd_vnode_t *cur = start, *newn; DIRECTION dir = initdir; #ifdef DEBUG_GATHER DEBUGP("gather direction = %d\n", dir); @@ -1473,14 +1473,14 @@ break; /* add edge to polygon */ if (!*result) { - *result = pcb_poly_contour_new(cur->point); + *result = rnd_poly_contour_new(cur->point); if (*result == NULL) - return pcb_err_no_memory; + return rnd_err_no_memory; } else { - if ((newn = pcb_poly_node_create(cur->point)) == NULL) - return pcb_err_no_memory; - pcb_poly_vertex_include((*result)->head->prev, newn); + if ((newn = rnd_poly_node_create(cur->point)) == NULL) + return rnd_err_no_memory; + rnd_poly_vertex_include((*result)->head->prev, newn); } #ifdef DEBUG_GATHER DEBUGP("gather vertex at %#mD\n", cur->point[0], cur->point[1]); @@ -1496,21 +1496,21 @@ cur = (dir == FORW ? cur->next : cur->prev); } while (1); - return pcb_err_ok; + return rnd_err_ok; } /* Gather */ -static void Collect1(jmp_buf * e, pcb_vnode_t * cur, DIRECTION dir, rnd_polyarea_t ** contours, pcb_pline_t ** holes, J_Rule j_rule) +static void Collect1(jmp_buf * e, rnd_vnode_t * cur, DIRECTION dir, rnd_polyarea_t ** contours, rnd_pline_t ** holes, J_Rule j_rule) { - pcb_pline_t *p = NULL; /* start making contour */ - int errc = pcb_err_ok; - if ((errc = Gather(dir == FORW ? cur : cur->next, &p, j_rule, dir)) != pcb_err_ok) { + rnd_pline_t *p = NULL; /* start making contour */ + int errc = rnd_err_ok; + if ((errc = Gather(dir == FORW ? cur : cur->next, &p, j_rule, dir)) != rnd_err_ok) { if (p != NULL) - pcb_poly_contour_del(&p); + rnd_poly_contour_del(&p); error(errc); } if (!p) return; - pcb_poly_contour_pre(p, rnd_true); + rnd_poly_contour_pre(p, rnd_true); if (p->Count > 2) { #ifdef DEBUG_GATHER DEBUGP("adding contour with %d vertices and direction %c\n", p->Count, p->Flags.orient ? 'F' : 'B'); @@ -1522,13 +1522,13 @@ #ifdef DEBUG_GATHER DEBUGP("Bad contour! Not enough points!!\n"); #endif - pcb_poly_contour_del(&p); + rnd_poly_contour_del(&p); } } -static void Collect(jmp_buf * e, pcb_pline_t * a, rnd_polyarea_t ** contours, pcb_pline_t ** holes, S_Rule s_rule, J_Rule j_rule) +static void Collect(jmp_buf * e, rnd_pline_t * a, rnd_polyarea_t ** contours, rnd_pline_t ** holes, S_Rule s_rule, J_Rule j_rule) { - pcb_vnode_t *cur, *other; + rnd_vnode_t *cur, *other; DIRECTION dir; cur = a->head; @@ -1544,23 +1544,23 @@ static int -cntr_Collect(jmp_buf * e, pcb_pline_t ** A, rnd_polyarea_t ** contours, pcb_pline_t ** holes, - int action, rnd_polyarea_t * owner, rnd_polyarea_t * parent, pcb_pline_t * parent_contour) +cntr_Collect(jmp_buf * e, rnd_pline_t ** A, rnd_polyarea_t ** contours, rnd_pline_t ** holes, + int action, rnd_polyarea_t * owner, rnd_polyarea_t * parent, rnd_pline_t * parent_contour) { - pcb_pline_t *tmprev; + rnd_pline_t *tmprev; if ((*A)->Flags.status == ISECTED) { switch (action) { - case PCB_PBO_UNITE: + case RND_PBO_UNITE: Collect(e, *A, contours, holes, UniteS_Rule, UniteJ_Rule); break; - case PCB_PBO_ISECT: + case RND_PBO_ISECT: Collect(e, *A, contours, holes, IsectS_Rule, IsectJ_Rule); break; - case PCB_PBO_XOR: + case RND_PBO_XOR: Collect(e, *A, contours, holes, XorS_Rule, XorJ_Rule); break; - case PCB_PBO_SUB: + case RND_PBO_SUB: Collect(e, *A, contours, holes, SubS_Rule, SubJ_Rule); break; }; @@ -1567,7 +1567,7 @@ } else { switch (action) { - case PCB_PBO_ISECT: + case RND_PBO_ISECT: if ((*A)->Flags.status == INSIDE) { tmprev = *A; /* disappear this contour (rtree entry removed in PutContour) */ @@ -1577,19 +1577,19 @@ return rnd_true; } break; - case PCB_PBO_XOR: + case RND_PBO_XOR: if ((*A)->Flags.status == INSIDE) { tmprev = *A; /* disappear this contour (rtree entry removed in PutContour) */ *A = tmprev->next; tmprev->next = NULL; - pcb_poly_contour_inv(tmprev); + rnd_poly_contour_inv(tmprev); PutContour(e, tmprev, contours, holes, owner, NULL, NULL); return rnd_true; } /* break; *//* Fall through (I think this is correct! pcjc2) */ - case PCB_PBO_UNITE: - case PCB_PBO_SUB: + case RND_PBO_UNITE: + case RND_PBO_SUB: if ((*A)->Flags.status == OUTSIDE) { tmprev = *A; /* disappear this contour (rtree entry removed in PutContour) */ @@ -1604,10 +1604,10 @@ return rnd_false; } /* cntr_Collect */ -static void M_B_AREA_Collect(jmp_buf * e, rnd_polyarea_t * bfst, rnd_polyarea_t ** contours, pcb_pline_t ** holes, int action) +static void M_B_AREA_Collect(jmp_buf * e, rnd_polyarea_t * bfst, rnd_polyarea_t ** contours, rnd_pline_t ** holes, int action) { rnd_polyarea_t *b = bfst; - pcb_pline_t **cur, **next, *tmp; + rnd_pline_t **cur, **next, *tmp; assert(b != NULL); do { @@ -1618,10 +1618,10 @@ if ((*cur)->Flags.status == INSIDE) switch (action) { - case PCB_PBO_XOR: - case PCB_PBO_SUB: - pcb_poly_contour_inv(*cur); - case PCB_PBO_ISECT: + case RND_PBO_XOR: + case RND_PBO_SUB: + rnd_poly_contour_inv(*cur); + case RND_PBO_ISECT: tmp = *cur; *cur = tmp->next; next = cur; @@ -1629,13 +1629,13 @@ tmp->Flags.status = UNKNWN; PutContour(e, tmp, contours, holes, b, NULL, NULL); break; - case PCB_PBO_UNITE: + case RND_PBO_UNITE: break; /* nothing to do - already included */ } else if ((*cur)->Flags.status == OUTSIDE) switch (action) { - case PCB_PBO_XOR: - case PCB_PBO_UNITE: + case RND_PBO_XOR: + case RND_PBO_UNITE: /* include */ tmp = *cur; *cur = tmp->next; @@ -1644,8 +1644,8 @@ tmp->Flags.status = UNKNWN; PutContour(e, tmp, contours, holes, b, NULL, NULL); break; - case PCB_PBO_ISECT: - case PCB_PBO_SUB: + case RND_PBO_ISECT: + case RND_PBO_SUB: break; /* do nothing, not included */ } } @@ -1654,13 +1654,13 @@ } -static inline int contour_is_first(rnd_polyarea_t * a, pcb_pline_t * cur) +static inline int contour_is_first(rnd_polyarea_t * a, rnd_pline_t * cur) { return (a->contours == cur); } -static inline int contour_is_last(pcb_pline_t * cur) +static inline int contour_is_last(rnd_pline_t * cur) { return (cur->next == NULL); } @@ -1681,11 +1681,11 @@ piece->f = piece->b = piece; } -static void M_pcb_polyarea_separate_isected(jmp_buf * e, rnd_polyarea_t ** pieces, pcb_pline_t ** holes, pcb_pline_t ** isected) +static void M_pcb_polyarea_separate_isected(jmp_buf * e, rnd_polyarea_t ** pieces, rnd_pline_t ** holes, rnd_pline_t ** isected) { rnd_polyarea_t *a = *pieces; rnd_polyarea_t *anext; - pcb_pline_t *curc, *next, *prev; + rnd_pline_t *curc, *next, *prev; int finished; if (a == NULL) @@ -1733,7 +1733,7 @@ if (is_first && is_last) { remove_polyarea(pieces, a); - pcb_polyarea_free(&a); /* NB: Sets a to NULL */ + rnd_polyarea_free(&a); /* NB: Sets a to NULL */ } } @@ -1760,15 +1760,15 @@ struct find_inside_m_pa_info { jmp_buf jb; rnd_polyarea_t *want_inside; - pcb_pline_t *result; + rnd_pline_t *result; }; static pcb_r_dir_t find_inside_m_pa(const rnd_rnd_box_t * b, void *cl) { struct find_inside_m_pa_info *info = (struct find_inside_m_pa_info *) cl; - pcb_pline_t *check = (pcb_pline_t *) b; + rnd_pline_t *check = (rnd_pline_t *) b; /* Don't report for the main contour */ - if (check->Flags.orient == PCB_PLF_DIR) + if (check->Flags.orient == RND_PLF_DIR) return PCB_R_DIR_NOT_FOUND; /* Don't look at contours marked as being intersected */ if (check->Flags.status == ISECTED) @@ -1781,12 +1781,12 @@ } -static void M_pcb_polyarea_t_update_primary(jmp_buf * e, rnd_polyarea_t ** pieces, pcb_pline_t ** holes, int action, rnd_polyarea_t * bpa) +static void M_pcb_polyarea_t_update_primary(jmp_buf * e, rnd_polyarea_t ** pieces, rnd_pline_t ** holes, int action, rnd_polyarea_t * bpa) { rnd_polyarea_t *a = *pieces; rnd_polyarea_t *b; rnd_polyarea_t *anext; - pcb_pline_t *curc, *next, *prev; + rnd_pline_t *curc, *next, *prev; rnd_rnd_box_t box; /* int inv_inside = 0; */ int del_inside = 0; @@ -1797,14 +1797,14 @@ return; switch (action) { - case PCB_PBO_ISECT: + case RND_PBO_ISECT: del_outside = 1; break; - case PCB_PBO_UNITE: - case PCB_PBO_SUB: + case RND_PBO_UNITE: + case RND_PBO_SUB: del_inside = 1; break; - case PCB_PBO_XOR: /* NOT IMPLEMENTED OR USED */ + case RND_PBO_XOR: /* NOT IMPLEMENTED OR USED */ /* inv_inside = 1; */ assert(0); break; @@ -1843,7 +1843,7 @@ curc = a->contours; remove_contour(a, NULL, curc, rnd_false); /* Rtree deleted in poly_Free below */ /* a->contours now points to the remaining holes */ - pcb_poly_contour_del(&curc); + rnd_poly_contour_del(&curc); if (a->contours != NULL) { /* Find the end of the list of holes */ @@ -1858,7 +1858,7 @@ } remove_polyarea(pieces, a); - pcb_polyarea_free(&a); /* NB: Sets a to NULL */ + rnd_polyarea_free(&a); /* NB: Sets a to NULL */ continue; } @@ -1866,7 +1866,7 @@ /* Loop whilst we find INSIDE contours to delete */ while (1) { struct find_inside_m_pa_info info; - pcb_pline_t *prev; + rnd_pline_t *prev; info.want_inside = bpa; @@ -1894,7 +1894,7 @@ /* Remove hole from the contour */ remove_contour(a, prev, info.result, rnd_true); - pcb_poly_contour_del(&info.result); + rnd_poly_contour_del(&info.result); } /* End check for deleted holes */ @@ -1941,7 +1941,7 @@ if (del_contour) { /* Delete the contour */ - pcb_poly_contour_del(&curc); /* NB: Sets curc to NULL */ + rnd_poly_contour_del(&curc); /* NB: Sets curc to NULL */ } else if (hole_contour) { /* Link into the list of holes */ @@ -1954,7 +1954,7 @@ if (is_first && is_last) { remove_polyarea(pieces, a); - pcb_polyarea_free(&a); /* NB: Sets a to NULL */ + rnd_polyarea_free(&a); /* NB: Sets a to NULL */ } } @@ -1978,9 +1978,9 @@ } static void -M_pcb_polyarea_t_Collect_separated(jmp_buf * e, pcb_pline_t * afst, rnd_polyarea_t ** contours, pcb_pline_t ** holes, int action, rnd_bool maybe) +M_pcb_polyarea_t_Collect_separated(jmp_buf * e, rnd_pline_t * afst, rnd_polyarea_t ** contours, rnd_pline_t ** holes, int action, rnd_bool maybe) { - pcb_pline_t **cur, **next; + rnd_pline_t **cur, **next; for (cur = &afst; *cur != NULL; cur = next) { next = &((*cur)->next); @@ -1990,11 +1990,11 @@ } } -static void M_pcb_polyarea_t_Collect(jmp_buf * e, rnd_polyarea_t * afst, rnd_polyarea_t ** contours, pcb_pline_t ** holes, int action, rnd_bool maybe) +static void M_pcb_polyarea_t_Collect(jmp_buf * e, rnd_polyarea_t * afst, rnd_polyarea_t ** contours, rnd_pline_t ** holes, int action, rnd_bool maybe) { rnd_polyarea_t *a = afst; rnd_polyarea_t *parent = NULL; /* Quiet compiler warning */ - pcb_pline_t **cur, **next, *parent_contour; + rnd_pline_t **cur, **next, *parent_contour; assert(a != NULL); while ((a = a->f) != afst); @@ -2031,7 +2031,7 @@ } /* determine if two polygons touch or overlap */ -rnd_bool pcb_polyarea_touching(rnd_polyarea_t * a, rnd_polyarea_t * b) +rnd_bool rnd_polyarea_touching(rnd_polyarea_t * a, rnd_polyarea_t * b) { jmp_buf e; int code; @@ -2038,9 +2038,9 @@ if ((code = setjmp(e)) == 0) { #ifdef DEBUG - if (!pcb_poly_valid(a)) + if (!rnd_poly_valid(a)) return -1; - if (!pcb_poly_valid(b)) + if (!rnd_poly_valid(b)) return -1; #endif M_pcb_polyarea_t_intersect(&e, a, b, rnd_false); @@ -2056,22 +2056,22 @@ } /* the main clipping routines */ -int pcb_polyarea_boolean(const rnd_polyarea_t * a_org, const rnd_polyarea_t * b_org, rnd_polyarea_t ** res, int action) +int rnd_polyarea_boolean(const rnd_polyarea_t * a_org, const rnd_polyarea_t * b_org, rnd_polyarea_t ** res, int action) { rnd_polyarea_t *a = NULL, *b = NULL; - if (!pcb_polyarea_m_copy0(&a, a_org) || !pcb_polyarea_m_copy0(&b, b_org)) - return pcb_err_no_memory; + if (!rnd_polyarea_m_copy0(&a, a_org) || !rnd_polyarea_m_copy0(&b, b_org)) + return rnd_err_no_memory; - return pcb_polyarea_boolean_free(a, b, res, action); + return rnd_polyarea_boolean_free(a, b, res, action); } /* poly_Boolean */ /* just like poly_Boolean but frees the input polys */ -int pcb_polyarea_boolean_free(rnd_polyarea_t * ai, rnd_polyarea_t * bi, rnd_polyarea_t ** res, int action) +int rnd_polyarea_boolean_free(rnd_polyarea_t * ai, rnd_polyarea_t * bi, rnd_polyarea_t ** res, int action) { rnd_polyarea_t *a = ai, *b = bi; - pcb_pline_t *a_isected = NULL; - pcb_pline_t *p, *holes = NULL; + rnd_pline_t *a_isected = NULL; + rnd_pline_t *p, *holes = NULL; jmp_buf e; int code; @@ -2079,35 +2079,35 @@ if (!a) { switch (action) { - case PCB_PBO_XOR: - case PCB_PBO_UNITE: + case RND_PBO_XOR: + case RND_PBO_UNITE: *res = bi; - return pcb_err_ok; - case PCB_PBO_SUB: - case PCB_PBO_ISECT: + return rnd_err_ok; + case RND_PBO_SUB: + case RND_PBO_ISECT: if (b != NULL) - pcb_polyarea_free(&b); - return pcb_err_ok; + rnd_polyarea_free(&b); + return rnd_err_ok; } } if (!b) { switch (action) { - case PCB_PBO_SUB: - case PCB_PBO_XOR: - case PCB_PBO_UNITE: + case RND_PBO_SUB: + case RND_PBO_XOR: + case RND_PBO_UNITE: *res = ai; - return pcb_err_ok; - case PCB_PBO_ISECT: + return rnd_err_ok; + case RND_PBO_ISECT: if (a != NULL) - pcb_polyarea_free(&a); - return pcb_err_ok; + rnd_polyarea_free(&a); + return rnd_err_ok; } } if ((code = setjmp(e)) == 0) { #ifdef DEBUG - assert(pcb_poly_valid(a)); - assert(pcb_poly_valid(b)); + assert(rnd_poly_valid(a)); + assert(rnd_poly_valid(b)); #endif /* intersect needs to make a list of the contours in a and b which are intersected */ @@ -2123,12 +2123,12 @@ M_pcb_polyarea_t_label_separated(a_isected, b, rnd_false); M_pcb_polyarea_t_Collect_separated(&e, a_isected, res, &holes, action, rnd_false); M_B_AREA_Collect(&e, b, res, &holes, action); - pcb_polyarea_free(&b); + rnd_polyarea_free(&b); /* free a_isected */ while ((p = a_isected) != NULL) { a_isected = p->next; - pcb_poly_contour_del(&p); + rnd_poly_contour_del(&p); } pcb_poly_insert_holes(&e, *res, &holes); @@ -2136,14 +2136,14 @@ /* delete holes if any left */ while ((p = holes) != NULL) { holes = p->next; - pcb_poly_contour_del(&p); + rnd_poly_contour_del(&p); } if (code) { - pcb_polyarea_free(res); + rnd_polyarea_free(res); return code; } - assert(!*res || pcb_poly_valid(*res)); + assert(!*res || rnd_poly_valid(*res)); return code; } /* poly_Boolean_free */ @@ -2150,8 +2150,8 @@ static void clear_marks(rnd_polyarea_t * p) { rnd_polyarea_t *n = p; - pcb_pline_t *c; - pcb_vnode_t *v; + rnd_pline_t *c; + rnd_vnode_t *v; do { for (c = n->contours; c; c = c->next) { @@ -2168,10 +2168,10 @@ /* compute the intersection and subtraction (divides "a" into two pieces) * and frees the input polys. This assumes that bi is a single simple polygon. */ -int pcb_polyarea_and_subtract_free(rnd_polyarea_t * ai, rnd_polyarea_t * bi, rnd_polyarea_t ** aandb, rnd_polyarea_t ** aminusb) +int rnd_polyarea_and_subtract_free(rnd_polyarea_t * ai, rnd_polyarea_t * bi, rnd_polyarea_t ** aandb, rnd_polyarea_t ** aminusb) { rnd_polyarea_t *a = ai, *b = bi; - pcb_pline_t *p, *holes = NULL; + rnd_pline_t *p, *holes = NULL; jmp_buf e; int code; @@ -2181,9 +2181,9 @@ if ((code = setjmp(e)) == 0) { #ifdef DEBUG - if (!pcb_poly_valid(a)) + if (!rnd_poly_valid(a)) return -1; - if (!pcb_poly_valid(b)) + if (!rnd_poly_valid(b)) return -1; #endif M_pcb_polyarea_t_intersect(&e, a, b, rnd_true); @@ -2191,60 +2191,60 @@ M_pcb_polyarea_t_label(a, b, rnd_false); M_pcb_polyarea_t_label(b, a, rnd_false); - M_pcb_polyarea_t_Collect(&e, a, aandb, &holes, PCB_PBO_ISECT, rnd_false); + M_pcb_polyarea_t_Collect(&e, a, aandb, &holes, RND_PBO_ISECT, rnd_false); pcb_poly_insert_holes(&e, *aandb, &holes); - assert(pcb_poly_valid(*aandb)); + assert(rnd_poly_valid(*aandb)); /* delete holes if any left */ while ((p = holes) != NULL) { holes = p->next; - pcb_poly_contour_del(&p); + rnd_poly_contour_del(&p); } holes = NULL; clear_marks(a); clear_marks(b); - M_pcb_polyarea_t_Collect(&e, a, aminusb, &holes, PCB_PBO_SUB, rnd_false); + M_pcb_polyarea_t_Collect(&e, a, aminusb, &holes, RND_PBO_SUB, rnd_false); pcb_poly_insert_holes(&e, *aminusb, &holes); - pcb_polyarea_free(&a); - pcb_polyarea_free(&b); - assert(pcb_poly_valid(*aminusb)); + rnd_polyarea_free(&a); + rnd_polyarea_free(&b); + assert(rnd_poly_valid(*aminusb)); } /* delete holes if any left */ while ((p = holes) != NULL) { holes = p->next; - pcb_poly_contour_del(&p); + rnd_poly_contour_del(&p); } if (code) { - pcb_polyarea_free(aandb); - pcb_polyarea_free(aminusb); + rnd_polyarea_free(aandb); + rnd_polyarea_free(aminusb); return code; } - assert(!*aandb || pcb_poly_valid(*aandb)); - assert(!*aminusb || pcb_poly_valid(*aminusb)); + assert(!*aandb || rnd_poly_valid(*aandb)); + assert(!*aminusb || rnd_poly_valid(*aminusb)); return code; } /* poly_AndSubtract_free */ -static inline int cntrbox_pointin(const pcb_pline_t *c, const pcb_vector_t p) +static inline int cntrbox_pointin(const rnd_pline_t *c, const rnd_vector_t p) { return (p[0] >= c->xmin && p[1] >= c->ymin && p[0] <= c->xmax && p[1] <= c->ymax); } -static inline int node_neighbours(pcb_vnode_t * a, pcb_vnode_t * b) +static inline int node_neighbours(rnd_vnode_t * a, rnd_vnode_t * b) { return (a == b) || (a->next == b) || (b->next == a) || (a->next == b->next); } -pcb_vnode_t *pcb_poly_node_create(pcb_vector_t v) +rnd_vnode_t *rnd_poly_node_create(rnd_vector_t v) { - pcb_vnode_t *res; + rnd_vnode_t *res; rnd_coord_t *c; assert(v); - res = (pcb_vnode_t *) calloc(1, sizeof(pcb_vnode_t)); + res = (rnd_vnode_t *) calloc(1, sizeof(rnd_vnode_t)); if (res == NULL) return NULL; - /* bzero (res, sizeof (pcb_vnode_t) - sizeof(pcb_vector_t)); */ + /* bzero (res, sizeof (rnd_vnode_t) - sizeof(rnd_vector_t)); */ c = res->point; *c++ = *v++; *c = *v; @@ -2251,13 +2251,13 @@ return res; } -void pcb_poly_contour_init(pcb_pline_t * c) +void rnd_poly_contour_init(rnd_pline_t * c) { if (c == NULL) return; - /* bzero (c, sizeof(pcb_pline_t)); */ + /* bzero (c, sizeof(rnd_pline_t)); */ if (c->head == NULL) - c->head = calloc(sizeof(pcb_vnode_t), 1); + c->head = calloc(sizeof(rnd_vnode_t), 1); c->head->next = c->head->prev = c->head; c->xmin = c->ymin = RND_COORD_MAX; c->xmax = c->ymax = -RND_COORD_MAX-1; @@ -2267,18 +2267,18 @@ c->radius = 0; } -pcb_pline_t *pcb_poly_contour_new(const pcb_vector_t v) +rnd_pline_t *rnd_poly_contour_new(const rnd_vector_t v) { - pcb_pline_t *res; + rnd_pline_t *res; - res = (pcb_pline_t *) calloc(1, sizeof(pcb_pline_t)); + res = (rnd_pline_t *) calloc(1, sizeof(rnd_pline_t)); if (res == NULL) return NULL; - pcb_poly_contour_init(res); + rnd_poly_contour_init(res); if (v != NULL) { -/* res->head = calloc(sizeof(pcb_vnode_t), 1); - no need to alloc, countour_init() did so */ +/* res->head = calloc(sizeof(rnd_vnode_t), 1); - no need to alloc, countour_init() did so */ res->head->next = res->head->prev = res->head; Vcopy(res->head->point, v); cntrbox_adjust(res, v); @@ -2287,23 +2287,23 @@ return res; } -void pcb_poly_contour_clear(pcb_pline_t * c) +void rnd_poly_contour_clear(rnd_pline_t * c) { - pcb_vnode_t *cur; + rnd_vnode_t *cur; assert(c != NULL); while ((cur = c->head->next) != c->head) { - pcb_poly_vertex_exclude(NULL, cur); + rnd_poly_vertex_exclude(NULL, cur); free(cur); } free(c->head); c->head = NULL; - pcb_poly_contour_init(c); + rnd_poly_contour_init(c); } -void pcb_poly_contour_del(pcb_pline_t ** c) +void rnd_poly_contour_del(rnd_pline_t ** c) { - pcb_vnode_t *cur, *prev; + rnd_vnode_t *cur, *prev; if (*c == NULL) return; @@ -2329,11 +2329,11 @@ free(*c), *c = NULL; } -void pcb_poly_contour_pre(pcb_pline_t * C, rnd_bool optimize) +void rnd_poly_contour_pre(rnd_pline_t * C, rnd_bool optimize) { double area = 0; - pcb_vnode_t *p, *c; - pcb_vector_t p1, p2; + rnd_vnode_t *p, *c; + rnd_vector_t p1, p2; assert(C != NULL); @@ -2348,8 +2348,8 @@ * So, remove the point c */ - if (pcb_vect_det2(p1, p2) == 0) { - pcb_poly_vertex_exclude(C, c); + if (rnd_vect_det2(p1, p2) == 0) { + rnd_poly_vertex_exclude(C, c); free(c); c = p; } @@ -2371,8 +2371,8 @@ } C->area = RND_ABS(area); if (C->Count > 2) - C->Flags.orient = ((area < 0) ? PCB_PLF_INV : PCB_PLF_DIR); - C->tree = (rnd_rtree_t *) pcb_poly_make_edge_tree(C); + C->Flags.orient = ((area < 0) ? RND_PLF_INV : RND_PLF_DIR); + C->tree = (rnd_rtree_t *) rnd_poly_make_edge_tree(C); } /* poly_PreContour */ static pcb_r_dir_t flip_cb(const rnd_rnd_box_t * b, void *cl) @@ -2382,9 +2382,9 @@ return PCB_R_DIR_FOUND_CONTINUE; } -void pcb_poly_contour_inv(pcb_pline_t * c) +void rnd_poly_contour_inv(rnd_pline_t * c) { - pcb_vnode_t *cur, *next; + rnd_vnode_t *cur, *next; int r; assert(c != NULL); @@ -2403,7 +2403,7 @@ } } -void pcb_poly_vertex_exclude(pcb_pline_t *parent, pcb_vnode_t * node) +void rnd_poly_vertex_exclude(rnd_pline_t *parent, rnd_vnode_t * node) { assert(node != NULL); if (parent != NULL) { @@ -2423,7 +2423,7 @@ } } -RND_INLINE void pcb_poly_vertex_include_force_(pcb_vnode_t *after, pcb_vnode_t *node) +RND_INLINE void pcb_poly_vertex_include_force_(rnd_vnode_t *after, rnd_vnode_t *node) { assert(after != NULL); assert(node != NULL); @@ -2433,12 +2433,12 @@ after->next = after->next->prev = node; } -void pcb_poly_vertex_include_force(pcb_vnode_t *after, pcb_vnode_t *node) +void rnd_poly_vertex_include_force(rnd_vnode_t *after, rnd_vnode_t *node) { pcb_poly_vertex_include_force_(after, node); } -void pcb_poly_vertex_include(pcb_vnode_t *after, pcb_vnode_t *node) +void rnd_poly_vertex_include(rnd_vnode_t *after, rnd_vnode_t *node) { double a, b; @@ -2452,7 +2452,7 @@ b = (node->point[0] - node->prev->prev->point[0]); b *= (node->prev->point[1] - node->prev->prev->point[1]); if (fabs(a - b) < EPSILON) { - pcb_vnode_t *t = node->prev; + rnd_vnode_t *t = node->prev; t->prev->next = node; node->prev = t->prev; free(t); @@ -2459,13 +2459,13 @@ } } -rnd_bool pcb_poly_contour_copy(pcb_pline_t **dst, const pcb_pline_t *src) +rnd_bool rnd_poly_contour_copy(rnd_pline_t **dst, const rnd_pline_t *src) { - pcb_vnode_t *cur, *newnode; + rnd_vnode_t *cur, *newnode; assert(src != NULL); *dst = NULL; - *dst = pcb_poly_contour_new(src->head->point); + *dst = rnd_poly_contour_new(src->head->point); if (*dst == NULL) return rnd_false; @@ -2476,12 +2476,12 @@ (*dst)->area = src->area; for (cur = src->head->next; cur != src->head; cur = cur->next) { - if ((newnode = pcb_poly_node_create(cur->point)) == NULL) + if ((newnode = rnd_poly_node_create(cur->point)) == NULL) return rnd_false; /* newnode->Flags = cur->Flags; */ - pcb_poly_vertex_include((*dst)->head->prev, newnode); + rnd_poly_vertex_include((*dst)->head->prev, newnode); } - (*dst)->tree = (rnd_rtree_t *) pcb_poly_make_edge_tree(*dst); + (*dst)->tree = (rnd_rtree_t *) rnd_poly_make_edge_tree(*dst); return rnd_true; } @@ -2488,7 +2488,7 @@ /**********************************************************************/ /* polygon routines */ -rnd_bool pcb_polyarea_copy0(rnd_polyarea_t ** dst, const rnd_polyarea_t * src) +rnd_bool rnd_polyarea_copy0(rnd_polyarea_t ** dst, const rnd_polyarea_t * src) { *dst = NULL; if (src != NULL) @@ -2497,18 +2497,18 @@ return rnd_false; (*dst)->contour_tree = pcb_r_create_tree(); - return pcb_polyarea_copy1(*dst, src); + return rnd_polyarea_copy1(*dst, src); } -rnd_bool pcb_polyarea_copy1(rnd_polyarea_t * dst, const rnd_polyarea_t * src) +rnd_bool rnd_polyarea_copy1(rnd_polyarea_t * dst, const rnd_polyarea_t * src) { - pcb_pline_t *cur, **last = &dst->contours; + rnd_pline_t *cur, **last = &dst->contours; *last = NULL; dst->f = dst->b = dst; for (cur = src->contours; cur != NULL; cur = cur->next) { - if (!pcb_poly_contour_copy(last, cur)) + if (!rnd_poly_contour_copy(last, cur)) return rnd_false; pcb_r_insert_entry(dst->contour_tree, (rnd_rnd_box_t *) * last); last = &(*last)->next; @@ -2516,7 +2516,7 @@ return rnd_true; } -void pcb_polyarea_m_include(rnd_polyarea_t ** list, rnd_polyarea_t * a) +void rnd_polyarea_m_include(rnd_polyarea_t ** list, rnd_polyarea_t * a) { if (*list == NULL) a->f = a->b = a, *list = a; @@ -2527,7 +2527,7 @@ } } -rnd_bool pcb_polyarea_m_copy0(rnd_polyarea_t ** dst, const rnd_polyarea_t * srcfst) +rnd_bool rnd_polyarea_m_copy0(rnd_polyarea_t ** dst, const rnd_polyarea_t * srcfst) { const rnd_polyarea_t *src = srcfst; rnd_polyarea_t *di; @@ -2536,21 +2536,21 @@ if (src == NULL) return rnd_false; do { - if ((di = pcb_polyarea_create()) == NULL || !pcb_polyarea_copy1(di, src)) + if ((di = rnd_polyarea_create()) == NULL || !rnd_polyarea_copy1(di, src)) return rnd_false; - pcb_polyarea_m_include(dst, di); + rnd_polyarea_m_include(dst, di); } while ((src = src->f) != srcfst); return rnd_true; } -rnd_bool pcb_polyarea_contour_include(rnd_polyarea_t * p, pcb_pline_t * c) +rnd_bool rnd_polyarea_contour_include(rnd_polyarea_t * p, rnd_pline_t * c) { - pcb_pline_t *tmp; + rnd_pline_t *tmp; if ((c == NULL) || (p == NULL)) return rnd_false; - if (c->Flags.orient == PCB_PLF_DIR) { + if (c->Flags.orient == RND_PLF_DIR) { if (p->contours != NULL) return rnd_false; p->contours = c; @@ -2569,7 +2569,7 @@ typedef struct pip { int f; - pcb_vector_t p; + rnd_vector_t p; jmp_buf env; } pip; @@ -2581,7 +2581,7 @@ if (s->v->point[1] <= p->p[1]) { if (s->v->next->point[1] > p->p[1]) { - pcb_vector_t v1, v2; + rnd_vector_t v1, v2; pcb_long64_t cross; Vsub2(v1, s->v->next->point, s->v->point); Vsub2(v2, p->p, s->v->point); @@ -2596,7 +2596,7 @@ } else { if (s->v->next->point[1] <= p->p[1]) { - pcb_vector_t v1, v2; + rnd_vector_t v1, v2; pcb_long64_t cross; Vsub2(v1, s->v->next->point, s->v->point); Vsub2(v2, p->p, s->v->point); @@ -2612,7 +2612,7 @@ return PCB_R_DIR_FOUND_CONTINUE; } -int pcb_poly_contour_inside(const pcb_pline_t *c, pcb_vector_t p) +int rnd_poly_contour_inside(const rnd_pline_t *c, rnd_vector_t p) { struct pip info; rnd_rnd_box_t ray; @@ -2629,16 +2629,16 @@ return info.f; } -rnd_bool pcb_polyarea_contour_inside(rnd_polyarea_t * p, pcb_vector_t v0) +rnd_bool rnd_polyarea_contour_inside(rnd_polyarea_t * p, rnd_vector_t v0) { - pcb_pline_t *cur; + rnd_pline_t *cur; if ((p == NULL) || (v0 == NULL) || (p->contours == NULL)) return rnd_false; cur = p->contours; - if (pcb_poly_contour_inside(cur, v0)) { + if (rnd_poly_contour_inside(cur, v0)) { for (cur = cur->next; cur != NULL; cur = cur->next) - if (pcb_poly_contour_inside(cur, v0)) + if (rnd_poly_contour_inside(cur, v0)) return rnd_false; return rnd_true; } @@ -2645,7 +2645,7 @@ return rnd_false; } -rnd_bool poly_M_CheckInside(rnd_polyarea_t * p, pcb_vector_t v0) +rnd_bool poly_M_CheckInside(rnd_polyarea_t * p, rnd_vector_t v0) { rnd_polyarea_t *cur; @@ -2653,7 +2653,7 @@ return rnd_false; cur = p; do { - if (pcb_polyarea_contour_inside(cur, v0)) + if (rnd_polyarea_contour_inside(cur, v0)) return rnd_true; } while ((cur = cur->f) != p); @@ -2660,7 +2660,7 @@ return rnd_false; } -static double dot(pcb_vector_t A, pcb_vector_t B) +static double dot(rnd_vector_t A, rnd_vector_t B) { return (double) A[0] * (double) B[0] + (double) A[1] * (double) B[1]; } @@ -2667,9 +2667,9 @@ /* Compute whether point is inside a triangle formed by 3 other points */ /* Algorithm from http://www.blackpawn.com/texts/pointinpoly/default.html */ -static int point_in_triangle(pcb_vector_t A, pcb_vector_t B, pcb_vector_t C, pcb_vector_t P) +static int point_in_triangle(rnd_vector_t A, rnd_vector_t B, rnd_vector_t C, rnd_vector_t P) { - pcb_vector_t v0, v1, v2; + rnd_vector_t v0, v1, v2; double dot00, dot01, dot02, dot11, dot12; double invDenom; double u, v; @@ -2699,19 +2699,19 @@ } /* wrapper to keep the original name short and original function inline */ -int rnd_point_in_triangle(pcb_vector_t A, pcb_vector_t B, pcb_vector_t C, pcb_vector_t P) +int rnd_point_in_triangle(rnd_vector_t A, rnd_vector_t B, rnd_vector_t C, rnd_vector_t P) { return point_in_triangle(A, B, C, P); } -/* Returns the dot product of pcb_vector_t A->B, and a vector - * orthogonal to pcb_vector_t C->D. The result is not normalised, so will be +/* Returns the dot product of rnd_vector_t A->B, and a vector + * orthogonal to rnd_vector_t C->D. The result is not normalised, so will be * weighted by the magnitude of the C->D vector. */ -static double dot_orthogonal_to_direction(pcb_vector_t A, pcb_vector_t B, pcb_vector_t C, pcb_vector_t D) +static double dot_orthogonal_to_direction(rnd_vector_t A, rnd_vector_t B, rnd_vector_t C, rnd_vector_t D) { - pcb_vector_t l1, l2, l3; + rnd_vector_t l1, l2, l3; l1[0] = B[0] - A[0]; l1[1] = B[1] - A[1]; l2[0] = D[0] - C[0]; @@ -2740,13 +2740,13 @@ * Joseph O'Rourke, Cambridge University Press 1998, * ISBN 0-521-64010-5 Pbk, ISBN 0-521-64976-5 Hbk */ -static void poly_ComputeInteriorPoint(pcb_pline_t * poly, pcb_vector_t v) +static void poly_ComputeInteriorPoint(rnd_pline_t * poly, rnd_vector_t v) { - pcb_vnode_t *pt1, *pt2, *pt3, *q; - pcb_vnode_t *min_q = NULL; + rnd_vnode_t *pt1, *pt2, *pt3, *q; + rnd_vnode_t *min_q = NULL; double dist; double min_dist = 0.0; - double dir = (poly->Flags.orient == PCB_PLF_DIR) ? 1. : -1; + double dir = (poly->Flags.orient == RND_PLF_DIR) ? 1. : -1; /* Find a convex node on the polygon */ pt1 = poly->head; @@ -2800,9 +2800,9 @@ * common points between their contours. (Identical contours * are treated as being inside each other). */ -int pcb_poly_contour_in_contour(pcb_pline_t * poly, pcb_pline_t * inner) +int rnd_poly_contour_in_contour(rnd_pline_t * poly, rnd_pline_t * inner) { - pcb_vector_t point; + rnd_vector_t point; assert(poly != NULL); assert(inner != NULL); if (cntrbox_inside(inner, poly)) { @@ -2809,16 +2809,16 @@ /* We need to prove the "inner" contour is not outside * "poly" contour. If it is outside, we can return. */ - if (!pcb_poly_contour_inside(poly, inner->head->point)) + if (!rnd_poly_contour_inside(poly, inner->head->point)) return 0; poly_ComputeInteriorPoint(inner, point); - return pcb_poly_contour_inside(poly, point); + return rnd_poly_contour_inside(poly, point); } return 0; } -void pcb_polyarea_init(rnd_polyarea_t * p) +void rnd_polyarea_init(rnd_polyarea_t * p) { p->f = p->b = p; p->contours = NULL; @@ -2825,26 +2825,26 @@ p->contour_tree = pcb_r_create_tree(); } -rnd_polyarea_t *pcb_polyarea_create(void) +rnd_polyarea_t *rnd_polyarea_create(void) { rnd_polyarea_t *res; if ((res = (rnd_polyarea_t *) malloc(sizeof(rnd_polyarea_t))) != NULL) - pcb_polyarea_init(res); + rnd_polyarea_init(res); return res; } -void pcb_poly_contours_free(pcb_pline_t ** pline) +void rnd_poly_contours_free(rnd_pline_t ** pline) { - pcb_pline_t *pl; + rnd_pline_t *pl; while ((pl = *pline) != NULL) { *pline = pl->next; - pcb_poly_contour_del(&pl); + rnd_poly_contour_del(&pl); } } -void pcb_polyarea_free(rnd_polyarea_t ** p) +void rnd_polyarea_free(rnd_polyarea_t ** p) { rnd_polyarea_t *cur; @@ -2851,20 +2851,20 @@ if (*p == NULL) return; for (cur = (*p)->f; cur != *p; cur = (*p)->f) { - pcb_poly_contours_free(&cur->contours); + rnd_poly_contours_free(&cur->contours); pcb_r_destroy_tree(&cur->contour_tree); cur->f->b = cur->b; cur->b->f = cur->f; free(cur); } - pcb_poly_contours_free(&cur->contours); + rnd_poly_contours_free(&cur->contours); pcb_r_destroy_tree(&cur->contour_tree); free(*p), *p = NULL; } -static rnd_bool inside_sector(pcb_vnode_t * pn, pcb_vector_t p2) +static rnd_bool inside_sector(rnd_vnode_t * pn, rnd_vector_t p2) { - pcb_vector_t cdir, ndir, pdir; + rnd_vector_t cdir, ndir, pdir; int p_c, n_c, p_n; assert(pn != NULL); @@ -2872,9 +2872,9 @@ vect_sub(pdir, pn->point, pn->prev->point); vect_sub(ndir, pn->next->point, pn->point); - p_c = pcb_vect_det2(pdir, cdir) >= 0; - n_c = pcb_vect_det2(ndir, cdir) >= 0; - p_n = pcb_vect_det2(pdir, ndir) >= 0; + p_c = rnd_vect_det2(pdir, cdir) >= 0; + n_c = rnd_vect_det2(ndir, cdir) >= 0; + p_n = rnd_vect_det2(pdir, ndir) >= 0; if ((p_n && p_c && n_c) || ((!p_n) && (p_c || n_c))) return rnd_true; @@ -2929,10 +2929,10 @@ return rnd_true; } -rnd_bool pcb_polyarea_contour_check_(pcb_pline_t *a, pa_chk_res_t *res) +rnd_bool pcb_polyarea_contour_check_(rnd_pline_t *a, pa_chk_res_t *res) { - pcb_vnode_t *a1, *a2, *hit1, *hit2; - pcb_vector_t i1, i2; + rnd_vnode_t *a1, *a2, *hit1, *hit2; + rnd_vector_t i1, i2; int icnt; #ifndef NDEBUG @@ -2945,7 +2945,7 @@ do { a2 = a1; do { - if (!node_neighbours(a1, a2) && (icnt = pcb_vect_inters2(a1->point, a1->next->point, a2->point, a2->next->point, i1, i2)) > 0) { + if (!node_neighbours(a1, a2) && (icnt = rnd_vect_inters2(a1->point, a1->next->point, a2->point, a2->next->point, i1, i2)) > 0) { if (icnt > 1) { PA_CHK_MARK(a1->point[0], a1->point[1]); PA_CHK_MARK(a2->point[0], a2->point[1]); @@ -2953,16 +2953,16 @@ } TODO(": ugly workaround: test where exactly the intersection happens and tune the endpoint of the line") - if (pcb_vect_dist2(i1, a1->point) < PCB_POLY_ENDP_EPSILON) + if (rnd_vect_dist2(i1, a1->point) < RND_POLY_ENDP_EPSILON) hit1 = a1; - else if (pcb_vect_dist2(i1, a1->next->point) < PCB_POLY_ENDP_EPSILON) + else if (rnd_vect_dist2(i1, a1->next->point) < RND_POLY_ENDP_EPSILON) hit1 = a1->next; else hit1 = NULL; - if (pcb_vect_dist2(i1, a2->point) < PCB_POLY_ENDP_EPSILON) + if (rnd_vect_dist2(i1, a2->point) < RND_POLY_ENDP_EPSILON) hit2 = a2; - else if (pcb_vect_dist2(i1, a2->next->point) < PCB_POLY_ENDP_EPSILON) + else if (rnd_vect_dist2(i1, a2->next->point) < RND_POLY_ENDP_EPSILON) hit2 = a2->next; else hit2 = NULL; @@ -3009,15 +3009,15 @@ return rnd_false; } -rnd_bool pcb_polyarea_contour_check(pcb_pline_t *a) +rnd_bool rnd_polyarea_contour_check(rnd_pline_t *a) { pa_chk_res_t res; return pcb_polyarea_contour_check_(a, &res); } -void pcb_polyarea_bbox(rnd_polyarea_t * p, rnd_rnd_box_t * b) +void rnd_polyarea_bbox(rnd_polyarea_t * p, rnd_rnd_box_t * b) { - pcb_pline_t *n; + rnd_pline_t *n; /*int cnt;*/ n = p->contours; @@ -3039,9 +3039,9 @@ } #ifndef NDEBUG -static void pcb_poly_valid_report(pcb_pline_t *c, pcb_vnode_t *pl, pa_chk_res_t *chk) +static void pcb_poly_valid_report(rnd_pline_t *c, rnd_vnode_t *pl, pa_chk_res_t *chk) { - pcb_vnode_t *v, *n; + rnd_vnode_t *v, *n; rnd_coord_t minx = RND_COORD_MAX, miny = RND_COORD_MAX, maxx = -RND_COORD_MAX, maxy = -RND_COORD_MAX; #define update_minmax(min, max, val) \ @@ -3093,9 +3093,9 @@ #endif -rnd_bool pcb_poly_valid(rnd_polyarea_t * p) +rnd_bool rnd_poly_valid(rnd_polyarea_t * p) { - pcb_pline_t *c; + rnd_pline_t *c; pa_chk_res_t chk; if ((p == NULL) || (p->contours == NULL)) { @@ -3108,9 +3108,9 @@ return rnd_false; } - if (p->contours->Flags.orient == PCB_PLF_INV) { + if (p->contours->Flags.orient == RND_PLF_INV) { #ifndef NDEBUG - rnd_fprintf(stderr, "Invalid Outer pcb_pline_t: failed orient\n"); + rnd_fprintf(stderr, "Invalid Outer rnd_pline_t: failed orient\n"); pcb_poly_valid_report(p->contours, p->contours->head, NULL); #endif return rnd_false; @@ -3118,7 +3118,7 @@ if (pcb_polyarea_contour_check_(p->contours, &chk)) { #ifndef NDEBUG - rnd_fprintf(stderr, "Invalid Outer pcb_pline_t: failed contour check\n"); + rnd_fprintf(stderr, "Invalid Outer rnd_pline_t: failed contour check\n"); pcb_poly_valid_report(p->contours, p->contours->head, &chk); #endif return rnd_false; @@ -3125,9 +3125,9 @@ } for (c = p->contours->next; c != NULL; c = c->next) { - if (c->Flags.orient == PCB_PLF_DIR) { + if (c->Flags.orient == RND_PLF_DIR) { #ifndef NDEBUG - rnd_fprintf(stderr, "Invalid Inner: pcb_pline_t orient = %d\n", c->Flags.orient); + rnd_fprintf(stderr, "Invalid Inner: rnd_pline_t orient = %d\n", c->Flags.orient); pcb_poly_valid_report(c, c->head, NULL); #endif return rnd_false; @@ -3139,7 +3139,7 @@ #endif return rnd_false; } - if (!pcb_poly_contour_in_contour(p->contours, c)) { + if (!rnd_poly_contour_in_contour(p->contours, c)) { #ifndef NDEBUG rnd_fprintf(stderr, "Invalid Inner: overlap with outer\n"); pcb_poly_valid_report(c, c->head, NULL); @@ -3151,13 +3151,13 @@ } -pcb_vector_t vect_zero = { (long) 0, (long) 0 }; +rnd_vector_t rnd_vect_zero = { (long) 0, (long) 0 }; /*********************************************************************/ /* L o n g V e c t o r S t u f f */ /*********************************************************************/ -void vect_init(pcb_vector_t v, double x, double y) +void vect_init(rnd_vector_t v, double x, double y) { v[0] = (long) x; v[1] = (long) y; @@ -3167,34 +3167,34 @@ #define Vsub(a,b,c) {(a)[0]=(b)[0]-(c)[0];(a)[1]=(b)[1]-(c)[1];} -int vect_equal(pcb_vector_t v1, pcb_vector_t v2) +int vect_equal(rnd_vector_t v1, rnd_vector_t v2) { return (v1[0] == v2[0] && v1[1] == v2[1]); } /* vect_equal */ -void vect_sub(pcb_vector_t res, pcb_vector_t v1, pcb_vector_t v2) +void vect_sub(rnd_vector_t res, rnd_vector_t v1, rnd_vector_t v2) { Vsub(res, v1, v2)} /* vect_sub */ -void vect_min(pcb_vector_t v1, pcb_vector_t v2, pcb_vector_t v3) +void vect_min(rnd_vector_t v1, rnd_vector_t v2, rnd_vector_t v3) { v1[0] = (v2[0] < v3[0]) ? v2[0] : v3[0]; v1[1] = (v2[1] < v3[1]) ? v2[1] : v3[1]; } /* vect_min */ -void vect_max(pcb_vector_t v1, pcb_vector_t v2, pcb_vector_t v3) +void vect_max(rnd_vector_t v1, rnd_vector_t v2, rnd_vector_t v3) { v1[0] = (v2[0] > v3[0]) ? v2[0] : v3[0]; v1[1] = (v2[1] > v3[1]) ? v2[1] : v3[1]; } /* vect_max */ -double pcb_vect_len2(pcb_vector_t v) +double rnd_vect_len2(rnd_vector_t v) { return ((double) v[0] * v[0] + (double) v[1] * v[1]); /* why sqrt? only used for compares */ } -double pcb_vect_dist2(pcb_vector_t v1, pcb_vector_t v2) +double rnd_vect_dist2(rnd_vector_t v1, rnd_vector_t v2) { double dx = v1[0] - v2[0]; double dy = v1[1] - v2[1]; @@ -3203,12 +3203,12 @@ } /* value has sign of angle between vectors */ -double pcb_vect_det2(pcb_vector_t v1, pcb_vector_t v2) +double rnd_vect_det2(rnd_vector_t v1, rnd_vector_t v2) { return (((double) v1[0] * v2[1]) - ((double) v2[0] * v1[1])); } -static double vect_m_dist(pcb_vector_t v1, pcb_vector_t v2) +static double vect_m_dist(rnd_vector_t v1, rnd_vector_t v2) { double dx = v1[0] - v2[0]; double dy = v1[1] - v2[1]; @@ -3229,7 +3229,7 @@ (C) 1997 Michael Leonov, Alexey Nikitin */ -int pcb_vect_inters2(pcb_vector_t p1, pcb_vector_t p2, pcb_vector_t q1, pcb_vector_t q2, pcb_vector_t S1, pcb_vector_t S2) +int rnd_vect_inters2(rnd_vector_t p1, rnd_vector_t p2, rnd_vector_t q1, rnd_vector_t q2, rnd_vector_t S1, rnd_vector_t S2) { double s, t, deel; double rpx, rpy, rqx, rqy; @@ -3251,7 +3251,7 @@ if (deel == 0) { /* parallel */ double dc1, dc2, d1, d2, h; /* Check to see whether p1-p2 and q1-q2 are on the same line */ - pcb_vector_t hp1, hq1, hp2, hq2, q1p1, q1q2; + rnd_vector_t hp1, hq1, hp2, hq2, q1p1, q1q2; Vsub2(q1p1, q1, p1); Vsub2(q1q2, q1, q2); @@ -3258,7 +3258,7 @@ /* If this product is not zero then p1-p2 and q1-q2 are not on same line! */ - if (pcb_vect_det2(q1p1, q1q2) != 0) + if (rnd_vect_det2(q1p1, q1q2) != 0) return 0; dc1 = 0; /* m_len(p1 - p1) */ @@ -3359,7 +3359,7 @@ */ typedef struct { - pcb_vector_t l1, l2; + rnd_vector_t l1, l2; rnd_coord_t cx, cy; } pline_isect_line_t; @@ -3367,9 +3367,9 @@ { pline_isect_line_t *ctx = (pline_isect_line_t *)cl; struct seg *s = (struct seg *)b; - pcb_vector_t S1, S2; + rnd_vector_t S1, S2; - if (pcb_vect_inters2(s->v->point, s->v->next->point, ctx->l1, ctx->l2, S1, S2)) { + if (rnd_vect_inters2(s->v->point, s->v->next->point, ctx->l1, ctx->l2, S1, S2)) { ctx->cx = S1[0]; ctx->cy = S1[1]; return PCB_R_DIR_CANCEL; /* found */ @@ -3378,7 +3378,7 @@ return PCB_R_DIR_NOT_FOUND; } -rnd_bool pcb_pline_isect_line(pcb_pline_t *pl, rnd_coord_t lx1, rnd_coord_t ly1, rnd_coord_t lx2, rnd_coord_t ly2, rnd_coord_t *cx, rnd_coord_t *cy) +rnd_bool pcb_pline_isect_line(rnd_pline_t *pl, rnd_coord_t lx1, rnd_coord_t ly1, rnd_coord_t lx2, rnd_coord_t ly2, rnd_coord_t *cx, rnd_coord_t *cy) { pline_isect_line_t ctx; rnd_rnd_box_t lbx; @@ -3390,7 +3390,7 @@ lbx.Y2 = MAX(ly1, ly2); if (pl->tree == NULL) - pl->tree = (rnd_rtree_t *) pcb_poly_make_edge_tree(pl); + pl->tree = (rnd_rtree_t *) rnd_poly_make_edge_tree(pl); if (pcb_r_search(pl->tree, &lbx, NULL, pline_isect_line_cb, &ctx, NULL) == PCB_R_DIR_CANCEL) { if (cx != NULL) *cx = ctx.cx; @@ -3414,8 +3414,8 @@ { pline_isect_circ_t *ctx = (pline_isect_circ_t *)cl; struct seg *s = (struct seg *)b; - pcb_vector_t S1, S2; - pcb_vector_t ray1, ray2; + rnd_vector_t S1, S2; + rnd_vector_t ray1, ray2; double ox, oy, dx, dy, l; /* Cheap: if either line endpoint is within the circle, we sure have an intersection */ @@ -3433,13 +3433,13 @@ ray1[0] = ctx->cx - ox; ray1[1] = ctx->cy - oy; ray2[0] = ctx->cx + ox; ray2[1] = ctx->cy + oy; - if (pcb_vect_inters2(s->v->point, s->v->next->point, ray1, ray2, S1, S2)) + if (rnd_vect_inters2(s->v->point, s->v->next->point, ray1, ray2, S1, S2)) return PCB_R_DIR_CANCEL; /* found */ return PCB_R_DIR_NOT_FOUND; } -rnd_bool pcb_pline_isect_circ(pcb_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r) +rnd_bool pcb_pline_isect_circ(rnd_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r) { pline_isect_circ_t ctx; rnd_rnd_box_t cbx; @@ -3449,7 +3449,7 @@ cbx.X2 = cx + r; cbx.Y2 = cy + r; if (pl->tree == NULL) - pl->tree = (rnd_rtree_t *) pcb_poly_make_edge_tree(pl); + pl->tree = (rnd_rtree_t *) rnd_poly_make_edge_tree(pl); return pcb_r_search(pl->tree, &cbx, NULL, pline_isect_circ_cb, &ctx, NULL) == PCB_R_DIR_CANCEL; } @@ -3471,7 +3471,7 @@ return PCB_R_DIR_NOT_FOUND; } -rnd_bool pcb_pline_embraces_circ(pcb_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r) +rnd_bool pcb_pline_embraces_circ(rnd_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r) { rnd_rnd_box_t bx; int cnt; @@ -3478,7 +3478,7 @@ bx.Y1 = cy; bx.Y2 = cy+1; if (pl->tree == NULL) - pl->tree = (rnd_rtree_t *) pcb_poly_make_edge_tree(pl); + pl->tree = (rnd_rtree_t *) rnd_poly_make_edge_tree(pl); /* ray to the right */ bx.X1 = cx + r; @@ -3503,7 +3503,7 @@ * pcb_pline_isect_circle() * (C) 2017 Tibor 'Igor2' Palinkas */ -rnd_bool pcb_pline_overlaps_circ(pcb_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r) +rnd_bool pcb_pline_overlaps_circ(rnd_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r) { rnd_rnd_box_t cbx, pbx; cbx.X1 = cx - r; cbx.Y1 = cy - r; @@ -3516,7 +3516,7 @@ return rnd_false; if (pl->tree == NULL) - pl->tree = (rnd_rtree_t *) pcb_poly_make_edge_tree(pl); + pl->tree = (rnd_rtree_t *) rnd_poly_make_edge_tree(pl); if (pcb_pline_isect_circ(pl, cx, cy, r)) return rnd_true; @@ -3529,7 +3529,7 @@ * pcb_is_point_in_convex_quad() * (C) 2017 Tibor 'Igor2' Palinkas */ -rnd_bool_t pcb_is_point_in_convex_quad(pcb_vector_t p, pcb_vector_t *q) +rnd_bool_t pcb_is_point_in_convex_quad(rnd_vector_t p, rnd_vector_t *q) { return point_in_triangle(q[0], q[1], q[2], p) || point_in_triangle(q[0], q[3], q[2], p); } @@ -3536,16 +3536,16 @@ /* - * pcb_polyarea_move() + * rnd_polyarea_move() * (C) 2017 Tibor 'Igor2' Palinkas */ -void pcb_polyarea_move(rnd_polyarea_t *pa1, rnd_coord_t dx, rnd_coord_t dy) +void rnd_polyarea_move(rnd_polyarea_t *pa1, rnd_coord_t dx, rnd_coord_t dy) { int cnt; rnd_polyarea_t *pa; for (pa = pa1, cnt = 0; pa != NULL; pa = pa->f) { - pcb_pline_t *pl; + rnd_pline_t *pl; if (pa == pa1) { cnt++; if (cnt > 1) @@ -3555,7 +3555,7 @@ pcb_r_destroy_tree(&pa->contour_tree); pa->contour_tree = pcb_r_create_tree(); for(pl = pa->contours; pl != NULL; pl = pl->next) { - pcb_vnode_t *v; + rnd_vnode_t *v; int cnt2 = 0; for(v = pl->head; v != NULL; v = v->next) { if (v == pl->head) { @@ -3574,7 +3574,7 @@ pcb_r_free_tree_data(pl->tree, free); pcb_r_destroy_tree(&pl->tree); } - pl->tree = (rnd_rtree_t *)pcb_poly_make_edge_tree(pl); + pl->tree = (rnd_rtree_t *)rnd_poly_make_edge_tree(pl); pcb_r_insert_entry(pa->contour_tree, (rnd_rnd_box_t *)pl); } @@ -3581,7 +3581,7 @@ } } -void pcb_polyarea_get_tree_seg(void *obj, rnd_coord_t *x1, rnd_coord_t *y1, rnd_coord_t *x2, rnd_coord_t *y2) +void rnd_polyarea_get_tree_seg(void *obj, rnd_coord_t *x1, rnd_coord_t *y1, rnd_coord_t *x2, rnd_coord_t *y2) { struct seg *s = obj; *x1 = s->v->point[0]; Index: trunk/src/librnd/poly/polyarea.h =================================================================== --- trunk/src/librnd/poly/polyarea.h (revision 31036) +++ trunk/src/librnd/poly/polyarea.h (revision 31037) @@ -22,54 +22,54 @@ (C) 1997 Klamer Schutte (minor patches) */ -#ifndef PCB_POLYAREA_H -#define PCB_POLYAREA_H +#ifndef RND_POLYAREA_H +#define RND_POLYAREA_H -#define PCB_PLF_DIR 1 -#define PCB_PLF_INV 0 -#define PCB_PLF_MARK 1 +#define RND_PLF_DIR 1 +#define RND_PLF_INV 0 +#define RND_PLF_MARK 1 -typedef rnd_coord_t pcb_vertex_t[2]; /* longing point representation of coordinates */ -typedef pcb_vertex_t pcb_vector_t; +typedef rnd_coord_t rnd_vertex_t[2]; /* longing point representation of coordinates */ +typedef rnd_vertex_t rnd_vector_t; -#define pcb_vertex_equ(a,b) (memcmp((a),(b),sizeof(pcb_vector_t))==0) -#define pcb_vertex_cpy(a,b) memcpy((a),(b),sizeof(pcb_vector_t)) +#define rnd_vertex_equ(a,b) (memcmp((a),(b),sizeof(rnd_vector_t))==0) +#define rnd_vertex_cpy(a,b) memcpy((a),(b),sizeof(rnd_vector_t)) -extern pcb_vector_t vect_zero; +extern rnd_vector_t rnd_vect_zero; enum { - pcb_err_no_memory = 2, - pcb_err_bad_parm = 3, - pcb_err_ok = 0 + rnd_err_no_memory = 2, + rnd_err_bad_parm = 3, + rnd_err_ok = 0 }; -typedef struct pcb_cvc_list_s pcb_cvc_list_t; -typedef struct pcb_vnode_s pcb_vnode_t; -struct pcb_cvc_list_s { +typedef struct rnd_cvc_list_s rnd_cvc_list_t; +typedef struct rnd_vnode_s rnd_vnode_t; +struct rnd_cvc_list_s { double angle; - pcb_vnode_t *parent; - pcb_cvc_list_t *prev, *next, *head; + rnd_vnode_t *parent; + rnd_cvc_list_t *prev, *next, *head; char poly, side; }; -struct pcb_vnode_s { - pcb_vnode_t *next, *prev, *shared; +struct rnd_vnode_s { + rnd_vnode_t *next, *prev, *shared; struct { unsigned int status:3; unsigned int mark:1; unsigned int in_hub:1; } Flags; - pcb_cvc_list_t *cvc_prev; - pcb_cvc_list_t *cvc_next; - pcb_vector_t point; + rnd_cvc_list_t *cvc_prev; + rnd_cvc_list_t *cvc_next; + rnd_vector_t point; }; -typedef struct pcb_pline_s pcb_pline_t; -struct pcb_pline_s { +typedef struct rnd_pline_s rnd_pline_t; +struct rnd_pline_s { rnd_coord_t xmin, ymin, xmax, ymax; - pcb_pline_t *next; - pcb_vnode_t *head; + rnd_pline_t *next; + rnd_vnode_t *head; unsigned int Count; double area; rnd_rtree_t *tree; @@ -82,84 +82,84 @@ } Flags; }; -pcb_pline_t *pcb_poly_contour_new(const pcb_vector_t v); +rnd_pline_t *rnd_poly_contour_new(const rnd_vector_t v); -void pcb_poly_contour_init(pcb_pline_t *c); -void pcb_poly_contour_clear(pcb_pline_t *c); /* clears list of vertices */ -void pcb_poly_contour_del(pcb_pline_t **c); +void rnd_poly_contour_init(rnd_pline_t *c); +void rnd_poly_contour_clear(rnd_pline_t *c); /* clears list of vertices */ +void rnd_poly_contour_del(rnd_pline_t **c); -rnd_bool pcb_poly_contour_copy(pcb_pline_t **dst, const pcb_pline_t *src); +rnd_bool rnd_poly_contour_copy(rnd_pline_t **dst, const rnd_pline_t *src); -void pcb_poly_contour_pre(pcb_pline_t *c, rnd_bool optimize); /* prepare contour */ -void pcb_poly_contour_inv(pcb_pline_t *c); /* invert contour */ +void rnd_poly_contour_pre(rnd_pline_t *c, rnd_bool optimize); /* prepare contour */ +void rnd_poly_contour_inv(rnd_pline_t *c); /* invert contour */ -pcb_vnode_t *pcb_poly_node_create(pcb_vector_t v); +rnd_vnode_t *rnd_poly_node_create(rnd_vector_t v); -void pcb_poly_vertex_include(pcb_vnode_t *after, pcb_vnode_t *node); -void pcb_poly_vertex_include_force(pcb_vnode_t *after, pcb_vnode_t *node); /* do not remove nodes even if on the same line */ -void pcb_poly_vertex_exclude(pcb_pline_t *parent, pcb_vnode_t *node); +void rnd_poly_vertex_include(rnd_vnode_t *after, rnd_vnode_t *node); +void rnd_poly_vertex_include_force(rnd_vnode_t *after, rnd_vnode_t *node); /* do not remove nodes even if on the same line */ +void rnd_poly_vertex_exclude(rnd_pline_t *parent, rnd_vnode_t *node); -pcb_vnode_t *pcb_poly_node_add_single(pcb_vnode_t *dest, pcb_vector_t po); +rnd_vnode_t *rnd_poly_node_add_single(rnd_vnode_t *dest, rnd_vector_t po); /**********************************************************************/ struct rnd_polyarea_s { rnd_polyarea_t *f, *b; - pcb_pline_t *contours; + rnd_pline_t *contours; rnd_rtree_t *contour_tree; }; -rnd_bool pcb_polyarea_m_copy0(rnd_polyarea_t **dst, const rnd_polyarea_t *srcfst); -void pcb_polyarea_m_include(rnd_polyarea_t **list, rnd_polyarea_t *a); +rnd_bool rnd_polyarea_m_copy0(rnd_polyarea_t **dst, const rnd_polyarea_t *srcfst); +void rnd_polyarea_m_include(rnd_polyarea_t **list, rnd_polyarea_t *a); -rnd_bool pcb_polyarea_copy0(rnd_polyarea_t **dst, const rnd_polyarea_t *src); -rnd_bool pcb_polyarea_copy1(rnd_polyarea_t *dst, const rnd_polyarea_t *src); +rnd_bool rnd_polyarea_copy0(rnd_polyarea_t **dst, const rnd_polyarea_t *src); +rnd_bool rnd_polyarea_copy1(rnd_polyarea_t *dst, const rnd_polyarea_t *src); -rnd_bool pcb_polyarea_contour_include(rnd_polyarea_t *p, pcb_pline_t *c); -rnd_bool pcb_polyarea_contour_exclude(rnd_polyarea_t *p, pcb_pline_t *c); +rnd_bool rnd_polyarea_contour_include(rnd_polyarea_t *p, rnd_pline_t *c); +rnd_bool rnd_polyarea_contour_exclude(rnd_polyarea_t *p, rnd_pline_t *c); -rnd_bool pcb_polyarea_contour_check(pcb_pline_t *a); +rnd_bool rnd_polyarea_contour_check(rnd_pline_t *a); -rnd_bool pcb_polyarea_contour_inside(rnd_polyarea_t *c, pcb_vector_t v0); -rnd_bool pcb_polyarea_touching(rnd_polyarea_t *p1, rnd_polyarea_t *p2); +rnd_bool rnd_polyarea_contour_inside(rnd_polyarea_t *c, rnd_vector_t v0); +rnd_bool rnd_polyarea_touching(rnd_polyarea_t *p1, rnd_polyarea_t *p2); /*** tools for clipping ***/ /* checks whether point lies within contour independently of its orientation */ -int pcb_poly_contour_inside(const pcb_pline_t *c, pcb_vector_t v); -int pcb_poly_contour_in_contour(pcb_pline_t *poly, pcb_pline_t *inner); -rnd_polyarea_t *pcb_polyarea_create(void); +int rnd_poly_contour_inside(const rnd_pline_t *c, rnd_vector_t v); +int rnd_poly_contour_in_contour(rnd_pline_t *poly, rnd_pline_t *inner); +rnd_polyarea_t *rnd_polyarea_create(void); -void pcb_polyarea_free(rnd_polyarea_t **p); -void pcb_polyarea_init(rnd_polyarea_t *p); -void pcb_poly_contours_free(pcb_pline_t **pl); -rnd_bool pcb_poly_valid(rnd_polyarea_t *p); +void rnd_polyarea_free(rnd_polyarea_t **p); +void rnd_polyarea_init(rnd_polyarea_t *p); +void rnd_poly_contours_free(rnd_pline_t **pl); +rnd_bool rnd_poly_valid(rnd_polyarea_t *p); -enum pcb_poly_bool_op_e { - PCB_PBO_UNITE, - PCB_PBO_ISECT, - PCB_PBO_SUB, - PCB_PBO_XOR +enum rnd_poly_bool_op_e { + RND_PBO_UNITE, + RND_PBO_ISECT, + RND_PBO_SUB, + RND_PBO_XOR }; -double pcb_vect_dist2(pcb_vector_t v1, pcb_vector_t v2); -double pcb_vect_det2(pcb_vector_t v1, pcb_vector_t v2); -double pcb_vect_len2(pcb_vector_t v1); +double rnd_vect_dist2(rnd_vector_t v1, rnd_vector_t v2); +double rnd_vect_det2(rnd_vector_t v1, rnd_vector_t v2); +double rnd_vect_len2(rnd_vector_t v1); -int pcb_vect_inters2(pcb_vector_t A, pcb_vector_t B, pcb_vector_t C, pcb_vector_t D, pcb_vector_t S1, pcb_vector_t S2); +int rnd_vect_inters2(rnd_vector_t A, rnd_vector_t B, rnd_vector_t C, rnd_vector_t D, rnd_vector_t S1, rnd_vector_t S2); -int pcb_polyarea_boolean(const rnd_polyarea_t *a, const rnd_polyarea_t *b, rnd_polyarea_t **res, int action); -int pcb_polyarea_boolean_free(rnd_polyarea_t *a, rnd_polyarea_t *b, rnd_polyarea_t **res, int action); -int pcb_polyarea_and_subtract_free(rnd_polyarea_t *a, rnd_polyarea_t *b, rnd_polyarea_t **aandb, rnd_polyarea_t **aminusb); -int pcb_polyarea_save(rnd_polyarea_t *PA, char *fname); +int rnd_polyarea_boolean(const rnd_polyarea_t *a, const rnd_polyarea_t *b, rnd_polyarea_t **res, int action); +int rnd_polyarea_boolean_free(rnd_polyarea_t *a, rnd_polyarea_t *b, rnd_polyarea_t **res, int action); +int rnd_polyarea_and_subtract_free(rnd_polyarea_t *a, rnd_polyarea_t *b, rnd_polyarea_t **aandb, rnd_polyarea_t **aminusb); +int rnd_polyarea_save(rnd_polyarea_t *PA, char *fname); /* calculate the bounding box of a rnd_polyarea_t and save result in b */ -void pcb_polyarea_bbox(rnd_polyarea_t *p, rnd_rnd_box_t *b); +void rnd_polyarea_bbox(rnd_polyarea_t *p, rnd_rnd_box_t *b); /* Move each point of pa1 by dx and dy */ -void pcb_polyarea_move(rnd_polyarea_t *pa1, rnd_coord_t dx, rnd_coord_t dy); +void rnd_polyarea_move(rnd_polyarea_t *pa1, rnd_coord_t dx, rnd_coord_t dy); /*** Tools for building polygons for common object shapes ***/ @@ -170,7 +170,7 @@ double rnd_round(double x); /* from math_helper.h */ /* Calculate an endpoint of an arc and return the result in *x;*y */ -RND_INLINE void pcb_arc_get_endpt(rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t width, rnd_coord_t height, rnd_angle_t astart, rnd_angle_t adelta, int which, rnd_coord_t *x, rnd_coord_t *y) +RND_INLINE void rnd_arc_get_endpt(rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t width, rnd_coord_t height, rnd_angle_t astart, rnd_angle_t adelta, int which, rnd_coord_t *x, rnd_coord_t *y) { if (which == 0) { *x = rnd_round((double)cx - (double)width * cos(astart * (M_PI/180.0))); @@ -185,30 +185,30 @@ /*** constants for the poly shape generator ***/ /* polygon diverges from modelled arc no more than MAX_ARC_DEVIATION * thick */ -#define PCB_POLY_ARC_MAX_DEVIATION 0.02 +#define RND_POLY_ARC_MAX_DEVIATION 0.02 -#define PCB_POLY_CIRC_SEGS 40 -#define PCB_POLY_CIRC_SEGS_F ((float)PCB_POLY_CIRC_SEGS) +#define RND_POLY_CIRC_SEGS 40 +#define RND_POLY_CIRC_SEGS_F ((float)RND_POLY_CIRC_SEGS) /* adjustment to make the segments outline the circle rather than connect points on the circle: 1 - cos (\alpha / 2) < (\alpha / 2) ^ 2 / 2 */ -#define PCB_POLY_CIRC_RADIUS_ADJ \ - (1.0 + M_PI / PCB_POLY_CIRC_SEGS_F * M_PI / PCB_POLY_CIRC_SEGS_F / 2.0) +#define RND_POLY_CIRC_RADIUS_ADJ \ + (1.0 + M_PI / RND_POLY_CIRC_SEGS_F * M_PI / RND_POLY_CIRC_SEGS_F / 2.0) /*** special purpose, internal tools ***/ /* Convert a struct seg *obj extracted from a pline->tree into coords */ -void pcb_polyarea_get_tree_seg(void *obj, rnd_coord_t *x1, rnd_coord_t *y1, rnd_coord_t *x2, rnd_coord_t *y2); +void rnd_polyarea_get_tree_seg(void *obj, rnd_coord_t *x1, rnd_coord_t *y1, rnd_coord_t *x2, rnd_coord_t *y2); /* create a (rnd_rtree_t *) of each seg derived from src */ -void *pcb_poly_make_edge_tree(pcb_pline_t *src); +void *rnd_poly_make_edge_tree(rnd_pline_t *src); /* EPSILON^2 for endpoint matching; the bool algebra code is not perfect and causes tiny self intersections at the end of sharp spikes. Accept at most 10 nanometer of such intersection */ -#define PCB_POLY_ENDP_EPSILON 100 +#define RND_POLY_ENDP_EPSILON 100 /*** generic geo ***/ -int rnd_point_in_triangle(pcb_vector_t A, pcb_vector_t B, pcb_vector_t C, pcb_vector_t P); +int rnd_point_in_triangle(rnd_vector_t A, rnd_vector_t B, rnd_vector_t C, rnd_vector_t P); #endif /* PCB_POLYAREA_H */ Index: trunk/src/librnd/poly/polygon1_gen.c =================================================================== --- trunk/src/librnd/poly/polygon1_gen.c (revision 31036) +++ trunk/src/librnd/poly/polygon1_gen.c (revision 31037) @@ -48,8 +48,8 @@ static void init_rotate_cache(void) { if (!rotate_circle_seg_inited) { - double cos_ang = cos(2.0 * M_PI / PCB_POLY_CIRC_SEGS_F); - double sin_ang = sin(2.0 * M_PI / PCB_POLY_CIRC_SEGS_F); + double cos_ang = cos(2.0 * M_PI / RND_POLY_CIRC_SEGS_F); + double sin_ang = sin(2.0 * M_PI / RND_POLY_CIRC_SEGS_F); rotate_circle_seg[0] = cos_ang; rotate_circle_seg[1] = -sin_ang; @@ -59,28 +59,28 @@ } } -rnd_polyarea_t *pcb_poly_from_contour(pcb_pline_t * contour) +rnd_polyarea_t *pcb_poly_from_contour(rnd_pline_t * contour) { rnd_polyarea_t *p; - pcb_poly_contour_pre(contour, rnd_true); - assert(contour->Flags.orient == PCB_PLF_DIR); - if (!(p = pcb_polyarea_create())) + rnd_poly_contour_pre(contour, rnd_true); + assert(contour->Flags.orient == RND_PLF_DIR); + if (!(p = rnd_polyarea_create())) return NULL; - pcb_polyarea_contour_include(p, contour); - assert(pcb_poly_valid(p)); + rnd_polyarea_contour_include(p, contour); + assert(rnd_poly_valid(p)); return p; } -rnd_polyarea_t *pcb_poly_from_contour_autoinv(pcb_pline_t *contour) +rnd_polyarea_t *pcb_poly_from_contour_autoinv(rnd_pline_t *contour) { rnd_polyarea_t *p; - pcb_poly_contour_pre(contour, rnd_true); - if (contour->Flags.orient != PCB_PLF_DIR) - pcb_poly_contour_inv(contour); - if (!(p = pcb_polyarea_create())) + rnd_poly_contour_pre(contour, rnd_true); + if (contour->Flags.orient != RND_PLF_DIR) + rnd_poly_contour_inv(contour); + if (!(p = rnd_polyarea_create())) return NULL; - pcb_polyarea_contour_include(p, contour); - assert(pcb_poly_valid(p)); + rnd_polyarea_contour_include(p, contour); + assert(rnd_poly_valid(p)); return p; } @@ -88,9 +88,9 @@ #define ARC_ANGLE 5 static rnd_polyarea_t *ArcPolyNoIntersect(rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t width, rnd_coord_t height, rnd_angle_t astart, rnd_angle_t adelta, rnd_coord_t thick, int end_caps) { - pcb_pline_t *contour = NULL; + rnd_pline_t *contour = NULL; rnd_polyarea_t *np = NULL; - pcb_vector_t v, v2; + rnd_vector_t v, v2; int i, segs; double ang, da, rx, ry; long half; @@ -105,8 +105,8 @@ } half = (thick + 1) / 2; - pcb_arc_get_endpt(cx, cy, width, height, astart, adelta, 0, &endx1, &endy1); - pcb_arc_get_endpt(cx, cy, width, height, astart, adelta, 1, &endx2, &endy2); + rnd_arc_get_endpt(cx, cy, width, height, astart, adelta, 0, &endx1, &endy1); + rnd_arc_get_endpt(cx, cy, width, height, astart, adelta, 1, &endx2, &endy2); /* start with inner radius */ rx = MAX(width - half, 0); @@ -114,7 +114,7 @@ segs = 1; if (thick > 0) segs = MAX(segs, adelta * M_PI / 360 * - sqrt(sqrt((double) rx * rx + (double) ry * ry) / PCB_POLY_ARC_MAX_DEVIATION / 2 / thick)); + sqrt(sqrt((double) rx * rx + (double) ry * ry) / RND_POLY_ARC_MAX_DEVIATION / 2 / thick)); segs = MAX(segs, adelta / ARC_ANGLE); ang = astart; @@ -122,13 +122,13 @@ radius_adj = (M_PI * da / 360) * (M_PI * da / 360) / 2; v[0] = cx - rx * cos(ang * RND_M180); v[1] = cy + ry * sin(ang * RND_M180); - if ((contour = pcb_poly_contour_new(v)) == NULL) + if ((contour = rnd_poly_contour_new(v)) == NULL) return 0; for (i = 0; i < segs - 1; i++) { ang += da; v[0] = cx - rx * cos(ang * RND_M180); v[1] = cy + ry * sin(ang * RND_M180); - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); } /* find last point */ ang = astart + adelta; @@ -146,7 +146,7 @@ for (i = 0; i < segs; i++) { v[0] = cx - rx * cos(ang * RND_M180); v[1] = cy + ry * sin(ang * RND_M180); - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); ang += da; } @@ -159,7 +159,7 @@ if (edx < 0) edx = -edx; if (edy < 0) edy = -edy; if (edx+edy > RND_MM_TO_COORD(0.001)) - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v2)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v2)); /* now add other round cap */ @@ -174,8 +174,8 @@ rnd_polyarea_t *pcb_poly_from_rect(rnd_coord_t x1, rnd_coord_t x2, rnd_coord_t y1, rnd_coord_t y2) { - pcb_pline_t *contour = NULL; - pcb_vector_t v; + rnd_pline_t *contour = NULL; + rnd_vector_t v; /* Return NULL for zero or negatively sized rectangles */ if (x2 <= x1 || y2 <= y1) @@ -183,24 +183,24 @@ v[0] = x1; v[1] = y1; - if ((contour = pcb_poly_contour_new(v)) == NULL) + if ((contour = rnd_poly_contour_new(v)) == NULL) return NULL; v[0] = x2; v[1] = y1; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); v[0] = x2; v[1] = y2; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); v[0] = x1; v[1] = y2; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); return pcb_poly_from_contour(contour); } rnd_polyarea_t *pcb_poly_from_octagon(rnd_coord_t x, rnd_coord_t y, rnd_coord_t radius, int style) { - pcb_pline_t *contour = NULL; - pcb_vector_t v; + rnd_pline_t *contour = NULL; + rnd_vector_t v; double xm[8], ym[8]; pcb_poly_square_pin_factors(style, xm, ym); @@ -209,40 +209,40 @@ /* point 7 */ v[0] = x + ROUND(radius * 0.5) * xm[7]; v[1] = y + ROUND(radius * RND_TAN_22_5_DEGREE_2) * ym[7]; - if ((contour = pcb_poly_contour_new(v)) == NULL) + if ((contour = rnd_poly_contour_new(v)) == NULL) return NULL; /* point 6 */ v[0] = x + ROUND(radius * RND_TAN_22_5_DEGREE_2) * xm[6]; v[1] = y + ROUND(radius * 0.5) * ym[6]; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); /* point 5 */ v[0] = x - ROUND(radius * RND_TAN_22_5_DEGREE_2) * xm[5]; v[1] = y + ROUND(radius * 0.5) * ym[5]; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); /* point 4 */ v[0] = x - ROUND(radius * 0.5) * xm[4]; v[1] = y + ROUND(radius * RND_TAN_22_5_DEGREE_2) * ym[4]; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); /* point 3 */ v[0] = x - ROUND(radius * 0.5) * xm[3]; v[1] = y - ROUND(radius * RND_TAN_22_5_DEGREE_2) * ym[3]; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); /* point 2 */ v[0] = x - ROUND(radius * RND_TAN_22_5_DEGREE_2) * xm[2]; v[1] = y - ROUND(radius * 0.5) * ym[2]; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); /* point 1 */ v[0] = x + ROUND(radius * RND_TAN_22_5_DEGREE_2) * xm[1]; v[1] = y - ROUND(radius * 0.5) * ym[1]; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); /* point 0 */ v[0] = x + ROUND(radius * 0.5) * xm[0]; v[1] = y - ROUND(radius * RND_TAN_22_5_DEGREE_2) * ym[0]; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); return pcb_poly_from_contour(contour); } -static void pcb_poly_frac_circle_(pcb_pline_t * c, rnd_coord_t X, rnd_coord_t Y, pcb_vector_t v, int range, int add_last) +static void pcb_poly_frac_circle_(rnd_pline_t * c, rnd_coord_t X, rnd_coord_t Y, rnd_vector_t v, int range, int add_last) { double oe1, oe2, e1, e2, t1; int i, orange = range; @@ -252,14 +252,14 @@ oe1 = (v[0] - X); oe2 = (v[1] - Y); - pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(c->head->prev, rnd_poly_node_create(v)); /* move vector to origin */ - e1 = (v[0] - X) * PCB_POLY_CIRC_RADIUS_ADJ; - e2 = (v[1] - Y) * PCB_POLY_CIRC_RADIUS_ADJ; + e1 = (v[0] - X) * RND_POLY_CIRC_RADIUS_ADJ; + e2 = (v[1] - Y) * RND_POLY_CIRC_RADIUS_ADJ; /* NB: the caller adds the last vertex, hence the -1 */ - range = PCB_POLY_CIRC_SEGS / range - 1; + range = RND_POLY_CIRC_SEGS / range - 1; for (i = 0; i < range; i++) { /* rotate the vector */ t1 = rotate_circle_seg[0] * e1 + rotate_circle_seg[1] * e2; @@ -267,13 +267,13 @@ e1 = t1; v[0] = X + ROUND(e1); v[1] = Y + ROUND(e2); - pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(c->head->prev, rnd_poly_node_create(v)); } if ((add_last) && (orange == 4)) { v[0] = X - ROUND(oe2); v[1] = Y + ROUND(oe1); - pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(c->head->prev, rnd_poly_node_create(v)); } } @@ -285,13 +285,13 @@ * 2 for a half circle * or 4 for a quarter circle */ -void pcb_poly_frac_circle(pcb_pline_t * c, rnd_coord_t X, rnd_coord_t Y, pcb_vector_t v, int range) +void pcb_poly_frac_circle(rnd_pline_t * c, rnd_coord_t X, rnd_coord_t Y, rnd_vector_t v, int range) { pcb_poly_frac_circle_(c, X, Y, v, range, 0); } /* same but adds the last vertex */ -void pcb_poly_frac_circle_end(pcb_pline_t * c, rnd_coord_t X, rnd_coord_t Y, pcb_vector_t v, int range) +void pcb_poly_frac_circle_end(rnd_pline_t * c, rnd_coord_t X, rnd_coord_t Y, rnd_vector_t v, int range) { pcb_poly_frac_circle_(c, X, Y, v, range, 1); } @@ -300,14 +300,14 @@ /* create a circle approximation from lines */ rnd_polyarea_t *pcb_poly_from_circle(rnd_coord_t x, rnd_coord_t y, rnd_coord_t radius) { - pcb_pline_t *contour; - pcb_vector_t v; + rnd_pline_t *contour; + rnd_vector_t v; if (radius <= 0) return NULL; v[0] = x + radius; v[1] = y; - if ((contour = pcb_poly_contour_new(v)) == NULL) + if ((contour = rnd_poly_contour_new(v)) == NULL) return NULL; pcb_poly_frac_circle(contour, x, y, v, 1); contour->is_round = rnd_true; @@ -320,27 +320,27 @@ /* make a rounded-corner rectangle with radius t beyond x1,x2,y1,y2 rectangle */ rnd_polyarea_t *RoundRect(rnd_coord_t x1, rnd_coord_t x2, rnd_coord_t y1, rnd_coord_t y2, rnd_coord_t t) { - pcb_pline_t *contour = NULL; - pcb_vector_t v; + rnd_pline_t *contour = NULL; + rnd_vector_t v; assert(x2 > x1); assert(y2 > y1); v[0] = x1 - t; v[1] = y1; - if ((contour = pcb_poly_contour_new(v)) == NULL) + if ((contour = rnd_poly_contour_new(v)) == NULL) return NULL; pcb_poly_frac_circle_end(contour, x1, y1, v, 4); v[0] = x2; v[1] = y1 - t; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); pcb_poly_frac_circle_end(contour, x2, y1, v, 4); v[0] = x2 + t; v[1] = y2; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); pcb_poly_frac_circle_end(contour, x2, y2, v, 4); v[0] = x1; v[1] = y2 + t; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); pcb_poly_frac_circle_end(contour, x1, y2, v, 4); return pcb_poly_from_contour(contour); } @@ -348,9 +348,9 @@ rnd_polyarea_t *pcb_poly_from_line(rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2, rnd_coord_t thick, rnd_bool square) { - pcb_pline_t *contour = NULL; + rnd_pline_t *contour = NULL; rnd_polyarea_t *np = NULL; - pcb_vector_t v; + rnd_vector_t v; double d, dx, dy; long half; @@ -378,21 +378,21 @@ } v[0] = x1 - dx; v[1] = y1 - dy; - if ((contour = pcb_poly_contour_new(v)) == NULL) + if ((contour = rnd_poly_contour_new(v)) == NULL) return 0; v[0] = x2 - dx; v[1] = y2 - dy; if (square) - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); else pcb_poly_frac_circle(contour, x2, y2, v, 2); v[0] = x2 + dx; v[1] = y2 + dy; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); v[0] = x1 + dx; v[1] = y1 + dy; if (square) - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); else pcb_poly_frac_circle(contour, x1, y1, v, 2); /* now we have the line contour */ @@ -419,14 +419,14 @@ tmp_arc = ArcPolyNoIntersect(cx, cy, width, height, astart, adelta, thick, 0); - pcb_arc_get_endpt(cx, cy, width, height, astart, adelta, 0, &lx1, &ly1); + rnd_arc_get_endpt(cx, cy, width, height, astart, adelta, 0, &lx1, &ly1); tmp1 = pcb_poly_from_line(lx1, ly1, lx1, ly1, thick, 0); - pcb_arc_get_endpt(cx, cy, width, height, astart, adelta, 1, &lx1, &ly1); + rnd_arc_get_endpt(cx, cy, width, height, astart, adelta, 1, &lx1, &ly1); tmp2 = pcb_poly_from_line(lx1, ly1, lx1, ly1, thick, 0); - pcb_polyarea_boolean_free(tmp1, tmp2, &ends, PCB_PBO_UNITE); - pcb_polyarea_boolean_free(ends, tmp_arc, &res, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(tmp1, tmp2, &ends, RND_PBO_UNITE); + rnd_polyarea_boolean_free(ends, tmp_arc, &res, RND_PBO_UNITE); return res; } @@ -438,7 +438,7 @@ tmp1 = ArcPolyNoIntersect(cx, cy, width, height, astart, half_delta, thick, 1); tmp2 = ArcPolyNoIntersect(cx, cy, width, height, astart+half_delta, adelta-half_delta, thick, 1); - pcb_polyarea_boolean_free(tmp1, tmp2, &res, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(tmp1, tmp2, &res, RND_PBO_UNITE); return res; } @@ -472,9 +472,9 @@ /* NB: This function will free the passed rnd_polyarea_t. It must only be passed a single rnd_polyarea_t (pa->f == pa->b == pa) */ -static void r_NoHolesPolygonDicer(rnd_polyarea_t * pa, void (*emit) (pcb_pline_t *, void *), void *user_data) +static void r_NoHolesPolygonDicer(rnd_polyarea_t * pa, void (*emit) (rnd_pline_t *, void *), void *user_data) { - pcb_pline_t *p = pa->contours; + rnd_pline_t *p = pa->contours; if (!pa->contours->next) { /* no holes */ pa->contours = NULL; /* The callback now owns the contour */ @@ -481,7 +481,7 @@ /* Don't bother removing it from the rnd_polyarea_t's rtree since we're going to free the rnd_polyarea_t below anyway */ emit(p, user_data); - pcb_polyarea_free(&pa); + rnd_polyarea_free(&pa); return; } else { @@ -489,7 +489,7 @@ /* make a rectangle of the left region slicing through the middle of the first hole */ poly2 = pcb_poly_from_rect(p->xmin, (p->next->xmin + p->next->xmax) / 2, p->ymin, p->ymax); - pcb_polyarea_and_subtract_free(pa, poly2, &left, &right); + rnd_polyarea_and_subtract_free(pa, poly2, &left, &right); if (left) { rnd_polyarea_t *cur, *next; cur = left; @@ -515,7 +515,7 @@ } } -void pcb_polyarea_no_holes_dicer(rnd_polyarea_t *main_contour, rnd_coord_t clipX1, rnd_coord_t clipY1, rnd_coord_t clipX2, rnd_coord_t clipY2, void (*emit)(pcb_pline_t *, void *), void *user_data) +void pcb_polyarea_no_holes_dicer(rnd_polyarea_t *main_contour, rnd_coord_t clipX1, rnd_coord_t clipY1, rnd_coord_t clipX2, rnd_coord_t clipY2, void (*emit)(rnd_pline_t *, void *), void *user_data) { rnd_polyarea_t *cur, *next; @@ -522,7 +522,7 @@ /* clip to the bounding box */ if ((clipX1 != clipX2) || (clipY1 != clipY2)) { rnd_polyarea_t *cbox = pcb_poly_from_rect(clipX1, clipX2, clipY1, clipY2); - pcb_polyarea_boolean_free(main_contour, cbox, &main_contour, PCB_PBO_ISECT); + rnd_polyarea_boolean_free(main_contour, cbox, &main_contour, RND_PBO_ISECT); } if (main_contour == NULL) return; Index: trunk/src/librnd/poly/polygon1_gen.h =================================================================== --- trunk/src/librnd/poly/polygon1_gen.h (revision 31036) +++ trunk/src/librnd/poly/polygon1_gen.h (revision 31037) @@ -6,8 +6,8 @@ void pcb_poly_square_pin_factors(int style, double *xm, double *ym); -rnd_polyarea_t *pcb_poly_from_contour(pcb_pline_t *pl); -rnd_polyarea_t *pcb_poly_from_contour_autoinv(pcb_pline_t *pl); +rnd_polyarea_t *pcb_poly_from_contour(rnd_pline_t *pl); +rnd_polyarea_t *pcb_poly_from_contour_autoinv(rnd_pline_t *pl); rnd_polyarea_t *pcb_poly_from_circle(rnd_coord_t x, rnd_coord_t y, rnd_coord_t radius); rnd_polyarea_t *pcb_poly_from_octagon(rnd_coord_t x, rnd_coord_t y, rnd_coord_t radius, int style); @@ -24,7 +24,7 @@ /* Slice up a polyarea-with-holes into a set of polygon islands with no holes, within the clip area. If the clip area is all-zero, do not clip. Free's main_contour. */ -void pcb_polyarea_no_holes_dicer(rnd_polyarea_t *main_contour, rnd_coord_t clipX1, rnd_coord_t clipY1, rnd_coord_t clipX2, rnd_coord_t clipY2, void (*emit)(pcb_pline_t *, void *), void *user_data); +void pcb_polyarea_no_holes_dicer(rnd_polyarea_t *main_contour, rnd_coord_t clipX1, rnd_coord_t clipY1, rnd_coord_t clipX2, rnd_coord_t clipY2, void (*emit)(rnd_pline_t *, void *), void *user_data); /* Add vertices in a fractional-circle starting from v centered at X, Y and going counter-clockwise. Does not include the first point. Last argument is: @@ -31,9 +31,9 @@ 1 for a full circle 2 for a half circle 4 for a quarter circle */ -void pcb_poly_frac_circle(pcb_pline_t * c, rnd_coord_t X, rnd_coord_t Y, pcb_vector_t v, int range); +void pcb_poly_frac_circle(rnd_pline_t * c, rnd_coord_t X, rnd_coord_t Y, rnd_vector_t v, int range); /* same but adds the last vertex */ -void pcb_poly_frac_circle_end(pcb_pline_t * c, rnd_coord_t X, rnd_coord_t Y, pcb_vector_t v, int range); +void pcb_poly_frac_circle_end(rnd_pline_t * c, rnd_coord_t X, rnd_coord_t Y, rnd_vector_t v, int range); #endif Index: trunk/src/librnd/poly/self_isc.c =================================================================== --- trunk/src/librnd/poly/self_isc.c (revision 31036) +++ trunk/src/librnd/poly/self_isc.c (revision 31037) @@ -48,11 +48,11 @@ vtp0_t node; } vhub_t; -static pcb_vnode_t *pcb_pline_split(pcb_vnode_t *v, pcb_vector_t at) +static rnd_vnode_t *pcb_pline_split(rnd_vnode_t *v, rnd_vector_t at) { - pcb_vnode_t *v2 = pcb_poly_node_add_single(v, at); + rnd_vnode_t *v2 = rnd_poly_node_add_single(v, at); - v2 = pcb_poly_node_create(at); + v2 = rnd_poly_node_create(at); assert(v2 != NULL); v2->cvc_prev = v2->cvc_next = NULL; v2->Flags.status = UNKNWN; @@ -66,29 +66,29 @@ return v2; } -static pcb_vnode_t *pcb_pline_end_at(pcb_vnode_t *v, pcb_vector_t at) +static rnd_vnode_t *pcb_pline_end_at(rnd_vnode_t *v, rnd_vector_t at) { - if (pcb_vect_dist2(at, v->point) < PCB_POLY_ENDP_EPSILON) + if (rnd_vect_dist2(at, v->point) < RND_POLY_ENDP_EPSILON) return v; - if (pcb_vect_dist2(at, v->next->point) < PCB_POLY_ENDP_EPSILON) + if (rnd_vect_dist2(at, v->next->point) < RND_POLY_ENDP_EPSILON) return v->next; return NULL; } -static vhub_t *hub_find(vtp0_t *hubs, pcb_vnode_t *v, rnd_bool insert) +static vhub_t *hub_find(vtp0_t *hubs, rnd_vnode_t *v, rnd_bool insert) { int n, m; for(n = 0; n < vtp0_len(hubs); n++) { vhub_t *h = *vtp0_get(hubs, n, 0); - pcb_vnode_t *stored, **st; - st = (pcb_vnode_t **)vtp0_get(&h->node, 0, 0); + rnd_vnode_t *stored, **st; + st = (rnd_vnode_t **)vtp0_get(&h->node, 0, 0); if (st == NULL) continue; stored = *st; /* found the hub at the specific location */ - if (pcb_vect_dist2(stored->point, v->point) < PCB_POLY_ENDP_EPSILON) { + if (rnd_vect_dist2(stored->point, v->point) < RND_POLY_ENDP_EPSILON) { for(m = 0; m < vtp0_len(&h->node); m++) { - st = (pcb_vnode_t **)vtp0_get(&h->node, m, 0); + st = (rnd_vnode_t **)vtp0_get(&h->node, m, 0); if (st != NULL) { stored = *st; if (stored == v) /* already on the list */ @@ -107,13 +107,13 @@ } /* remove v from h; if h has only one node, remove that too */ -static void remove_from_hub(vhub_t *h, pcb_vnode_t *v) +static void remove_from_hub(vhub_t *h, rnd_vnode_t *v) { int m; - pcb_vnode_t *stored, **st; + rnd_vnode_t *stored, **st; for(m = 0; m < vtp0_len(&h->node); m++) { - st = (pcb_vnode_t **)vtp0_get(&h->node, m, 0); + st = (rnd_vnode_t **)vtp0_get(&h->node, m, 0); if (st == NULL) { vtp0_remove(&h->node, m, 1); m--; @@ -136,7 +136,7 @@ } /* returns 1 if a new intersection is mapped */ -static int pcb_pline_add_isectp(vtp0_t *hubs, pcb_vnode_t *v) +static int pcb_pline_add_isectp(vtp0_t *hubs, rnd_vnode_t *v) { vhub_t *h; @@ -155,21 +155,21 @@ return 1; } -static int pline_split_off_loop_new(pcb_pline_t *pl, vtp0_t *out, vhub_t *h, pcb_vnode_t *start, rnd_cardinal_t cnt) +static int pline_split_off_loop_new(rnd_pline_t *pl, vtp0_t *out, vhub_t *h, rnd_vnode_t *start, rnd_cardinal_t cnt) { - pcb_pline_t *newpl = NULL; - pcb_vnode_t *v, *next, *tmp; + rnd_pline_t *newpl = NULL; + rnd_vnode_t *v, *next, *tmp; - newpl = pcb_poly_contour_new(start->point); + newpl = rnd_poly_contour_new(start->point); next = start->next; remove_from_hub(h, start); - pcb_poly_vertex_exclude(pl, start); + rnd_poly_vertex_exclude(pl, start); for(v = next; cnt > 0; v = next, cnt--) { TRACE(" Append %mm %mm!\n", v->point[0], v->point[1]); next = v->next; - pcb_poly_vertex_exclude(pl, v); - tmp = pcb_poly_node_create(v->point); - pcb_poly_vertex_include(newpl->head->prev, tmp); + rnd_poly_vertex_exclude(pl, v); + tmp = rnd_poly_node_create(v->point); + rnd_poly_vertex_include(newpl->head->prev, tmp); } TRACE("APPEND: %p %p\n", newpl, newpl->head->next); @@ -177,14 +177,14 @@ return 1; } -static int pline_split_off_loop(pcb_pline_t *pl, vtp0_t *hubs, vtp0_t *out, vhub_t *h, pcb_vnode_t *start) +static int pline_split_off_loop(rnd_pline_t *pl, vtp0_t *hubs, vtp0_t *out, vhub_t *h, rnd_vnode_t *start) { - pcb_vnode_t *v; + rnd_vnode_t *v; rnd_cardinal_t cnt; for(v = start->next, cnt = 0;; v = v->next) { if (v->Flags.in_hub) { - if (pcb_vect_dist2(start->point, v->point) < PCB_POLY_ENDP_EPSILON) + if (rnd_vect_dist2(start->point, v->point) < RND_POLY_ENDP_EPSILON) break; /* found a matching hub point */ goto skip_to_backward; /* found a different hub point, skip */ } @@ -198,7 +198,7 @@ skip_to_backward:; for(v = start->prev, cnt = 0;; v = v->prev) { if (v->Flags.in_hub) { - if (pcb_vect_dist2(start->point, v->point) < PCB_POLY_ENDP_EPSILON) { + if (rnd_vect_dist2(start->point, v->point) < RND_POLY_ENDP_EPSILON) { start = v; break; /* found a matching hub point */ } @@ -211,15 +211,15 @@ return pline_split_off_loop_new(pl, out, h, start, cnt); } -rnd_bool pcb_pline_is_selfint(pcb_pline_t *pl) +rnd_bool pcb_pline_is_selfint(rnd_pline_t *pl) { - pcb_vnode_t *va, *vb; + rnd_vnode_t *va, *vb; - va = (pcb_vnode_t *)pl->head; + va = (rnd_vnode_t *)pl->head; do { for(vb = va->next->next; vb->next != va; vb = vb->next) { - pcb_vector_t i, tmp; - if (pcb_vect_inters2(va->point, va->next->point, vb->point, vb->next->point, i, tmp) > 0) + rnd_vector_t i, tmp; + if (rnd_vect_inters2(va->point, va->next->point, vb->point, vb->next->point, i, tmp) > 0) return rnd_true; } va = va->next; @@ -228,18 +228,18 @@ } -void pcb_pline_split_selfint(const pcb_pline_t *pl_in, vtp0_t *out) +void pcb_pline_split_selfint(const rnd_pline_t *pl_in, vtp0_t *out) { int n; vtp0_t hubs; - pcb_pline_t *pl = NULL; - pcb_vnode_t *va, *vb, *iva, *ivb; + rnd_pline_t *pl = NULL; + rnd_vnode_t *va, *vb, *iva, *ivb; vtp0_init(&hubs); /* copy the pline and reset the in_hub flag */ - pcb_poly_contour_copy(&pl, pl_in); - va = (pcb_vnode_t *)pl->head; + rnd_poly_contour_copy(&pl, pl_in); + va = (rnd_vnode_t *)pl->head; do { va->Flags.in_hub = 0; va = va->next; @@ -246,11 +246,11 @@ } while (va != pl->head); /* insert corners at intersections, collect a list of intersection hubs */ - va = (pcb_vnode_t *)pl->head; + va = (rnd_vnode_t *)pl->head; do { for(vb = va->next->next; vb->next != va; vb = vb->next) { - pcb_vector_t i, tmp; - if (pcb_vect_inters2(va->point, va->next->point, vb->point, vb->next->point, i, tmp) > 0) { + rnd_vector_t i, tmp; + if (rnd_vect_inters2(va->point, va->next->point, vb->point, vb->next->point, i, tmp) > 0) { iva = pcb_pline_end_at(va, i); if (iva == NULL) iva = pcb_pline_split(va, i); @@ -269,7 +269,7 @@ for(n = 0; n < vtp0_len(&hubs); n++) { int m; vhub_t *h = *vtp0_get(&hubs, n, 0); - pcb_vnode_t *v, **v_ = (pcb_vnode_t **)vtp0_get(&h->node, 0, 0); + rnd_vnode_t *v, **v_ = (rnd_vnode_t **)vtp0_get(&h->node, 0, 0); if (v_ == NULL) continue; v = *v_; TRACE("hub %p at %mm;%mm:\n", h, v->point[0], v->point[1]); @@ -294,7 +294,7 @@ rnd_cardinal_t pcb_polyarea_split_selfint(rnd_polyarea_t *pa) { - pcb_pline_t *pl, *next, *pln, *prev = NULL; + rnd_pline_t *pl, *next, *pln, *prev = NULL; rnd_cardinal_t cnt = 0; for(pl = pa->contours; pl != NULL; pl = next) { @@ -313,17 +313,17 @@ pa->contours = next; for(n = 0; n < pls.used; n++) { - pln = (pcb_pline_t *)pls.array[n]; - pcb_poly_contour_pre(pln, rnd_true); + pln = (rnd_pline_t *)pls.array[n]; + rnd_poly_contour_pre(pln, rnd_true); if (pln->Flags.orient != pl->Flags.orient) - pcb_poly_contour_inv(pln); - pcb_poly_contour_pre(pln, 0); - pln->tree = pcb_poly_make_edge_tree(pln); - pcb_polyarea_contour_include(pa, pln); + rnd_poly_contour_inv(pln); + rnd_poly_contour_pre(pln, 0); + pln->tree = rnd_poly_make_edge_tree(pln); + rnd_polyarea_contour_include(pa, pln); cnt++; } - pcb_poly_contour_del(&pl); + rnd_poly_contour_del(&pl); cnt--; vtp0_uninit(&pls); Index: trunk/src/librnd/poly/self_isc.h =================================================================== --- trunk/src/librnd/poly/self_isc.h (revision 31036) +++ trunk/src/librnd/poly/self_isc.h (revision 31037) @@ -30,11 +30,11 @@ #include /* Returns whether a polyline is self-intersecting. O(n^2) */ -rnd_bool pcb_pline_is_selfint(pcb_pline_t *pl); +rnd_bool pcb_pline_is_selfint(rnd_pline_t *pl); /* Assume pl is self-intersecting split it up into a list of freshly allocated plines in out. O(n^2) */ -void pcb_pline_split_selfint(const pcb_pline_t *pl, vtp0_t *out); +void pcb_pline_split_selfint(const rnd_pline_t *pl, vtp0_t *out); rnd_cardinal_t pcb_polyarea_split_selfint(rnd_polyarea_t *pa); Index: trunk/src/netlist_geo.c =================================================================== --- trunk/src/netlist_geo.c (revision 31036) +++ trunk/src/netlist_geo.c (revision 31037) @@ -147,7 +147,7 @@ for(pa = pcb_poly_island_first(o1, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { rnd_coord_t x, y; - pcb_pline_t *pl; + rnd_pline_t *pl; int go; pl = pcb_poly_contour(&it); @@ -228,7 +228,7 @@ for(pa = pcb_poly_island_first(o2, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { rnd_coord_t x, y; - pcb_pline_t *pl; + rnd_pline_t *pl; int go; pl = pcb_poly_contour(&it); Index: trunk/src/obj_arc.c =================================================================== --- trunk/src/obj_arc.c (revision 31036) +++ trunk/src/obj_arc.c (revision 31037) @@ -156,7 +156,7 @@ if (!mini) { width = (Arc->Thickness + Arc->Clearance) / 2; /* Adjust for our discrete polygon approximation */ - width = (double) width *MAX(PCB_POLY_CIRC_RADIUS_ADJ, (1.0 + PCB_POLY_ARC_MAX_DEVIATION)) + 0.5; + width = (double) width *MAX(RND_POLY_CIRC_RADIUS_ADJ, (1.0 + RND_POLY_ARC_MAX_DEVIATION)) + 0.5; } else width = Arc->Thickness / 2; @@ -178,7 +178,7 @@ void pcb_arc_get_end(pcb_arc_t *arc, int which, rnd_coord_t *x, rnd_coord_t *y) { - pcb_arc_get_endpt(arc->X, arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta, which, x, y); + rnd_arc_get_endpt(arc->X, arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta, which, x, y); } Index: trunk/src/obj_line.c =================================================================== --- trunk/src/obj_line.c (revision 31036) +++ trunk/src/obj_line.c (revision 31037) @@ -349,7 +349,7 @@ rnd_coord_t width = mini ? (Line->Thickness + 1) / 2 : (Line->Thickness + Line->Clearance + 1) / 2; /* Adjust for our discrete polygon approximation */ - width = (double) width *PCB_POLY_CIRC_RADIUS_ADJ + 0.5; + width = (double) width *RND_POLY_CIRC_RADIUS_ADJ + 0.5; dst->X1 = MIN(Line->Point1.X, Line->Point2.X) - width; dst->X2 = MAX(Line->Point1.X, Line->Point2.X) + width; Index: trunk/src/obj_pinvia_therm.c =================================================================== --- trunk/src/obj_pinvia_therm.c (revision 31036) +++ trunk/src/obj_pinvia_therm.c (revision 31037) @@ -43,8 +43,8 @@ static rnd_polyarea_t *pcb_pa_diag_line(rnd_coord_t X, rnd_coord_t Y, rnd_coord_t l, rnd_coord_t w, rnd_bool rt) { - pcb_pline_t *c; - pcb_vector_t v; + rnd_pline_t *c; + rnd_vector_t v; rnd_coord_t x1, x2, y1, y2; if (rt) { @@ -62,17 +62,17 @@ v[0] = X + x1; v[1] = Y + y2; - if ((c = pcb_poly_contour_new(v)) == NULL) + if ((c = rnd_poly_contour_new(v)) == NULL) return NULL; v[0] = X - x2; v[1] = Y - y1; - pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(c->head->prev, rnd_poly_node_create(v)); v[0] = X - x1; v[1] = Y - y2; - pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(c->head->prev, rnd_poly_node_create(v)); v[0] = X + x2; v[1] = Y + y1; - pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(c->head->prev, rnd_poly_node_create(v)); return pcb_poly_from_contour(c); } @@ -97,7 +97,7 @@ pa = pcb_poly_from_circle(cx, cy, t); arc = pcb_poly_from_circle(cx, cy, thickness / 2); /* create a thin ring */ - pcb_polyarea_boolean_free(pa, arc, &m, PCB_PBO_SUB); + rnd_polyarea_boolean_free(pa, arc, &m, RND_PBO_SUB); /* fix me needs error checking */ if (style == 2) { /* t is the theoretically required length, but we use twice that @@ -104,7 +104,7 @@ * to avoid discretisation errors in our circle approximation. */ pa = pcb_poly_from_rect(cx - t * 2, cx + t * 2, cy - w, cy + w); - pcb_polyarea_boolean_free(m, pa, &arc, PCB_PBO_SUB); + rnd_polyarea_boolean_free(m, pa, &arc, RND_PBO_SUB); pa = pcb_poly_from_rect(cx - w, cx + w, cy - t * 2, cy + t * 2); } else { @@ -112,10 +112,10 @@ * to avoid discretisation errors in our circle approximation. */ pa = pcb_pa_diag_line(cx, cy, t * 2, w, rnd_true); - pcb_polyarea_boolean_free(m, pa, &arc, PCB_PBO_SUB); + rnd_polyarea_boolean_free(m, pa, &arc, RND_PBO_SUB); pa = pcb_pa_diag_line(cx, cy, t * 2, w, rnd_false); } - pcb_polyarea_boolean_free(arc, pa, &m, PCB_PBO_SUB); + rnd_polyarea_boolean_free(arc, pa, &m, RND_PBO_SUB); return m; } Index: trunk/src/obj_poly.c =================================================================== --- trunk/src/obj_poly.c (revision 31036) +++ trunk/src/obj_poly.c (revision 31037) @@ -159,8 +159,8 @@ free(polygon->HoleIndex); if (polygon->Clipped) - pcb_polyarea_free(&polygon->Clipped); - pcb_poly_contours_free(&polygon->NoHoles); + rnd_polyarea_free(&polygon->Clipped); + rnd_poly_contours_free(&polygon->NoHoles); /* have to preserve parent info for unreg */ parent = polygon->parent; @@ -207,13 +207,13 @@ int pcb_poly_is_valid(pcb_poly_t *p) { - pcb_pline_t *contour = NULL; + rnd_pline_t *contour = NULL; rnd_polyarea_t *np1 = NULL, *np = NULL; rnd_cardinal_t n; - pcb_vector_t v; + rnd_vector_t v; int res = 1; - np1 = np = pcb_polyarea_create(); + np1 = np = rnd_polyarea_create(); if (np == NULL) return 0; @@ -225,24 +225,24 @@ v[0] = p->Points[n].X; v[1] = p->Points[n].Y; if (contour == NULL) { - if ((contour = pcb_poly_contour_new(v)) == NULL) + if ((contour = rnd_poly_contour_new(v)) == NULL) goto err; } else { - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); } /* Is current point last in contour? If so process it. */ if (n == p->PointN - 1) { - pcb_poly_contour_pre(contour, rnd_true); + rnd_poly_contour_pre(contour, rnd_true); if (contour->Count == 0) { - pcb_poly_contours_free(&contour); + rnd_poly_contours_free(&contour); goto err; } { /* count number of not-on-the-same-line vertices to make sure there's more than 2*/ - pcb_vnode_t *cur; + rnd_vnode_t *cur; int r = 0; cur = contour->head; @@ -250,30 +250,30 @@ r++; } while ((cur = cur->next) != contour->head); if (r < 3) { - pcb_poly_contours_free(&contour); + rnd_poly_contours_free(&contour); goto err; } } /* make sure it is a positive contour (outer) or negative (hole) */ - if (contour->Flags.orient != PCB_PLF_DIR) { - pcb_poly_contour_inv(contour); + if (contour->Flags.orient != RND_PLF_DIR) { + rnd_poly_contour_inv(contour); } - pcb_polyarea_contour_include(np, contour); + rnd_polyarea_contour_include(np, contour); if (contour->Count == 0) goto err; contour = NULL; - if (!pcb_poly_valid(np)) + if (!rnd_poly_valid(np)) res = 0; } } - pcb_polyarea_free(&np1); + rnd_polyarea_free(&np1); return res; err:; - pcb_polyarea_free(&np1); + rnd_polyarea_free(&np1); return 0; } @@ -454,7 +454,7 @@ { rnd_coord_t x, y; pcb_poly_it_t it; - pcb_pline_t *pl; + rnd_pline_t *pl; int go; pcb_poly_t *polygon = pcb_poly_new(Layer, Clearance, Flags); @@ -468,7 +468,7 @@ 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); - pcb_poly_contours_free(&it.cntr); + rnd_poly_contours_free(&it.cntr); pcb_add_poly_on_layer(Layer, polygon); return polygon; @@ -1170,13 +1170,13 @@ void pcb_poly_map_contours(pcb_poly_t *p, void *ctx, pcb_poly_map_cb_t *cb) { rnd_polyarea_t *pa; - pcb_pline_t *pl; + rnd_pline_t *pl; pa = p->Clipped; do { int cidx; for(cidx = 0, pl = pa->contours; pl != NULL; cidx++, pl = pl->next) { - pcb_vnode_t *v; + rnd_vnode_t *v; cb(p, ctx, (cidx == 0 ? PCB_POLYEV_ISLAND_START : PCB_POLYEV_HOLE_START), 0, 0); v = pl->head->next; do { @@ -1298,11 +1298,11 @@ rnd_coord_t offs = info->xform->bloat / 2; pcb_poly_copy(np, polygon, 0, 0); - pcb_polyarea_copy0(&np->Clipped, polygon->Clipped); + rnd_polyarea_copy0(&np->Clipped, polygon->Clipped); /* iterate over all islands of a polygon */ for(pa = pcb_poly_island_first(np, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { - pcb_pline_t *pl; + rnd_pline_t *pl; /* check if we have a contour for the given island */ pl = pcb_poly_contour(&it); @@ -1344,7 +1344,7 @@ } else { if ((allow_term_gfx) && pcb_draw_term_need_gfx(polygon) && pcb_draw_term_hid_permission()) { - pcb_vnode_t *n, *head; + rnd_vnode_t *n, *head; int i; pcb_dhlp_fill_pcb_polygon(pcb_draw_out.active_padGC, polygon, info->drawn_area); head = polygon->Clipped->contours->head; Index: trunk/src/obj_poly.h =================================================================== --- trunk/src/obj_poly.h (revision 31036) +++ trunk/src/obj_poly.h (revision 31037) @@ -42,7 +42,7 @@ rnd_cardinal_t PointN; /* number of points in polygon */ rnd_cardinal_t PointMax; /* max number from malloc() */ rnd_polyarea_t *Clipped; /* the clipped region of this polygon */ - pcb_pline_t *NoHoles; /* the polygon broken into hole-less regions */ + rnd_pline_t *NoHoles; /* the polygon broken into hole-less regions */ int NoHolesValid; /* Is the NoHoles polygon up to date? */ rnd_point_t *Points; /* data */ rnd_cardinal_t *HoleIndex; /* Index of hole data within the Points array */ @@ -124,8 +124,8 @@ typedef struct pcb_poly_it_s { const pcb_poly_t *p; rnd_polyarea_t *pa; - pcb_pline_t *cntr; - pcb_vnode_t *v; + rnd_pline_t *cntr; + rnd_vnode_t *v; } pcb_poly_it_t; /* WARNING: if the poly is not a FULLPOLY, quit after the first island else @@ -153,7 +153,7 @@ } /* Set the iterator to trace the outer contour of the current island */ -RND_INLINE pcb_pline_t *pcb_poly_contour(pcb_poly_it_t *it) +RND_INLINE rnd_pline_t *pcb_poly_contour(pcb_poly_it_t *it) { it->v = NULL; return it->cntr = it->pa->contours; @@ -160,7 +160,7 @@ } /* Set the iterator to trace the first hole of the current island; returns NULL if there are no holes */ -RND_INLINE pcb_pline_t *pcb_poly_hole_first(pcb_poly_it_t *it) +RND_INLINE rnd_pline_t *pcb_poly_hole_first(pcb_poly_it_t *it) { it->v = NULL; return it->cntr = it->pa->contours->next; @@ -167,7 +167,7 @@ } /* Set the iterator to trace the next hole of the current island; returns NULL if there are were more holes */ -RND_INLINE pcb_pline_t *pcb_poly_hole_next(pcb_poly_it_t *it) +RND_INLINE rnd_pline_t *pcb_poly_hole_next(pcb_poly_it_t *it) { it->v = NULL; return it->cntr = it->cntr->next; Index: trunk/src/obj_poly_draw_helper.c =================================================================== --- trunk/src/obj_poly_draw_helper.c (revision 31036) +++ trunk/src/obj_poly_draw_helper.c (revision 31037) @@ -69,10 +69,10 @@ } -static void fill_contour(rnd_hid_gc_t gc, pcb_pline_t * pl) +static void fill_contour(rnd_hid_gc_t gc, rnd_pline_t * pl) { size_t n, i = 0; - pcb_vnode_t *v; + rnd_vnode_t *v; int first = 1; n = pl->Count; @@ -108,9 +108,9 @@ } -static void thindraw_contour(rnd_hid_gc_t gc, pcb_pline_t * pl) +static void thindraw_contour(rnd_hid_gc_t gc, rnd_pline_t * pl) { - pcb_vnode_t *v; + rnd_vnode_t *v; rnd_hid_set_line_width(gc, 0); @@ -136,18 +136,18 @@ vert_opt_end(); } -static void fill_contour_cb(pcb_pline_t * pl, void *user_data) +static void fill_contour_cb(rnd_pline_t * pl, void *user_data) { rnd_hid_gc_t gc = (rnd_hid_gc_t) user_data; - pcb_pline_t *local_pl = pl; + rnd_pline_t *local_pl = pl; fill_contour(gc, pl); - pcb_poly_contours_free(&local_pl); + rnd_poly_contours_free(&local_pl); } -static void fill_clipped_contour(rnd_hid_gc_t gc, pcb_pline_t * pl, const rnd_rnd_box_t * clip_box) +static void fill_clipped_contour(rnd_hid_gc_t gc, rnd_pline_t * pl, const rnd_rnd_box_t * clip_box) { - pcb_pline_t *pl_copy; + rnd_pline_t *pl_copy; rnd_polyarea_t *clip_poly; rnd_polyarea_t *piece_poly; rnd_polyarea_t *clipped_pieces; @@ -162,11 +162,11 @@ } clip_poly = pcb_poly_from_rect(clip_box->X1, clip_box->X2, clip_box->Y1, clip_box->Y2); - pcb_poly_contour_copy(&pl_copy, pl); - piece_poly = pcb_polyarea_create(); - pcb_polyarea_contour_include(piece_poly, pl_copy); - x = pcb_polyarea_boolean_free(piece_poly, clip_poly, &clipped_pieces, PCB_PBO_ISECT); - if (x != pcb_err_ok || clipped_pieces == NULL) + rnd_poly_contour_copy(&pl_copy, pl); + piece_poly = rnd_polyarea_create(); + rnd_polyarea_contour_include(piece_poly, pl_copy); + x = rnd_polyarea_boolean_free(piece_poly, clip_poly, &clipped_pieces, RND_PBO_ISECT); + if (x != rnd_err_ok || clipped_pieces == NULL) return; draw_piece = clipped_pieces; @@ -175,7 +175,7 @@ fill_contour(gc, draw_piece->contours); } while ((draw_piece = draw_piece->f) != clipped_pieces); - pcb_polyarea_free(&clipped_pieces); + rnd_polyarea_free(&clipped_pieces); } /* If at least 50% of the bounding box of the polygon is on the screen, @@ -227,7 +227,7 @@ pcb_poly_no_holes_dicer(poly, clip_box, fill_contour_cb, gc); } if (poly->NoHolesValid && poly->NoHoles) { - pcb_pline_t *pl; + rnd_pline_t *pl; for (pl = poly->NoHoles; pl != NULL; pl = pl->next) { if (clip_box == NULL) @@ -247,7 +247,7 @@ } } -static int thindraw_hole_cb(pcb_pline_t * pl, void *user_data) +static int thindraw_hole_cb(rnd_pline_t * pl, void *user_data) { rnd_hid_gc_t gc = (rnd_hid_gc_t) user_data; thindraw_contour(gc, pl); Index: trunk/src/obj_pstk.c =================================================================== --- trunk/src/obj_pstk.c (revision 31036) +++ trunk/src/obj_pstk.c (revision 31037) @@ -866,7 +866,7 @@ static int pcb_pstk_near_box_(pcb_pstk_t *ps, rnd_rnd_box_t *box, pcb_pstk_shape_t *shape) { pcb_any_line_t pad; - pcb_vector_t v; + rnd_vector_t v; pcb_pstk_proto_t *proto = pcb_pstk_get_proto(ps); int isneg = PCB_IS_BOX_NEGATIVE(box), is_in, n; @@ -944,7 +944,7 @@ the box is fully within the poly - if any of it's corners is in */ v[0] = box->X1 - ps->x; v[1] = box->Y1 - ps->y; - if (pcb_polyarea_contour_inside(shape->data.poly.pa, v)) + if (rnd_polyarea_contour_inside(shape->data.poly.pa, v)) return 1; @@ -1010,7 +1010,7 @@ static int pcb_is_point_in_pstk_(pcb_pstk_t *ps, rnd_coord_t x, rnd_coord_t y, rnd_coord_t radius, pcb_pstk_shape_t *shape) { pcb_any_line_t pad; - pcb_vector_t v; + rnd_vector_t v; switch(shape->shape) { case PCB_PSSH_HSHADOW: @@ -1031,7 +1031,7 @@ pcb_pstk_shape_update_pa(&shape->data.poly); v[0] = x - ps->x; v[1] = y - ps->y; - return pcb_polyarea_contour_inside(shape->data.poly.pa, v); + return rnd_polyarea_contour_inside(shape->data.poly.pa, v); } return 0; Index: trunk/src/obj_pstk_proto.c =================================================================== --- trunk/src/obj_pstk_proto.c (revision 31036) +++ trunk/src/obj_pstk_proto.c (revision 31037) @@ -91,7 +91,7 @@ void pcb_pstk_shape_free_poly(pcb_pstk_poly_t *poly) { if (poly->pa != NULL) - pcb_polyarea_free(&poly->pa); + rnd_polyarea_free(&poly->pa); free(poly->x); poly->len = 0; } @@ -565,7 +565,7 @@ break; case PCB_PSSH_POLY: if (sh->data.poly.pa != NULL) - pcb_polyarea_free(&sh->data.poly.pa); + rnd_polyarea_free(&sh->data.poly.pa); for(i = 0; i < sh->data.poly.len; i++) rnd_rotate(&sh->data.poly.x[i], &sh->data.poly.y[i], 0, 0, cosa, sina); pcb_pstk_shape_update_pa(&sh->data.poly); @@ -601,7 +601,7 @@ break; case PCB_PSSH_POLY: if (sh->data.poly.pa != NULL) - pcb_polyarea_free(&sh->data.poly.pa); + rnd_polyarea_free(&sh->data.poly.pa); for(i = 0; i < sh->data.poly.len; i++) sh->data.poly.y[i] = -sh->data.poly.y[i]; @@ -861,27 +861,27 @@ void pcb_pstk_shape_update_pa(pcb_pstk_poly_t *poly) { int n; - pcb_vector_t v; - pcb_pline_t *pl; + rnd_vector_t v; + rnd_pline_t *pl; v[0] = poly->x[0]; v[1] = poly->y[0]; - pl = pcb_poly_contour_new(v); + pl = rnd_poly_contour_new(v); for(n = 1; n < poly->len; n++) { v[0] = poly->x[n]; v[1] = poly->y[n]; - pcb_poly_vertex_include(pl->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(pl->head->prev, rnd_poly_node_create(v)); } - pcb_poly_contour_pre(pl, 1); + rnd_poly_contour_pre(pl, 1); - poly->pa = pcb_polyarea_create(); - pcb_polyarea_contour_include(poly->pa, pl); + poly->pa = rnd_polyarea_create(); + rnd_polyarea_contour_include(poly->pa, pl); - if (!pcb_poly_valid(poly->pa)) { - poly->pa->contours = NULL; /* keep pl safe from pcb_polyarea_free() */ - pcb_polyarea_free(&poly->pa); + if (!rnd_poly_valid(poly->pa)) { + poly->pa->contours = NULL; /* keep pl safe from rnd_polyarea_free() */ + rnd_polyarea_free(&poly->pa); - poly->pa = pcb_polyarea_create(); - pcb_poly_contour_inv(pl); - pcb_polyarea_contour_include(poly->pa, pl); + poly->pa = rnd_polyarea_create(); + rnd_poly_contour_inv(pl); + rnd_polyarea_contour_include(poly->pa, pl); poly->inverted = 1; } else @@ -1146,7 +1146,7 @@ break; case PCB_PSSH_POLY: pcb_pstk_poly_center(&shp->data.poly, &cx, &cy); - pcb_polyarea_free(&shp->data.poly.pa); + rnd_polyarea_free(&shp->data.poly.pa); if (is_absolute) { TODO("TODO") } @@ -1208,7 +1208,7 @@ break; case PCB_PSSH_POLY: pcb_pstk_poly_center(&shp->data.poly, &cx, &cy); - pcb_polyarea_free(&shp->data.poly.pa); + rnd_polyarea_free(&shp->data.poly.pa); for(n = 0; n < shp->data.poly.len; n++) { shp->data.poly.x[n] = rnd_round((double)shp->data.poly.x[n] * sx); Index: trunk/src/polygon.c =================================================================== --- trunk/src/polygon.c (revision 31036) +++ trunk/src/polygon.c (revision 31037) @@ -158,7 +158,7 @@ return point; } -static void add_noholes_polyarea(pcb_pline_t * pline, void *user_data) +static void add_noholes_polyarea(rnd_pline_t * pline, void *user_data) { pcb_poly_t *poly = (pcb_poly_t *) user_data; @@ -169,7 +169,7 @@ void pcb_poly_compute_no_holes(pcb_poly_t * poly) { - pcb_poly_contours_free(&poly->NoHoles); + rnd_poly_contours_free(&poly->NoHoles); if (poly->Clipped) pcb_poly_no_holes_dicer(poly, NULL, add_noholes_polyarea, poly); else @@ -180,7 +180,7 @@ static rnd_polyarea_t *biggest(rnd_polyarea_t * p) { rnd_polyarea_t *n, *top = NULL; - pcb_pline_t *pl; + rnd_pline_t *pl; rnd_rtree_t *tree; double big = -1; if (!p) @@ -191,7 +191,7 @@ if (n->contours->area < conf_core.design.poly_isle_area) { n->b->f = n->f; n->f->b = n->b; - pcb_poly_contour_del(&n->contours); + rnd_poly_contour_del(&n->contours); if (n == p) p = n->f; n = n->f; @@ -224,15 +224,15 @@ rnd_polyarea_t *pcb_poly_to_polyarea(pcb_poly_t *p, rnd_bool *need_full) { - pcb_pline_t *contour = NULL; + rnd_pline_t *contour = NULL; rnd_polyarea_t *np1 = NULL, *np = NULL; rnd_cardinal_t n; - pcb_vector_t v; + rnd_vector_t v; int hole = 0; *need_full = rnd_false; - np1 = np = pcb_polyarea_create(); + np1 = np = rnd_polyarea_create(); if (np == NULL) return NULL; @@ -244,36 +244,36 @@ v[0] = p->Points[n].X; v[1] = p->Points[n].Y; if (contour == NULL) { - if ((contour = pcb_poly_contour_new(v)) == NULL) + if ((contour = rnd_poly_contour_new(v)) == NULL) return NULL; } else { - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); } /* Is current point last in contour? If so process it. */ if (n == p->PointN - 1 || (hole < p->HoleIndexN && n == p->HoleIndex[hole] - 1)) { - pcb_poly_contour_pre(contour, rnd_true); + rnd_poly_contour_pre(contour, rnd_true); /* make sure it is a positive contour (outer) or negative (hole) */ - if (contour->Flags.orient != (hole ? PCB_PLF_INV : PCB_PLF_DIR)) - pcb_poly_contour_inv(contour); - assert(contour->Flags.orient == (hole ? PCB_PLF_INV : PCB_PLF_DIR)); + if (contour->Flags.orient != (hole ? RND_PLF_INV : RND_PLF_DIR)) + rnd_poly_contour_inv(contour); + assert(contour->Flags.orient == (hole ? RND_PLF_INV : RND_PLF_DIR)); - pcb_polyarea_contour_include(np, contour); + rnd_polyarea_contour_include(np, contour); contour = NULL; TODO("multiple plines within the returned polyarea np does not really work\n"); #if 0 - if (!pcb_poly_valid(np)) { + if (!rnd_poly_valid(np)) { rnd_cardinal_t cnt = pcb_polyarea_split_selfint(np); rnd_message(RND_MSG_ERROR, "Had to split up self-intersecting polygon into %ld parts\n", (long)cnt); if (cnt > 1) *need_full = rnd_true; - assert(pcb_poly_valid(np)); + assert(rnd_poly_valid(np)); } #else - assert(pcb_poly_valid(np)); + assert(rnd_poly_valid(np)); #endif hole++; @@ -309,21 +309,21 @@ assert(p); if (!p->Clipped) { if (fnp) - pcb_polyarea_free(&np); + rnd_polyarea_free(&np); return 1; } - assert(pcb_poly_valid(p->Clipped)); - assert(pcb_poly_valid(np)); + assert(rnd_poly_valid(p->Clipped)); + assert(rnd_poly_valid(np)); if (fnp) - x = pcb_polyarea_boolean_free(p->Clipped, np, &merged, PCB_PBO_SUB); + x = rnd_polyarea_boolean_free(p->Clipped, np, &merged, RND_PBO_SUB); else { - x = pcb_polyarea_boolean(p->Clipped, np, &merged, PCB_PBO_SUB); - pcb_polyarea_free(&p->Clipped); + x = rnd_polyarea_boolean(p->Clipped, np, &merged, RND_PBO_SUB); + rnd_polyarea_free(&p->Clipped); } - assert(!merged || pcb_poly_valid(merged)); - if (x != pcb_err_ok) { - fprintf(stderr, "Error while clipping PCB_PBO_SUB: %d\n", x); - pcb_polyarea_free(&merged); + assert(!merged || rnd_poly_valid(merged)); + if (x != rnd_err_ok) { + fprintf(stderr, "Error while clipping RND_PBO_SUB: %d\n", x); + rnd_polyarea_free(&merged); p->Clipped = NULL; if (p->NoHoles) printf("Just leaked in Subtract\n"); @@ -331,7 +331,7 @@ return -1; } p->Clipped = biggest(merged); - assert(!p->Clipped || pcb_poly_valid(p->Clipped)); + assert(!p->Clipped || rnd_poly_valid(p->Clipped)); if (!p->Clipped) rnd_message(RND_MSG_WARNING, "Polygon #%ld cleared out of existence near (%$mm, %$mm)\n", p->ID, (p->BoundingBox.X1 + p->BoundingBox.X2) / 2, (p->BoundingBox.Y1 + p->BoundingBox.Y2) / 2); @@ -415,7 +415,7 @@ case PCB_OBJ_POLY: poly->Clipped = pcb_poly_to_polyarea(poly, &need_full); np = pcb_poly_clearance_construct(poly, &ctx->clearance); - pcb_polyarea_free(&poly->Clipped); + rnd_polyarea_free(&poly->Clipped); break; default:; } @@ -510,7 +510,7 @@ info->batch_size++; POLY_CLIP_PROG(); - pcb_polyarea_boolean_free(info->accumulate, np, &merged, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(info->accumulate, np, &merged, RND_PBO_UNITE); info->accumulate = merged; if (info->batch_size == SUBTRACT_PADSTACK_BATCH_SIZE) @@ -565,8 +565,8 @@ #define pa_append(src) \ do { \ - pcb_polyarea_boolean(*dst, src, &tmp, PCB_PBO_UNITE); \ - pcb_polyarea_free(dst); \ + rnd_polyarea_boolean(*dst, src, &tmp, RND_PBO_UNITE); \ + rnd_polyarea_free(dst); \ *dst = tmp; \ } while(0) @@ -574,7 +574,7 @@ { rnd_polyarea_t *tmp, *lin; rnd_coord_t x, y, px, py, x0, y0; - pcb_pline_t *pl; + rnd_pline_t *pl; int go; rnd_cardinal_t cnt; @@ -581,7 +581,7 @@ if (*dst != NULL) pa_append(it->pa); else - pcb_polyarea_copy0(dst, it->pa); + rnd_polyarea_copy0(dst, it->pa); clearance *= 2; @@ -593,7 +593,7 @@ if (cnt > 0) { lin = poly_sub_callback_line(px, py, x, y, clearance); pa_append(lin); - pcb_polyarea_free(&lin); + rnd_polyarea_free(&lin); } else { x0 = x; @@ -605,7 +605,7 @@ if (cnt > 0) { lin = poly_sub_callback_line(px, py, x0, y0, clearance); pa_append(lin); - pcb_polyarea_free(&lin); + rnd_polyarea_free(&lin); } } } @@ -722,7 +722,7 @@ if (!np) longjmp(info->env, 1); - pcb_polyarea_boolean_free(info->accumulate, np, &merged, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(info->accumulate, np, &merged, RND_PBO_UNITE); info->accumulate = merged; info->batch_size++; @@ -827,21 +827,21 @@ orig_poly = pcb_poly_to_polyarea(p, &need_full); - x = pcb_polyarea_boolean_free(np, orig_poly, &clipped_np, PCB_PBO_ISECT); - if (x != pcb_err_ok) { - fprintf(stderr, "Error while clipping PCB_PBO_ISECT: %d\n", x); - pcb_polyarea_free(&clipped_np); + x = rnd_polyarea_boolean_free(np, orig_poly, &clipped_np, RND_PBO_ISECT); + if (x != rnd_err_ok) { + fprintf(stderr, "Error while clipping RND_PBO_ISECT: %d\n", x); + rnd_polyarea_free(&clipped_np); goto fail; } - x = pcb_polyarea_boolean_free(p->Clipped, clipped_np, &merged, PCB_PBO_UNITE); - if (x != pcb_err_ok) { - fprintf(stderr, "Error while clipping PCB_PBO_UNITE: %d\n", x); - pcb_polyarea_free(&merged); + x = rnd_polyarea_boolean_free(p->Clipped, clipped_np, &merged, RND_PBO_UNITE); + if (x != rnd_err_ok) { + fprintf(stderr, "Error while clipping RND_PBO_UNITE: %d\n", x); + rnd_polyarea_free(&merged); goto fail; } p->Clipped = biggest(merged); - assert(!p->Clipped || pcb_poly_valid(p->Clipped)); + assert(!p->Clipped || rnd_poly_valid(p->Clipped)); return 1; fail: @@ -945,13 +945,13 @@ layer = layer->meta.bound.real; if (p->Clipped) - pcb_polyarea_free(&p->Clipped); + rnd_polyarea_free(&p->Clipped); p->Clipped = pcb_poly_to_polyarea(p, &need_full); if (need_full && !PCB_FLAG_TEST(PCB_FLAG_FULLPOLY, p)) { rnd_message(RND_MSG_WARNING, "Polygon #%ld was self intersecting; it had to be split up and\nthe full poly flag set.\n", (long)p->ID); PCB_FLAG_SET(PCB_FLAG_FULLPOLY, p); } - pcb_poly_contours_free(&p->NoHoles); + rnd_poly_contours_free(&p->NoHoles); p->clip_dirty = 0; @@ -960,7 +960,7 @@ if (!p->Clipped) return 0; - assert(pcb_poly_valid(p->Clipped)); + assert(rnd_poly_valid(p->Clipped)); /* calculate clipping for the real data (in case of subcircuits) */ pcb = pcb_data_get_top(Data); @@ -1253,7 +1253,7 @@ new_hole = pcb_poly_from_poly(&pcb_crosshair.AttachedPolygon); /* Subtract the hole from the original polygon shape */ - pcb_polyarea_boolean_free(original, new_hole, &result, PCB_PBO_SUB); + rnd_polyarea_boolean_free(original, new_hole, &result, RND_PBO_SUB); /* Convert the resulting polygon(s) into a new set of nodes * and place them on the page. Delete the original polygon. @@ -1277,10 +1277,10 @@ * the search. */ int -pcb_poly_holes(pcb_poly_t * polygon, const rnd_rnd_box_t * range, int (*callback) (pcb_pline_t * contour, void *user_data), void *user_data) +pcb_poly_holes(pcb_poly_t * polygon, const rnd_rnd_box_t * range, int (*callback) (rnd_pline_t * contour, void *user_data), void *user_data) { rnd_polyarea_t *pa = polygon->Clipped; - pcb_pline_t *pl; + rnd_pline_t *pl; /* If this hole is so big the polygon doesn't exist, then it's not * really a hole. */ @@ -1493,11 +1493,11 @@ { rnd_polyarea_t *x; rnd_bool ans; - ans = pcb_polyarea_touching(a, p->Clipped); + ans = rnd_polyarea_touching(a, p->Clipped); /* argument may be register, so we must copy it */ x = a; if (fr) - pcb_polyarea_free(&x); + rnd_polyarea_free(&x); return ans; } @@ -1505,10 +1505,10 @@ rnd_bool pcb_poly_is_point_in_p(rnd_coord_t X, rnd_coord_t Y, rnd_coord_t r, pcb_poly_t *p) { rnd_polyarea_t *c; - pcb_vector_t v; + rnd_vector_t v; v[0] = X; v[1] = Y; - if (pcb_polyarea_contour_inside(p->Clipped, v)) + if (rnd_polyarea_contour_inside(p->Clipped, v)) return rnd_true; if (PCB_FLAG_TEST(PCB_FLAG_FULLPOLY, p)) { @@ -1516,7 +1516,7 @@ /* Check all clipped-away regions that are now drawn because of full-poly */ for (tmp.Clipped = p->Clipped->f; tmp.Clipped != p->Clipped; tmp.Clipped = tmp.Clipped->f) - if (pcb_polyarea_contour_inside(tmp.Clipped, v)) + if (rnd_polyarea_contour_inside(tmp.Clipped, v)) return rnd_true; } @@ -1530,10 +1530,10 @@ rnd_bool pcb_poly_is_point_in_p_ignore_holes(rnd_coord_t X, rnd_coord_t Y, pcb_poly_t *p) { - pcb_vector_t v; + rnd_vector_t v; v[0] = X; v[1] = Y; - return pcb_poly_contour_inside(p->Clipped->contours, v); + return rnd_poly_contour_inside(p->Clipped->contours, v); } rnd_bool pcb_poly_is_rect_in_p(rnd_coord_t X1, rnd_coord_t Y1, rnd_coord_t X2, rnd_coord_t Y2, pcb_poly_t *p) @@ -1544,13 +1544,13 @@ return pcb_poly_isects_poly(s, p, rnd_true); } -void pcb_poly_no_holes_dicer(pcb_poly_t *p, const rnd_rnd_box_t *clip, void (*emit)(pcb_pline_t *, void *), void *user_data) +void pcb_poly_no_holes_dicer(pcb_poly_t *p, const rnd_rnd_box_t *clip, void (*emit)(rnd_pline_t *, void *), void *user_data) { rnd_polyarea_t *main_contour; - main_contour = pcb_polyarea_create(); + main_contour = rnd_polyarea_create(); /* copy the main poly only */ - pcb_polyarea_copy1(main_contour, p->Clipped); + rnd_polyarea_copy1(main_contour, p->Clipped); if (clip == NULL) pcb_polyarea_no_holes_dicer(main_contour, 0, 0, 0, 0, emit, user_data); @@ -1587,7 +1587,7 @@ pcb_poly_remove(layer, poly); inhibit = rnd_true; do { - pcb_vnode_t *v; + rnd_vnode_t *v; pcb_poly_t *newone; if (p->contours->area > conf_core.design.poly_isle_area) { @@ -1614,7 +1614,7 @@ rnd_polyarea_t *t = p; p = p->f; - pcb_poly_contour_del(&t->contours); + rnd_poly_contour_del(&t->contours); free(t); } } @@ -1624,9 +1624,9 @@ return many; } -void debug_pline(pcb_pline_t * pl) +void debug_pline(rnd_pline_t * pl) { - pcb_vnode_t *v; + rnd_vnode_t *v; rnd_fprintf(stderr, "\txmin %#mS xmax %#mS ymin %#mS ymax %#mS\n", pl->xmin, pl->xmax, pl->ymin, pl->ymax); v = pl->head; while (v) { @@ -1639,7 +1639,7 @@ void debug_polyarea(rnd_polyarea_t * p) { - pcb_pline_t *pl; + rnd_pline_t *pl; fprintf(stderr, "rnd_polyarea_t %p\n", (void *)p); for (pl = p->contours; pl; pl = pl->next) @@ -1676,8 +1676,8 @@ { pcb_poly_t *Polygon; rnd_polyarea_t *pa; - pcb_pline_t *pline; - pcb_vnode_t *node; + rnd_pline_t *pline; + rnd_vnode_t *node; rnd_bool outer; if (Input == NULL) @@ -1719,11 +1719,11 @@ pcb_board_set_changed_flag(rnd_true); } -rnd_bool pcb_pline_is_rectangle(pcb_pline_t *pl) +rnd_bool pcb_pline_is_rectangle(rnd_pline_t *pl) { int n; rnd_coord_t x[4], y[4]; - pcb_vnode_t *v; + rnd_vnode_t *v; v = pl->head->next; n = 0; Index: trunk/src/polygon.h =================================================================== --- trunk/src/polygon.h (revision 31036) +++ trunk/src/polygon.h (revision 31037) @@ -57,7 +57,7 @@ void pcb_polygon_copy_attached_to_layer(void); void pcb_polygon_close_hole(void); void pcb_polygon_hole_create_from_attached(void); -int pcb_poly_holes(pcb_poly_t * ptr, const rnd_rnd_box_t * range, int (*callback) (pcb_pline_t *, void *user_data), void *user_data); +int pcb_poly_holes(pcb_poly_t * ptr, const rnd_rnd_box_t * range, int (*callback) (rnd_pline_t *, void *user_data), void *user_data); int pcb_poly_plows(pcb_data_t *Data, int type, void *ptr1, void *ptr2, pcb_r_dir_t (*cb)(pcb_data_t *data, pcb_layer_t *lay, pcb_poly_t *poly, int type, void *ptr1, void *ptr2, void *user_data), void *user_data); @@ -89,18 +89,18 @@ rnd_bool pcb_poly_is_point_in_p(rnd_coord_t, rnd_coord_t, rnd_coord_t, pcb_poly_t *); rnd_bool pcb_poly_is_point_in_p_ignore_holes(rnd_coord_t, rnd_coord_t, pcb_poly_t *); -rnd_bool_t pcb_is_point_in_convex_quad(pcb_vector_t p, pcb_vector_t *q); +rnd_bool_t pcb_is_point_in_convex_quad(rnd_vector_t p, rnd_vector_t *q); rnd_bool pcb_poly_is_rect_in_p(rnd_coord_t, rnd_coord_t, rnd_coord_t, rnd_coord_t, pcb_poly_t *); rnd_bool pcb_poly_isects_poly(rnd_polyarea_t *, pcb_poly_t *, rnd_bool); -rnd_bool pcb_pline_isect_line(pcb_pline_t *pl, rnd_coord_t lx1, rnd_coord_t ly1, rnd_coord_t lx2, rnd_coord_t ly2, rnd_coord_t *cx, rnd_coord_t *cy); -rnd_bool pcb_pline_isect_circ(pcb_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r); /* cirlce contour crosses polyline contour */ -rnd_bool pcb_pline_embraces_circ(pcb_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r); /* circle is within the polyline; caller must make sure they do not cross! */ -rnd_bool pcb_pline_overlaps_circ(pcb_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r); /* circle is within or is crossing the polyline */ +rnd_bool pcb_pline_isect_line(rnd_pline_t *pl, rnd_coord_t lx1, rnd_coord_t ly1, rnd_coord_t lx2, rnd_coord_t ly2, rnd_coord_t *cx, rnd_coord_t *cy); +rnd_bool pcb_pline_isect_circ(rnd_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r); /* cirlce contour crosses polyline contour */ +rnd_bool pcb_pline_embraces_circ(rnd_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r); /* circle is within the polyline; caller must make sure they do not cross! */ +rnd_bool pcb_pline_overlaps_circ(rnd_pline_t *pl, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r); /* circle is within or is crossing the polyline */ rnd_bool pcb_poly_morph(pcb_layer_t *, pcb_poly_t *); -void pcb_poly_no_holes_dicer(pcb_poly_t * p, const rnd_rnd_box_t * clip, void (*emit) (pcb_pline_t *, void *), void *user_data); +void pcb_poly_no_holes_dicer(pcb_poly_t * p, const rnd_rnd_box_t * clip, void (*emit) (rnd_pline_t *, void *), void *user_data); void pcb_poly_to_polygons_on_layer(pcb_data_t *, pcb_layer_t *, rnd_polyarea_t *, pcb_flag_t); -rnd_bool pcb_pline_is_rectangle(pcb_pline_t *pl); +rnd_bool pcb_pline_is_rectangle(rnd_pline_t *pl); /* clear np1 from the polygon; also free np1 if fnp is true. Returns 1 on success. */ Index: trunk/src/search.c =================================================================== --- trunk/src/search.c (revision 31036) +++ trunk/src/search.c (revision 31037) @@ -1137,7 +1137,7 @@ rnd_bool pcb_is_point_in_gfx(rnd_coord_t X, rnd_coord_t Y, rnd_coord_t Radius, pcb_gfx_t *gfx) { - pcb_vector_t pt, a, b, c; + rnd_vector_t pt, a, b, c; int n, m; pt[0] = X; pt[1] = Y; Index: trunk/src/thermal.c =================================================================== --- trunk/src/thermal.c (revision 31036) +++ trunk/src/thermal.c (revision 31037) @@ -198,7 +198,7 @@ x1 + clrth * nx + clrth * vx - clr*vx, y1 + clrth * ny + clrth * vy - clr*vy, x2 + clrth * nx - clrth * vx + clr*vx, y2 + clrth * ny - clrth * vy + clr*vy, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); /* cross clear lines */ pa = pc; pc = NULL; @@ -206,7 +206,7 @@ x1 - clrth * nx + clrth * vx + clr*nx, y1 - clrth * ny + clrth * vy + clr*ny, x1 + clrth * nx + clrth * vx - clr*nx, y1 + clrth * ny + clrth * vy - clr*ny, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); pa = pc; pc = NULL; pb = pa_line_at( @@ -213,7 +213,7 @@ x2 - clrth * nx - clrth * vx + clr*nx, y2 - clrth * ny - clrth * vy + clr*ny, x2 + clrth * nx - clrth * vx - clr*nx, y2 + clrth * ny - clrth * vy - clr*ny, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); } else { /* side clear lines */ @@ -225,7 +225,7 @@ x1 + clrth * nx + clrth * vx, y1 + clrth * ny + clrth * vy, mx + clrth * nx + clr * vx, my + clrth * ny + clr * vy, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); pa = pc; pc = NULL; pb = pa_line_at( @@ -232,7 +232,7 @@ x2 - clrth * nx - clrth * vx, y2 - clrth * ny - clrth * vy, mx - clrth * nx - clr * vx, my - clrth * ny - clr * vy, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); pa = pc; pc = NULL; pb = pa_line_at( @@ -239,7 +239,7 @@ x2 + clrth * nx - clrth * vx, y2 + clrth * ny - clrth * vy, mx + clrth * nx - clr * vx, my + clrth * ny - clr * vy, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); /* cross clear lines */ pa = pc; pc = NULL; @@ -247,7 +247,7 @@ x1 - clrth * nx + clrth * vx, y1 - clrth * ny + clrth * vy, x1 - clr * nx + clrth * vx, y1 - clr * ny + clrth * vy, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); pa = pc; pc = NULL; pb = pa_line_at( @@ -254,7 +254,7 @@ x1 + clrth * nx + clrth * vx, y1 + clrth * ny + clrth * vy, x1 + clr * nx + clrth * vx, y1 + clr * ny + clrth * vy, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); pa = pc; pc = NULL; pb = pa_line_at( @@ -261,7 +261,7 @@ x2 - clrth * nx - clrth * vx, y2 - clrth * ny - clrth * vy, x2 - clr * nx - clrth * vx, y2 - clr * ny - clrth * vy, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); pa = pc; pc = NULL; pb = pa_line_at( @@ -268,7 +268,7 @@ x2 + clrth * nx - clrth * vx, y2 + clrth * ny - clrth * vy, x2 + clr * nx - clrth * vx, y2 + clr * ny - clrth * vy, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); } } else { @@ -283,7 +283,7 @@ x1 + clrth * nx - clr * vx * 0.75, y1 + clrth * ny - clr * vy * 0.75, x2 + clrth * nx + clr * vx * 0.75, y2 + clrth * ny + clr * vy * 0.75, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); /* x1;y1 cap arc */ pa = pc; pc = NULL; @@ -291,7 +291,7 @@ x1 - clrth * nx + clr * vx * 2.0, y1 - clrth * ny + clr * vy * 2.0, x1 + clrth * nx + clr * vx * 2.0, y1 + clrth * ny + clr * vy * 2.0, clr, 180.0); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); /* x2;y2 cap arc */ pa = pc; pc = NULL; @@ -299,7 +299,7 @@ x2 - clrth * nx - clr * vx * 2.0, y2 - clrth * ny - clr * vy * 2.0, x2 + clrth * nx - clr * vx * 2.0, y2 + clrth * ny - clr * vy * 2.0, clr, 180.0); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); } else { /* non-diagonal */ /* split side lines */ @@ -311,7 +311,7 @@ x1 + clrth * nx - clr * vx * 0.00, y1 + clrth * ny - clr * vy * 0.00, mx + clrth * nx + clr * vx * 1.00, my + clrth * ny + clr * vy * 1.00, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); pa = pc; pc = NULL; pb = pa_line_at( @@ -318,7 +318,7 @@ mx - clrth * nx - clr * vx * 1.00, my - clrth * ny - clr * vy * 1.00, x2 - clrth * nx + clr * vx * 0.00, y2 - clrth * ny + clr * vy * 0.00, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); pa = pc; pc = NULL; pb = pa_line_at( @@ -325,7 +325,7 @@ mx + clrth * nx - clr * vx * 1.00, my + clrth * ny - clr * vy * 1.00, x2 + clrth * nx + clr * vx * 0.00, y2 + clrth * ny + clr * vy * 0.00, clr, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); /* split round cap, x1;y1 */ pa = pc; pc = NULL; @@ -333,7 +333,7 @@ x1 - clrth * nx, y1 - clrth * ny, x1 + clrth * vx - clr * nx, y1 + clrth * vy - clr * ny, clr, 180.0); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); pa = pc; pc = NULL; pb = pa_arc_at(x1, y1, clrth, @@ -340,7 +340,7 @@ x1 + clrth * nx, y1 + clrth * ny, x1 + clrth * vx + clr * nx, y1 + clrth * vy + clr * ny, clr, 180.0); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); /* split round cap, x2;y2 */ pa = pc; pc = NULL; @@ -348,7 +348,7 @@ x2 - clrth * nx, y2 - clrth * ny, x2 - clrth * vx - clr * nx, y2 - clrth * vy - clr * ny, clr, 180.0); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); pa = pc; pc = NULL; pb = pa_arc_at(x2, y2, clrth, @@ -355,7 +355,7 @@ x2 + clrth * nx, y2 + clrth * ny, x2 - clrth * vx + clr * nx, y2 - clrth * vy + clr * ny, clr, 180.0); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_UNITE); } } return pc; @@ -366,30 +366,30 @@ if (line->thermal & PCB_THERMAL_DIAGONAL) { /* x1;y1 V-shape */ pb = pa_line_at(x1, y1, x1-nx*clrth+vx*clrth, y1-ny*clrth+vy*clrth, th, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_SUB); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_SUB); pa = pc; pc = NULL; pb = pa_line_at(x1, y1, x1+nx*clrth+vx*clrth, y1+ny*clrth+vy*clrth, th, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_SUB); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_SUB); /* x2;y2 V-shape */ pa = pc; pc = NULL; pb = pa_line_at(x2, y2, x2-nx*clrth-vx*clrth, y2-ny*clrth-vy*clrth, th, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_SUB); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_SUB); pa = pc; pc = NULL; pb = pa_line_at(x2, y2, x2+nx*clrth-vx*clrth, y2+ny*clrth-vy*clrth, th, rnd_false); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_SUB); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_SUB); } else { /* perpendicular */ pb = pa_line_at(mx-nx*clrth, my-ny*clrth, mx+nx*clrth, my+ny*clrth, th, rnd_true); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_SUB); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_SUB); /* straight */ pa = pc; pc = NULL; pb = pa_line_at(x1+vx*clrth, y1+vy*clrth, x2-vx*clrth, y2-vy*clrth, th, rnd_true); - pcb_polyarea_boolean_free(pa, pb, &pc, PCB_PBO_SUB); + rnd_polyarea_boolean_free(pa, pb, &pc, RND_PBO_SUB); } return pc; } @@ -402,12 +402,12 @@ rnd_polyarea_t *p; if (*pres != NULL) { - pcb_polyarea_boolean(src, *pres, &p, PCB_PBO_UNITE); - pcb_polyarea_free(pres); + rnd_polyarea_boolean(src, *pres, &p, RND_PBO_UNITE); + rnd_polyarea_free(pres); *pres = p; } else - pcb_polyarea_copy0(pres, src); + rnd_polyarea_copy0(pres, src); } #define CONG_MAX 256 @@ -484,9 +484,9 @@ /* have to draw a short clearance for the small segments */ ptmp = pa_line_at(x - nx * clr/2, y - ny * clr/2, px - nx * clr/2, py - ny * clr/2, clr+4, rnd_false); - pcb_polyarea_boolean(ptmp, *pres, &p, PCB_PBO_UNITE); - pcb_polyarea_free(pres); - pcb_polyarea_free(&ptmp); + rnd_polyarea_boolean(ptmp, *pres, &p, RND_PBO_UNITE); + rnd_polyarea_free(pres); + rnd_polyarea_free(&ptmp); *pres = p; } px = x; py = y; @@ -498,31 +498,31 @@ /* one line per edge, slightly shorter than the edge */ ptmp = pa_line_at(x - vx * clr * fact - nx * clr/2, y - vy * clr * fact - ny * clr/2, px + vx * clr *fact - nx * clr/2, py + vy * clr * fact - ny * clr/2, clr+4, rnd_false); - pcb_polyarea_boolean(ptmp, *pres, &p, PCB_PBO_UNITE); - pcb_polyarea_free(pres); - pcb_polyarea_free(&ptmp); + rnd_polyarea_boolean(ptmp, *pres, &p, RND_PBO_UNITE); + rnd_polyarea_free(pres); + rnd_polyarea_free(&ptmp); *pres = p; } else { /* two half lines per edge */ ptmp = pa_line_at(x - nx * clr/2 , y - ny * clr/2, mx + vx * clr * fact_ortho - nx * clr/2, my + vy * clr * fact_ortho - ny * clr/2, clr+4, rnd_false); - pcb_polyarea_boolean(ptmp, *pres, &p, PCB_PBO_UNITE); - pcb_polyarea_free(pres); - pcb_polyarea_free(&ptmp); + rnd_polyarea_boolean(ptmp, *pres, &p, RND_PBO_UNITE); + rnd_polyarea_free(pres); + rnd_polyarea_free(&ptmp); *pres = p; ptmp = pa_line_at(px - nx * clr/2, py - ny * clr/2, mx - vx * clr * fact_ortho - nx * clr/2, my - vy * clr * fact_ortho - ny * clr/2, clr+4, rnd_false); - pcb_polyarea_boolean(ptmp, *pres, &p, PCB_PBO_UNITE); - pcb_polyarea_free(pres); - pcb_polyarea_free(&ptmp); + rnd_polyarea_boolean(ptmp, *pres, &p, RND_PBO_UNITE); + rnd_polyarea_free(pres); + rnd_polyarea_free(&ptmp); *pres = p; /* optical tuning: make sure the clearance is large enough around corners even if lines didn't meet - just throw in a big circle */ ptmp = pcb_poly_from_circle(x, y, clr); - pcb_polyarea_boolean(ptmp, *pres, &p, PCB_PBO_UNITE); - pcb_polyarea_free(pres); - pcb_polyarea_free(&ptmp); + rnd_polyarea_boolean(ptmp, *pres, &p, RND_PBO_UNITE); + rnd_polyarea_free(pres); + rnd_polyarea_free(&ptmp); *pres = p; } px = x; @@ -596,9 +596,9 @@ /* line from each corner at the average angle of the two edges from the corner */ ptmp = pa_line_at(x-nx*clr*0.2, y-ny*clr*0.2, x + nx*clr*4, y + ny*clr*4, clr/2, rnd_false); - pcb_polyarea_boolean(*pres, ptmp, &p, PCB_PBO_SUB); - pcb_polyarea_free(pres); - pcb_polyarea_free(&ptmp); + rnd_polyarea_boolean(*pres, ptmp, &p, RND_PBO_SUB); + rnd_polyarea_free(pres); + rnd_polyarea_free(&ptmp); *pres = p; } else { @@ -609,9 +609,9 @@ /* perpendicular line from the middle of each edge */ ptmp = pa_line_at(mx, my, mx - nx*clr, my - ny*clr, clr/2, rnd_true); - pcb_polyarea_boolean(*pres, ptmp, &p, PCB_PBO_SUB); - pcb_polyarea_free(pres); - pcb_polyarea_free(&ptmp); + rnd_polyarea_boolean(*pres, ptmp, &p, RND_PBO_SUB); + rnd_polyarea_free(pres); + rnd_polyarea_free(&ptmp); *pres = p; } px = x; @@ -622,7 +622,7 @@ /* generate round thermal around a polyarea specified by the iterator */ static void pcb_thermal_area_pa_round(rnd_polyarea_t **pres, pcb_poly_it_t *it, rnd_coord_t clr, rnd_bool_t is_diag) { - pcb_pline_t *pl; + rnd_pline_t *pl; /* cut out the poly so terminals will be displayed proerply */ polytherm_base(pres, it->pa); @@ -636,7 +636,7 @@ /* generate sharp thermal around a polyarea specified by the iterator */ static void pcb_thermal_area_pa_sharp(rnd_polyarea_t **pres, pcb_poly_it_t *it, rnd_coord_t clr, rnd_bool_t is_diag) { - pcb_pline_t *pl; + rnd_pline_t *pl; /* add the usual clearance glory around the polygon */ pcb_poly_pa_clearance_construct(pres, it, clr); @@ -699,7 +699,7 @@ return NULL; pcb_poly_iterate_polyarea(shp->data.poly.pa, &it); pcb_poly_pa_clearance_construct(&pres, &it, clearance); - pcb_polyarea_move(pres, ps->x, ps->y); + rnd_polyarea_move(pres, ps->x, ps->y); return pres; } return NULL; @@ -821,7 +821,7 @@ pcb_thermal_area_pa_sharp(&pres, &it, clearance, (thr & PCB_THERMAL_DIAGONAL)); if (pres != NULL) - pcb_polyarea_move(pres, ps->x, ps->y); + rnd_polyarea_move(pres, ps->x, ps->y); } return pres; } Index: trunk/src_plugins/export_dsn/dsn.c =================================================================== --- trunk/src_plugins/export_dsn/dsn.c (revision 31036) +++ trunk/src_plugins/export_dsn/dsn.c (revision 31037) @@ -273,7 +273,7 @@ gds_append_str(term_shapes, tmp); } -static void print_polyline(gds_t *term_shapes, pcb_poly_it_t *it, pcb_pline_t *pl, rnd_coord_t ox, rnd_coord_t oy, pcb_layergrp_t *grp, int partsidesign) +static void print_polyline(gds_t *term_shapes, pcb_poly_it_t *it, rnd_pline_t *pl, rnd_coord_t ox, rnd_coord_t oy, pcb_layergrp_t *grp, int partsidesign) { char tmp[512]; int fld; @@ -316,7 +316,7 @@ gds_append_str(term_shapes, " (shape "); for(pa = pcb_poly_island_first(poly, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { - pcb_pline_t *pl; + rnd_pline_t *pl; pl = pcb_poly_contour(&it); Index: trunk/src_plugins/export_fidocadj/fidocadj.c =================================================================== --- trunk/src_plugins/export_fidocadj/fidocadj.c (revision 31036) +++ trunk/src_plugins/export_fidocadj/fidocadj.c (revision 31037) @@ -221,8 +221,8 @@ PCB_END_LOOP; PCB_POLY_LOOP(ly) { - pcb_vnode_t *v; - pcb_pline_t *pl = polygon->Clipped->contours; + rnd_vnode_t *v; + rnd_pline_t *pl = polygon->Clipped->contours; if (polygon->HoleIndexN > 0) { pcb_io_incompat_save(PCB->Data, (pcb_any_obj_t *)polygon, "polygon", "FidoCadJ can't handle holes in polygons, ignoring holes for this export", "(some of the polygons will look different unless you remove the holes or split up the polygons)"); Index: trunk/src_plugins/export_openems/mesh.c =================================================================== --- trunk/src_plugins/export_openems/mesh.c (revision 31036) +++ trunk/src_plugins/export_openems/mesh.c (revision 31037) @@ -390,7 +390,7 @@ for(pa = pcb_poly_island_first(poly, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { rnd_coord_t x, y; - pcb_pline_t *pl; + rnd_pline_t *pl; int go; pl = pcb_poly_contour(&it); Index: trunk/src_plugins/export_openscad/export_openscad.c =================================================================== --- trunk/src_plugins/export_openscad/export_openscad.c (revision 31036) +++ trunk/src_plugins/export_openscad/export_openscad.c (revision 31037) @@ -629,7 +629,7 @@ /* iterate over all islands of a polygon */ for(pa = pcb_poly_island_first(polygon, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { rnd_coord_t x, y; - pcb_pline_t *pl; + rnd_pline_t *pl; int go; /* check if we have a contour for the given island */ Index: trunk/src_plugins/io_autotrax/write.c =================================================================== --- trunk/src_plugins/io_autotrax/write.c (revision 31036) +++ trunk/src_plugins/io_autotrax/write.c (revision 31037) @@ -596,11 +596,11 @@ TODO("do we really need to reimplement this, can not cpoly_hatch_lines handle it?") for(pa = pcb_poly_island_first(polygon, &poly_it); pa != NULL; pa = pcb_poly_island_next(&poly_it)) { /* now generate cross hatch lines for polygon island export */ - pcb_pline_t *pl, *track; + rnd_pline_t *pl, *track; /* check if we have a contour for the given island */ pl = pcb_poly_contour(&poly_it); if (pl != NULL) { - const pcb_vnode_t *v, *n; + const rnd_vnode_t *v, *n; track = rnd_pline_dup_offset(pl, -((Thickness / 2) + 1)); v = track->head; do { @@ -607,11 +607,11 @@ n = v->next; wrax_pline_segment(ctx, v->point[0]+dx, v->point[1]+dy, n->point[0]+dx, n->point[1]+dy, Thickness, current_layer); } while((v = v->next) != track->head); - pcb_poly_contour_del(&track); + rnd_poly_contour_del(&track); /* 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; + const rnd_vnode_t *v, *n; track = rnd_pline_dup_offset(pl, -((Thickness / 2) + 1)); v = track->head; do { @@ -618,7 +618,7 @@ n = v->next; wrax_pline_segment(ctx, v->point[0]+dx, v->point[1]+dy, n->point[0]+dx, n->point[1]+dy, Thickness, current_layer); } while((v = v->next) != track->head); - pcb_poly_contour_del(&track); + rnd_poly_contour_del(&track); } } } Index: trunk/src_plugins/io_eagle/read.c =================================================================== --- trunk/src_plugins/io_eagle/read.c (revision 31036) +++ trunk/src_plugins/io_eagle/read.c (revision 31037) @@ -1680,7 +1680,7 @@ if (!PCB_FLAG_TEST(PCB_FLAG_FOUND, hole)) continue; linelist_foreach(&(ly)->Polygon, &itp, poly) { if (PCB_FLAG_TEST(PCB_FLAG_FOUND, poly)) continue; - if (pcb_polyarea_touching(hole->Clipped, poly->Clipped)) { + if (rnd_polyarea_touching(hole->Clipped, poly->Clipped)) { rnd_cardinal_t n; poly->clip_dirty = 1; /* add hole points to the permanent list */ Index: trunk/src_plugins/io_hyp/parser.c =================================================================== --- trunk/src_plugins/io_hyp/parser.c (revision 31036) +++ trunk/src_plugins/io_hyp/parser.c (revision 31037) @@ -983,7 +983,7 @@ * Draw an arc from (x1, y1) to (x2, y2) with center (xc, yc) and radius r using a polygonal approximation. * Arc may be clockwise or counterclockwise. Note pcb-rnd y-axis points downward. */ -void hyp_arc2contour(pcb_pline_t * contour, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2, rnd_coord_t xc, +void hyp_arc2contour(rnd_pline_t * contour, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2, rnd_coord_t xc, rnd_coord_t yc, rnd_coord_t r, rnd_bool_t clockwise) { rnd_coord_t arc_precision = RND_MM_TO_COORD(0.254); /* mm */ @@ -991,7 +991,7 @@ int segments; int poly_points = 0; int i; - pcb_vector_t v; + rnd_vector_t v; double alpha = atan2(y1 - yc, x1 - xc); double beta = atan2(y2 - yc, x2 - xc); @@ -1038,7 +1038,7 @@ /* add first point to contour */ v[0] = x1; v[1] = y1; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); /* intermediate points */ for (i = 1; i < poly_points; i++) { @@ -1045,13 +1045,13 @@ double angle = alpha + (beta - alpha) * i / poly_points; v[0] = xc + r * cos(angle); v[1] = yc + r * sin(angle); - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); } /* last point */ v[0] = x2; v[1] = y2; - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); return; } @@ -1140,9 +1140,9 @@ hyp_vertex_t *vrtx; rnd_polyarea_t *polyarea = NULL; - pcb_pline_t *contour = NULL; + rnd_pline_t *contour = NULL; - polyarea = pcb_polyarea_create(); + polyarea = rnd_polyarea_create(); if (polyarea == NULL) return; @@ -1157,30 +1157,30 @@ outer_contour = rnd_true; for (vrtx = polygon->vertex; vrtx != NULL; vrtx = vrtx->next) { - pcb_vector_t v; + rnd_vector_t v; v[0] = vrtx->x1; v[1] = vrtx->y1; if ((vrtx->is_first) || (vrtx->next == NULL)) { if (contour != NULL) { /* add contour to polyarea */ - pcb_poly_contour_pre(contour, rnd_false); + rnd_poly_contour_pre(contour, rnd_false); /* check contour valid */ - if (pcb_polyarea_contour_check(contour) && hyp_debug) + if (rnd_polyarea_contour_check(contour) && hyp_debug) rnd_message(RND_MSG_WARNING, "draw polygon: bad contour? continuing.\n"); /* set orientation for outer contour, negative for holes */ - if (contour->Flags.orient != (outer_contour ? PCB_PLF_DIR : PCB_PLF_INV)) - pcb_poly_contour_inv(contour); + if (contour->Flags.orient != (outer_contour ? RND_PLF_DIR : RND_PLF_INV)) + rnd_poly_contour_inv(contour); /* add contour to polyarea */ - pcb_polyarea_contour_include(polyarea, contour); + rnd_polyarea_contour_include(polyarea, contour); /* first contour is outer contour, remainder are holes */ outer_contour = rnd_false; } /* create new contour */ - contour = pcb_poly_contour_new(v); + contour = rnd_poly_contour_new(v); if (contour == NULL) return; } @@ -1187,7 +1187,7 @@ else { if (!vrtx->is_arc) /* line. add vertex to contour */ - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); else /* arc. pcb polyarea contains line segments, not arc segments. convert arc segment to line segments. */ hyp_arc2contour(contour, vrtx->x1, vrtx->y1, vrtx->x2, vrtx->y2, vrtx->xc, vrtx->yc, vrtx->r, rnd_false); @@ -1195,7 +1195,7 @@ } /* add polyarea to pcb */ - if (pcb_poly_valid(polyarea)) + if (rnd_poly_valid(polyarea)) pcb_poly_to_polygons_on_layer(hyp_dest, layer, polyarea, pcb_no_flags()); else if (hyp_debug) rnd_message(RND_MSG_DEBUG, "draw polygon: self-intersecting polygon id=%i dropped.\n", polygon->hyp_poly_id); Index: trunk/src_plugins/io_hyp/write.c =================================================================== --- trunk/src_plugins/io_hyp/write.c (revision 31036) +++ trunk/src_plugins/io_hyp/write.c (revision 31037) @@ -279,8 +279,8 @@ static void write_poly(hyp_wr_t * wr, pcb_poly_t * poly) { - pcb_pline_t *pl; - pcb_vnode_t *v; + rnd_pline_t *pl; + rnd_vnode_t *v; if (poly->Clipped == NULL) { pcb_layer_t *l = poly->parent.layer; Index: trunk/src_plugins/io_tedax/tlayer.c =================================================================== --- trunk/src_plugins/io_tedax/tlayer.c (revision 31036) +++ trunk/src_plugins/io_tedax/tlayer.c (revision 31037) @@ -46,7 +46,7 @@ { char lntmp[64]; int lno; - pcb_pline_t *pl; + rnd_pline_t *pl; long plid; pcb_layergrp_t *g = pcb_get_layergrp(pcb, gid); @@ -66,12 +66,12 @@ continue; PCB_POLY_LOOP(ly) { - pcb_pline_t *pl; + rnd_pline_t *pl; if (!polygon->NoHolesValid) pcb_poly_compute_no_holes(polygon); for(pl = polygon->NoHoles, plid = 0; pl != NULL; pl = pl->next, plid++) { - pcb_vnode_t *v; + rnd_vnode_t *v; long i, n; fprintf(f, "begin polyline v1 pllay_%ld_%ld_%ld\n", gid, polygon->ID, plid); n = pl->Count; Index: trunk/src_plugins/jostle/jostle.c =================================================================== --- trunk/src_plugins/jostle/jostle.c (revision 31036) +++ trunk/src_plugins/jostle/jostle.c (revision 31037) @@ -38,7 +38,7 @@ /*#define DEBUG_pcb_polyarea_t*/ -double pcb_vect_dist2(pcb_vector_t v1, pcb_vector_t v2); +double rnd_vect_dist2(rnd_vector_t v1, rnd_vector_t v2); #define Vcpy2(r,a) {(r)[0] = (a)[0]; (r)[1] = (a)[1];} #define Vswp2(a,b) { long t; \ t = (a)[0], (a)[0] = (b)[0], (b)[0] = t; \ @@ -73,8 +73,8 @@ static void Debugpcb_polyarea_t(rnd_polyarea_t * s, char *color) { int *x, *y, n, i = 0; - pcb_pline_t *pl; - pcb_vnode_t *v; + rnd_pline_t *pl; + rnd_vnode_t *v; rnd_polyarea_t *p; #ifndef DEBUG_pcb_polyarea_t @@ -124,7 +124,7 @@ static rnd_rnd_box_t pcb_polyarea_t_boundingBox(rnd_polyarea_t * a) { rnd_polyarea_t *n; - pcb_pline_t *pa; + rnd_pline_t *pa; rnd_rnd_box_t box; int first = 1; @@ -151,7 +151,7 @@ /* Given a polygon and a side of it (a direction north/northeast/etc), find a line tangent to that side, offset by clearance, and return it as a pair of vectors PQ. Make it long so it will intersect everything in the area. */ -static void pcb_polyarea_t_findXmostLine(rnd_polyarea_t * a, int side, pcb_vector_t p, pcb_vector_t q, int clearance) +static void pcb_polyarea_t_findXmostLine(rnd_polyarea_t * a, int side, rnd_vector_t p, rnd_vector_t q, int clearance) { int extra; p[0] = p[1] = 0; @@ -182,8 +182,8 @@ { int kx, ky, minmax, dq, ckx, cky; rnd_coord_t mm[2] = { RND_MAX_COORD, -RND_MAX_COORD }; - pcb_vector_t mmp[2]; - pcb_vnode_t *v; + rnd_vector_t mmp[2]; + rnd_vnode_t *v; switch (side) { case JNORTHWEST: @@ -255,7 +255,7 @@ } /* Wrapper for CreateNewLineOnLayer that takes vectors and deals with Undo */ -static pcb_line_t *Createpcb_vector_tLineOnLayer(pcb_layer_t * layer, pcb_vector_t a, pcb_vector_t b, int thickness, int clearance, pcb_flag_t flags) +static pcb_line_t *Createpcb_vector_tLineOnLayer(pcb_layer_t * layer, rnd_vector_t a, rnd_vector_t b, int thickness, int clearance, pcb_flag_t flags) { pcb_line_t *line; @@ -266,7 +266,7 @@ return line; } -static pcb_line_t *MakeBypassLine(pcb_layer_t * layer, pcb_vector_t a, pcb_vector_t b, pcb_line_t * orig, rnd_polyarea_t ** expandp) +static pcb_line_t *MakeBypassLine(pcb_layer_t * layer, rnd_vector_t a, rnd_vector_t b, pcb_line_t * orig, rnd_polyarea_t ** expandp) { pcb_line_t *line; @@ -273,7 +273,7 @@ line = Createpcb_vector_tLineOnLayer(layer, a, b, orig->Thickness, orig->Clearance, orig->Flags); if (line && expandp) { rnd_polyarea_t *p = pcb_poly_from_pcb_line(line, line->Thickness + line->Clearance); - pcb_polyarea_boolean_free(*expandp, p, expandp, PCB_PBO_UNITE); + rnd_polyarea_boolean_free(*expandp, p, expandp, RND_PBO_UNITE); } return line; } @@ -295,9 +295,9 @@ * old straight line. */ static int MakeBypassingLines(rnd_polyarea_t * brush, pcb_layer_t * layer, pcb_line_t * line, int side, rnd_polyarea_t ** expandp) { - pcb_vector_t pA, pB, flatA, flatB, qA, qB; - pcb_vector_t lA, lB; - pcb_vector_t a, b, c, d, junk; + rnd_vector_t pA, pB, flatA, flatB, qA, qB; + rnd_vector_t lA, lB; + rnd_vector_t a, b, c, d, junk; int hits; PCB_FLAG_SET(PCB_FLAG_DRC, line); /* will cause sublines to inherit */ @@ -309,14 +309,14 @@ pcb_polyarea_t_findXmostLine(brush, side, flatA, flatB, line->Thickness / 2); pcb_polyarea_t_findXmostLine(brush, rotateSide(side, 1), pA, pB, line->Thickness / 2); pcb_polyarea_t_findXmostLine(brush, rotateSide(side, -1), qA, qB, line->Thickness / 2); - hits = pcb_vect_inters2(lA, lB, qA, qB, a, junk) + - pcb_vect_inters2(qA, qB, flatA, flatB, b, junk) + - pcb_vect_inters2(pA, pB, flatA, flatB, c, junk) + pcb_vect_inters2(lA, lB, pA, pB, d, junk); + hits = rnd_vect_inters2(lA, lB, qA, qB, a, junk) + + rnd_vect_inters2(qA, qB, flatA, flatB, b, junk) + + rnd_vect_inters2(pA, pB, flatA, flatB, c, junk) + rnd_vect_inters2(lA, lB, pA, pB, d, junk); if (hits != 4) { return 0; } /* flip the line endpoints to match up with a/b */ - if (pcb_vect_dist2(lA, d) < pcb_vect_dist2(lA, a)) { + if (rnd_vect_dist2(lA, d) < rnd_vect_dist2(lA, a)) { Vswp2(lA, lB); } MakeBypassLine(layer, lA, a, line, NULL); @@ -344,7 +344,7 @@ pcb_line_t *line = (pcb_line_t *) targ; struct info *info = private; rnd_polyarea_t *lp, *copy, *tmp, *n, *smallest = NULL; - pcb_vector_t p; + rnd_vector_t p; int inside = 0, side, r; double small, big; int nocentroid = 0; @@ -355,22 +355,22 @@ fprintf(stderr, "hit! %p\n", (void *)line); p[0] = line->Point1.X; p[1] = line->Point1.Y; - if (pcb_poly_contour_inside(info->brush->contours, p)) { + if (rnd_poly_contour_inside(info->brush->contours, p)) { rnd_fprintf(stderr, "\tinside1 %ms,%ms\n", p[0], p[1]); inside++; } p[0] = line->Point2.X; p[1] = line->Point2.Y; - if (pcb_poly_contour_inside(info->brush->contours, p)) { + if (rnd_poly_contour_inside(info->brush->contours, p)) { rnd_fprintf(stderr, "\tinside2 %ms,%ms\n", p[0], p[1]); inside++; } lp = pcb_poly_from_pcb_line(line, line->Thickness); - if (!pcb_polyarea_touching(lp, info->brush)) { + if (!rnd_polyarea_touching(lp, info->brush)) { /* not a factor */ return 0; } - pcb_polyarea_free(&lp); + rnd_polyarea_free(&lp); if (inside) { /* XXX not done! XXX if this is part of a series of lines passing @@ -383,11 +383,11 @@ * around. Use a very fine line. XXX can still graze. */ lp = pcb_poly_from_pcb_line(line, 1); - if (!pcb_polyarea_m_copy0(©, info->brush)) + if (!rnd_polyarea_m_copy0(©, info->brush)) return 0; - r = pcb_polyarea_boolean_free(copy, lp, &tmp, PCB_PBO_SUB); - if (r != pcb_err_ok) { - rnd_fprintf(stderr, "Error while jostling PCB_PBO_SUB: %d\n", r); + r = rnd_polyarea_boolean_free(copy, lp, &tmp, RND_PBO_SUB); + if (r != rnd_err_ok) { + rnd_fprintf(stderr, "Error while jostling RND_PBO_SUB: %d\n", r); return 0; } if (tmp == tmp->f) { @@ -396,9 +396,9 @@ */ rnd_fprintf(stderr, "try isect??\n"); lp = pcb_poly_from_pcb_line(line, line->Thickness); - r = pcb_polyarea_boolean_free(tmp, lp, &tmp, PCB_PBO_ISECT); - if (r != pcb_err_ok) { - fprintf(stderr, "Error while jostling PCB_PBO_ISECT: %d\n", r); + r = rnd_polyarea_boolean_free(tmp, lp, &tmp, RND_PBO_ISECT); + if (r != rnd_err_ok) { + fprintf(stderr, "Error while jostling RND_PBO_ISECT: %d\n", r); return 0; } nocentroid = 1; @@ -455,7 +455,7 @@ if (info->line == NULL || (!nocentroid && (big - small) < info->centroid)) { rnd_fprintf(stderr, "\tkeep it!\n"); if (info->smallest) { - pcb_polyarea_free(&info->smallest); + rnd_polyarea_free(&info->smallest); } info->centroid = nocentroid ? DBL_MAX : (big - small); info->side = side; @@ -498,8 +498,8 @@ if (found) { expand = NULL; MakeBypassingLines(info.smallest, info.layer, info.line, info.side, &expand); - pcb_polyarea_free(&info.smallest); - pcb_polyarea_boolean_free(info.brush, expand, &info.brush, PCB_PBO_UNITE); + rnd_polyarea_free(&info.smallest); + rnd_polyarea_boolean_free(info.brush, expand, &info.brush, RND_PBO_UNITE); } } while (found); pcb_board_set_changed_flag(rnd_true); Index: trunk/src_plugins/lib_polyhelp/polyhelp.c =================================================================== --- trunk/src_plugins/lib_polyhelp/polyhelp.c (revision 31036) +++ trunk/src_plugins/lib_polyhelp/polyhelp.c (revision 31037) @@ -50,9 +50,9 @@ #include #include -void pcb_pline_fprint_anim(FILE *f, const pcb_pline_t *pl) +void pcb_pline_fprint_anim(FILE *f, const rnd_pline_t *pl) { - const pcb_vnode_t *v, *n; + const rnd_vnode_t *v, *n; fprintf(f, "!pline start\n"); v = pl->head; do { @@ -73,7 +73,7 @@ } #endif -rnd_cardinal_t pcb_pline_to_lines(pcb_layer_t *dst, const pcb_pline_t *src, rnd_coord_t thickness, rnd_coord_t clearance, pcb_flag_t flags) +rnd_cardinal_t pcb_pline_to_lines(pcb_layer_t *dst, const rnd_pline_t *src, rnd_coord_t thickness, rnd_coord_t clearance, pcb_flag_t flags) { rnd_cardinal_t cnt = 0; vtp0_t tracks; @@ -83,8 +83,8 @@ rnd_pline_dup_offsets(&tracks, src, -((thickness/2)+1)); for(i = 0; i < tracks.used; i++) { - const pcb_vnode_t *v, *n; - pcb_pline_t *track = tracks.array[i]; + const rnd_vnode_t *v, *n; + rnd_pline_t *track = tracks.array[i]; v = track->head; do { @@ -93,7 +93,7 @@ cnt++; } while((v = v->next) != track->head); - pcb_poly_contour_del(&track); + rnd_poly_contour_del(&track); } vtp0_uninit(&tracks); @@ -100,9 +100,9 @@ return cnt; } -rnd_bool pcb_pline_is_aligned(const pcb_pline_t *src) +rnd_bool pcb_pline_is_aligned(const rnd_pline_t *src) { - const pcb_vnode_t *v, *n; + const rnd_vnode_t *v, *n; v = src->head; do { @@ -132,7 +132,7 @@ for(pa = pcb_poly_island_first(src, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { - pcb_pline_t *pl; + rnd_pline_t *pl; pl = pcb_poly_contour(&it); if (pl != NULL) { /* we have a contour */ @@ -176,7 +176,7 @@ pcb_r_insert_entry(dst->edge_tree, (rnd_rnd_box_t *)e); } -static void add_track(pcb_cpoly_edgetree_t *dst, pcb_pline_t *track) +static void add_track(pcb_cpoly_edgetree_t *dst, rnd_pline_t *track) { int go, first = 1; rnd_coord_t x, y, px, py; @@ -213,18 +213,18 @@ res->bbox.X2 = res->bbox.Y2 = -RND_MAX_COORD; for(pa = pcb_poly_island_first(src, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { - pcb_pline_t *pl, *track; + rnd_pline_t *pl, *track; pl = pcb_poly_contour(&it); if (pl != NULL) { /* we have a contour */ track = rnd_pline_dup_offset(pl, -offs); add_track(res, track); - pcb_poly_contour_del(&track); + rnd_poly_contour_del(&track); for(pl = pcb_poly_hole_first(&it); pl != NULL; pl = pcb_poly_hole_next(&it)) { track = rnd_pline_dup_offset(pl, -offs); add_track(res, track); - pcb_poly_contour_del(&track); + rnd_poly_contour_del(&track); } } } @@ -485,7 +485,7 @@ pcb_poly_it_t it; rnd_polyarea_t *pa; for(pa = pcb_poly_island_first(polygon, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { - pcb_pline_t *pl = pcb_poly_contour(&it); + rnd_pline_t *pl = pcb_poly_contour(&it); if (pl != NULL) { /* we have a contour */ pcb_pline_to_lines(PCB_CURRLAYER(PCB), pl, conf_core.design.line_thickness, conf_core.design.line_thickness * 2, flg); for(pl = pcb_poly_hole_first(&it); pl != NULL; pl = pcb_poly_hole_next(&it)) Index: trunk/src_plugins/lib_polyhelp/polyhelp.h =================================================================== --- trunk/src_plugins/lib_polyhelp/polyhelp.h (revision 31036) +++ trunk/src_plugins/lib_polyhelp/polyhelp.h (revision 31037) @@ -27,12 +27,12 @@ #include "obj_poly.h" -void pcb_pline_fprint_anim(FILE *f, const pcb_pline_t *pl); +void pcb_pline_fprint_anim(FILE *f, const rnd_pline_t *pl); /* Add lines on dst tracing pline from the inner side (no line will extend outside of the original pline, except when the original polygon has a hair narrower than thickness). Returns number of lines created */ -rnd_cardinal_t pcb_pline_to_lines(pcb_layer_t *dst, const pcb_pline_t *src, rnd_coord_t thickness, rnd_coord_t clearance, pcb_flag_t flags); +rnd_cardinal_t pcb_pline_to_lines(pcb_layer_t *dst, const rnd_pline_t *src, rnd_coord_t thickness, rnd_coord_t clearance, pcb_flag_t flags); /* Returns whether the clipped polygon is a simple rectangle (single island, no-hole rectangle). */ @@ -39,7 +39,7 @@ rnd_bool pcb_cpoly_is_simple_rect(const pcb_poly_t *p); /* Returns whether all edges of a pline are axis aligned */ -rnd_bool pcb_pline_is_aligned(const pcb_pline_t *src); +rnd_bool pcb_pline_is_aligned(const rnd_pline_t *src); /*** Generate an rtree of all edges if a polygon */ Index: trunk/src_plugins/millpath/toolpath.c =================================================================== --- trunk/src_plugins/millpath/toolpath.c (revision 31036) +++ trunk/src_plugins/millpath/toolpath.c (revision 31037) @@ -93,8 +93,8 @@ poly->Clipped->f = poly->Clipped->b = poly->Clipped; } - pcb_polyarea_boolean(result->fill->Clipped, poly->Clipped, &ra, PCB_PBO_SUB); - pcb_polyarea_free(&result->fill->Clipped); + rnd_polyarea_boolean(result->fill->Clipped, poly->Clipped, &ra, RND_PBO_SUB); + rnd_polyarea_free(&result->fill->Clipped); result->fill->Clipped = ra; if (!PCB_FLAG_TEST(PCB_FLAG_FULLPOLY, poly)) { @@ -122,7 +122,7 @@ case PCB_OBJ_POLY: poly->Clipped = pcb_poly_to_polyarea(poly, &dummy); sub_layer_poly(ctx->pcb, ctx->result, ctx->layer, poly, ctx->centerline); - pcb_polyarea_free(&poly->Clipped); + rnd_polyarea_free(&poly->Clipped); break; default: rnd_message(RND_MSG_ERROR, "Internal error: toolpath sub_layer_text() invalid object type %ld\n", obj->type); } @@ -291,8 +291,8 @@ /* remove fill from remain */ { rnd_polyarea_t *rp; - pcb_polyarea_boolean(result->remain->Clipped, result->fill->Clipped, &rp, PCB_PBO_SUB); - pcb_polyarea_free(&result->remain->Clipped); + rnd_polyarea_boolean(result->remain->Clipped, result->fill->Clipped, &rp, RND_PBO_SUB); + rnd_polyarea_free(&result->remain->Clipped); result->remain->Clipped = rp; result->remain->Flags.f |= PCB_FLAG_FULLPOLY; } @@ -313,7 +313,7 @@ rnd_cardinal_t cnt = 0; for(pa = pcb_poly_island_first(result->fill, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { - pcb_pline_t *pl = pcb_poly_contour(&it); + rnd_pline_t *pl = pcb_poly_contour(&it); if (pl != NULL) { /* we have a contour */ pcb_pline_to_lines(result->res_path, pl, tool_dia + extra_offs, 0, pcb_no_flags()); cnt++; @@ -356,7 +356,7 @@ assert(ctx->cut->type == PCB_OBJ_LINE); /* need to handle arc later */ - pcb_polyarea_get_tree_seg(obj, &vl.Point1.X, &vl.Point1.Y, &vl.Point2.X, &vl.Point2.Y); + rnd_polyarea_get_tree_seg(obj, &vl.Point1.X, &vl.Point1.Y, &vl.Point2.X, &vl.Point2.Y); /* ox;oy: normal vector scaled to thickness/2 */ vx = l->Point2.X - l->Point1.X; @@ -397,7 +397,7 @@ rnd_rtree_dir_t fix_overcuts_in_pline(void *ctx_, void *obj, const rnd_rtree_box_t *box) { pline_ctx_t *ctx = ctx_; - pcb_pline_t *pl = obj; + rnd_pline_t *pl = obj; return rnd_rtree_search_obj(pl->tree, (const rnd_rtree_box_t *)&ctx->cut->BoundingBox, fix_overcuts_in_seg, ctx); } @@ -434,14 +434,14 @@ int within = 0; c = pcb_poly_from_circle(line->Point1.X, line->Point1.Y, r); - within |= pcb_polyarea_touching(pa, c); - pcb_polyarea_free(&c); + within |= rnd_polyarea_touching(pa, c); + rnd_polyarea_free(&c); if (!within) { c = pcb_poly_from_circle(line->Point2.X, line->Point2.Y, r); if (!within) - within |= pcb_polyarea_touching(pa, c); - pcb_polyarea_free(&c); + within |= rnd_polyarea_touching(pa, c); + rnd_polyarea_free(&c); } if (within) { Index: trunk/src_plugins/polycombine/polycombine.c =================================================================== --- trunk/src_plugins/polycombine/polycombine.c (revision 31036) +++ trunk/src_plugins/polycombine/polycombine.c (revision 31037) @@ -33,15 +33,15 @@ static rnd_polyarea_t *original_poly(pcb_poly_t *p, rnd_bool *forward) { - pcb_pline_t *contour = NULL; + rnd_pline_t *contour = NULL; rnd_polyarea_t *np = NULL; rnd_cardinal_t n; - pcb_vector_t v; + rnd_vector_t v; int hole = 0; *forward = rnd_true; - if ((np = pcb_polyarea_create()) == NULL) + if ((np = rnd_polyarea_create()) == NULL) return NULL; /* first make initial polygon contour */ @@ -52,29 +52,29 @@ v[0] = p->Points[n].X; v[1] = p->Points[n].Y; if (contour == NULL) { - if ((contour = pcb_poly_contour_new(v)) == NULL) + if ((contour = rnd_poly_contour_new(v)) == NULL) return NULL; } else { - pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); + rnd_poly_vertex_include(contour->head->prev, rnd_poly_node_create(v)); } /* Is current point last in contour? If so process it. */ if (n == p->PointN - 1 || (hole < p->HoleIndexN && n == p->HoleIndex[hole] - 1)) { - pcb_poly_contour_pre(contour, rnd_true); + rnd_poly_contour_pre(contour, rnd_true); /* Log the direction in which the outer contour was specified */ if (hole == 0) - *forward = (contour->Flags.orient == PCB_PLF_DIR); + *forward = (contour->Flags.orient == RND_PLF_DIR); /* make sure it is a positive contour (outer) or negative (hole) */ - if (contour->Flags.orient != (hole ? PCB_PLF_INV : PCB_PLF_DIR)) - pcb_poly_contour_inv(contour); - assert(contour->Flags.orient == (hole ? PCB_PLF_INV : PCB_PLF_DIR)); + if (contour->Flags.orient != (hole ? RND_PLF_INV : RND_PLF_DIR)) + rnd_poly_contour_inv(contour); + assert(contour->Flags.orient == (hole ? RND_PLF_INV : RND_PLF_DIR)); - pcb_polyarea_contour_include(np, contour); + rnd_polyarea_contour_include(np, contour); contour = NULL; - assert(pcb_poly_valid(np)); + assert(rnd_poly_valid(np)); hole++; } @@ -122,11 +122,11 @@ { /* int contours_isect;*/ /* Should check outer contours don't intersect? */ -/* contours_isect = pcb_polyarea_touching(outer, inner);*/ +/* contours_isect = rnd_polyarea_touching(outer, inner);*/ /* Cheat and assume simple single contour polygons for now */ /* return contours_isect ? - 0 : pcb_poly_contour_in_contour(outer->contours, inner->contours);*/ - return pcb_poly_contour_in_contour(outer->contours, inner->contours); + 0 : rnd_poly_contour_in_contour(outer->contours, inner->contours);*/ + return rnd_poly_contour_in_contour(outer->contours, inner->contours); } @@ -247,7 +247,7 @@ for (cur_node = root; cur_node != NULL; cur_node = cur_node->next) { /* Process this element */ /* printf ("Processing node %ld %s\n", cur_node->polygon->ID, cur_node->forward ? "FWD" : "BWD");*/ - pcb_polyarea_boolean_free(accumulate, cur_node->polyarea, &res, cur_node->forward ? PCB_PBO_UNITE : PCB_PBO_SUB); + rnd_polyarea_boolean_free(accumulate, cur_node->polyarea, &res, cur_node->forward ? RND_PBO_UNITE : RND_PBO_SUB); accumulate = res; /* And its children if it has them */ @@ -267,8 +267,8 @@ rnd_polyarea_t *np; /* bool outer; rnd_polyarea_t *pa; - pcb_pline_t *pline; - pcb_vnode_t *node; + rnd_pline_t *pline; + rnd_vnode_t *node; pcb_poly_t *Polygon;*/ pcb_layer_t *Layer = NULL; poly_tree *root = NULL; Index: trunk/tests/librnd/librnd_test.c =================================================================== --- trunk/tests/librnd/librnd_test.c (revision 31036) +++ trunk/tests/librnd/librnd_test.c (revision 31037) @@ -15,8 +15,8 @@ static void poly_test() { rnd_polyarea_t pa; - pcb_polyarea_init(&pa); - pcb_poly_valid(&pa); + rnd_polyarea_init(&pa); + rnd_poly_valid(&pa); } int main(int argc, char *argv[])