r2_vec_t cpk_pack_sites ( r2_vect_t p, /* Vertices of polygon, ccw around interior. */ r2_vec_t f, /* Fixed sites. */ double d_min, /* Minimum distance between sites. */ double d_ext, /* Minimum distance from exterior. */ double step, /* Granularity of locations. */ r2_t u /* Direction for greedy heuristic. */ ) { } r2_vec_t cpk_pack_sites ( r2_vect_t p, /* Vertices of polygon, ccw around interior. */ r2_vec_t f, /* Fixed sites. */ double d_min, /* Minimum distance between sites. */ double d_ext, /* Minimum distance from exterior. */ double step /* Granularity of locations. */ ) { /* Contract the polygon by {d_ext}: */ /* Erase the domains of the fixed circles {f}: */ /* Greedy sweep: */ } double umin = INF, umax = -INF; double vmin = INF, vmax = -INF; for (i = 0; i < p.nel; i++) { if (pu < umin) { umin = pu; } if (pu < umax) { umax = pu; } /* Set up the grid: */ /* Paint the polygon on the canvas */ } PSStream *hxp_init_plot ( double xSize, /* Figure width (mm). */ double ySize, /* Figure height (mm). */ bool epsFormat, /* TRUE for Encapsulated Postscript. */ char *paper, /* Paper size for non-encapsulated output. */ double grid, /* Coordinate grid spacing ({s} units), or 0 for no grid. */ PSStream *hxp_init_plot ( char *name, bool epsFormat, char *paperSize, dg_Interval bbox[] ); /* Opens a Postsript plotfile with given name, plus the appropriate extension (".eps" or ".ps"), and initializes it for plotting. The scales are set so that the rectangle {bbox[0] × bbox[1]} fits snugly in the available plotting area, with equal scales. */ void hxp_finish_plot ( PSStream *ps, bool epsFormat ); /* Finalizes and closes the Postscript plotfile {f}. */ PSStream *init_plot ( char *name, bool epsformat, char *paperSize, dg_Interval bbox[] ) { double hpt, vpt; if (epsformat) { hpt = 5.0*72.0; vpt = hpt * 4.0/3.0; } else { pswr_get_paper_dimensions(paperSize, &hpt, &vpt); } PSStream *ps = pswr_new_stream(epsformat, name, NULL, paperSize, hpt+6, vpt+8); pswr_set_page_layout(ps, 3.0, 4.0, TRUE, 0.0, 0.0, (epsformat ? 0 : 1), 1,1); double dx = 0.1*(bbox[0].end[BHI] - bbox[0].end[BLO])/2; double dy = 0.1*(bbox[1].end[BHI] - bbox[1].end[BLO])/2; pswr_new_picture ( ps, bbox[0].end[BLO]-dx, bbox[0].end[BHI]+dx, bbox[1].end[BLO]-dy, bbox[1].end[BHI]+dy ); pswr_set_pen(ps, 0,0,0, 0.15, 0,0); if (! epsformat) { pswr_add_caption(ps, "Bezier-distorted grid", 0.0); } pswr_set_pen(ps, 1,0,0, 0.25, 0,0); return ps; } void finish_plot ( PSStream *ps, bool epsformat ) { pswr_close_stream(ps); } /* Write Postscript header and set scales: */ if (eps) { double xPtSize = 72.0*o->xSize/25.4; double yPtSize = 72.0*o->ySize/25.4; ps_begin_figure(f, 0.0, xPtSize, 0.0, yPtSize); ps_set_window(f, lo(xPlot), hi(xPlot), lo(yPlot), hi(yPlot), 0.0, xPtSize, 0.0, yPtSize, 50,50 ); } else { double xPtSize = 72.0*o->xSize/25.4; double yPtSize = 72.0*o->ySize/25.4; /* Margins for A3 paper size: */ double xPtMargin = (72.0*297.0/25.4 - xPtSize)/2.0; double yPtMargin = (72.0*420.0/25.4 - yPtSize)/2.0; ps_begin_document(f, o->paper); ps_begin_page(f, "1"); ps_set_window(f, lo(xPlot), hi(xPlot), lo(yPlot), hi(yPlot), xPtMargin, xPtMargin+xPtSize, yPtMargin, yPtMargin+yPtSize, 50,50 ); } /* Define edge styles according to coverage: */ for (ei = 0; ei < m->ne; ei++) { float *ewd = &(ewidth[ei]); hxp_color_t *ecl = &(ecolor[ei]); *ewd = (ecover[ei] == 0 ? 0.24 : 0.30); if (ecover[ei] == 0) { *ecl = uncColor; } else if (ecover[ei] == 1) { *ecl = sngColor; } else { *ecl = mulColor; } } /* Plot map proper: */ st_map_plot(f, m, xClip, yClip, vwidth, vcolor, ewidth, ecolor); /* Write Postscript trailer: */ if (o->eps) { pswr_end_figure(f); } else { pswr_end_page(f); pswr_end_document(f); } double xSize, /* Figure width (mm). */ double ySize, /* Figure height (mm). */ bool epsFormat, /* TRUE for Encapsulated Postscript. */ char *paper, /* Paper size for non-encapsulated output. */ double grid, /* Coordinate grid spacing ({s} units), or 0 for no grid. */ interval_t xClip, /* X coordinate clipping range ({s} units). */ interval_t yClip /* Y coordinate clipping range ({s} units). */ interval_t xClip, /* X coordinate clipping range ({s} units). */ interval_t yClip /* Y coordinate clipping range ({s} units). */ interval_t xPlot, yPlot; /* Coordinate ranges of plot area */ hxp_color_t vcolor[m->nv]; /* Vertex colors. */ hxp_color_t ecolor[m->ne]; /* Edge colors. */ int vi, ei, i; if ((lo(xClip) < hi(xClip)) && (lo(yClip) < hi(yClip))) { double tol; /* Tolerance for vertex and edge clipping */ /* Plot area is exactly what the client asked: */ xPlot = xClip; yPlot = yClip; /* Clipping rectangle is a bit wider, just in case: */ tol = 0.01 * ((hi(xPlot) - lo(xPlot)) + (hi(yPlot) - lo(yPlot))); interval_widen(&xClip, tol); interval_widen(&yClip, tol); } else { /* Plot area is the canvas's bounding box, with some extra room: */ xPlot = (interval_t){{ ox, ox + (nx + 0.5)*dx }}; yPlot = (interval_t){{ oy, oy + ny*dy }}; interval_widen(&xPlot, dx/2.0); interval_widen(&yPlot, dy/2.0); st_adjust_rect_shape(&xPlot, &yPlot, o->xSize, o->ySize); /* No clipping: */ lo(xClip) = MAXDOUBLE; hi(xClip) = -MAXDOUBLE; /* Empty interval. */ lo(yClip) = MAXDOUBLE; hi(yClip) = -MAXDOUBLE; /* Empty interval. */ } /* Plot canvas: */ if (grid > 0.0) { double c; pswr_set_pen(ps, 0.0,1.0,1.0, 0.10, 0.0, 0.0); c = floor((lo(xPlot) + 0.1)/o->grid) * o->grid; while (c < hi(xPlot) - 0.1) { pswr_draw_coord_line(ps, HOR, c); c += o->grid; } c = floor((lo(yPlot) + 0.1)/o->grid) * o->grid; while (c < hi(yPlot) - 0.1) { pswr_draw_coord_line(f, VER, c); c += o->grid; } }