/* See vorhaf.h */ /* Last edited on 2012-12-08 23:34:32 by stolfilocal */ #include #include #include #include #include #include /* VORONOI HALFSPACE */ void vorhaf_draw (PSStream *ps); void vorhaf_draw (PSStream *ps) { Point s, t; Point ap, bp; s = (Point){{+0.5, +0.3}}; t = (Point){{-0.5, -0.3}}; ap = perp_dir(&s, &t, 10.0); bp = perp_dir(&t, &s, 10.0); { Point cp = perp_dir(&ap, &bp, 10.0); double x[4], y[4]; x[0] = ap.c[0]; y[0] = ap.c[1]; x[1] = bp.c[0]; y[1] = bp.c[1]; x[2] = cp.c[0] + 0.5*(bp.c[0] - ap.c[0]); y[2] = cp.c[1] + 0.5*(bp.c[0] - ap.c[0]); x[3] = ap.c[0] + x[2] - bp.c[0]; y[3] = ap.c[1] + y[2] - bp.c[1]; pswr_set_fill_color(ps, 0.75, 0.75, 0.75); pswr_polygon(ps, TRUE, x, y, 4, TRUE, FALSE, TRUE); pswr_segment(ps, ap.c[0], ap.c[1], bp.c[0], bp.c[1]); } pswr_set_fill_color(ps, 0,0,0); pswr_dot(ps, s.c[0], s.c[1], 0.5, TRUE, FALSE); pswr_dot(ps, t.c[0], t.c[1], 0.5, TRUE, FALSE); pswr_set_pen(ps, 0,0,0, 0.15, 1.5, 1.5); pswr_segment(ps, s.c[0], s.c[1], t.c[0], t.c[1]); pswr_set_pen(ps, 0,0,0, 0.15, 0.0, 0.0); } /* MAIN PROGRAM */ void vorhaf_draw_all(void) { int eps_format; for (eps_format=0; eps_format < 2; eps_format++) { gen_figure("del-vorhaf", -1.0, +1.0, -0.7, +0.7, vorhaf_draw, eps_format); } }