/* Last edited on 2009-09-15 11:42:14 by stolfi */ /* ---------------------------------------------------------------------- */ void adrw_plot_box ( epswr_figure_t *epsf, adrw_point_vec_t *P, int vctr, double hwx, double hwy, double R, double G, double B, bool_t dots ); void adrw_plot_pipe ( epswr_figure_t *epsf, adrw_point_vec_t *P, int va, int vb, double R, double G, double B, bool_t dots ); void adrw_plot_box ( epswr_figure_t *epsf, adrw_point_vec_t *P, int vctr, double hwx, double hwy, double R, double G, double B, bool_t dots ) { /* Get center coordinates: */ demand((vctr >= 0) && (vctr < P->ne), "invalid point index"); adrw_point_t *apc = &(P->e[vctr]); r3_t *pc = &(apc->p); check_defined(pc, vctr); double xc = pc->c[0]; double yc = pc->c[1]; /* Create corner coordinates {x[0..4], y[0..4]}: */ double x[5], y[5]; x[0] = xc - hwx; y[0] = yc - hwy; x[1] = xc - hwx; y[1] = yc + hwy; x[2] = xc + hwx; y[2] = yc + hwy; x[3] = xc + hwx; y[3] = yc - hwy; x[4] = xc - hwx; y[4] = yc - hwy; /* Plot box: */ pswr_set_fill_color(epsf, R,G,B); pswr_polygon(epsf, x, y, 5, TRUE, FALSE, TRUE); if (dots) { /* Plot center with label: */ pswr_set_fill_color(epsf, 0,0,0); adrw_plot_point(epsf, vctr, xc, yc, 0.10); } } void adrw_plot_pipe ( epswr_figure_t *epsf, adrw_point_vec_t *P, int va, int vb, double R, double G, double B, bool_t dots ) { /* Get endpoint coordinates: */ demand((va >= 0) && (va < P->ne), "invalid point index"); adrw_point_t *apa = &(P->e[va]); r3_t *pa = &(apa->p); double xa = pa->c[0], ya = pa->c[1]; check_defined(pa, va); demand((vb >= 0) && (vb < P->ne), "invalid point index"); adrw_point_t *apb = &(P->e[vb]); r3_t *pb = &(apb->p); double xb = pb->c[0], yb = pb->c[1]; check_defined(pb, vb); /* Plot pipe: */ pswr_set_pen(epsf, R,G,B, 0.50, 0,0); pswr_segment(epsf, xa, ya, xb, yb); if (dots) { /* Plot endpoints with labels: */ pswr_set_fill_color(epsf, 0,0,0); adrw_plot_point(epsf, va, xa, ya, 0.5); adrw_plot_point(epsf, vb, xb, yb, 0.5); } }