X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=polygon.cc;h=2ae238d3c1c39010c56da46953988655bfca6e58;hb=3e51d77116e49ba279a6cbbf1dbbc893c4117eb4;hp=f8189d53b1ca3d2e224ef2c8a21b216c50bf45ed;hpb=9e314265ccd6163e8a79bdbb91a8bfb46ff73bca;p=universe.git diff --git a/polygon.cc b/polygon.cc index f8189d5..2ae238d 100644 --- a/polygon.cc +++ b/polygon.cc @@ -47,17 +47,13 @@ Polygon *Polygon::clone() { return new Polygon(_mass, _red, _green, _blue, _relative_x, _relative_y, _nb_vertices); } -void Polygon::print_fig(ostream &os) { - // os << "2 3 0 1 0 7 50 -1 20 0.000 0 0 -1 0 0 " << _nb_vertices + 1 << endl; - int c; - do { c = int(drand48() * 32); } while(c == 7); - os << "2 3 0 1 0 6 50 -1 20 0.000 0 0 -1 0 0 " << _nb_vertices + 1 << endl; - // os << "2 3 0 0 0 " << c << " 50 -1 20 0.000 0 0 -1 0 0 " << _nb_vertices + 1 << endl; - // os << "2 3 0 2 7 " << c << " 50 -1 20 0.000 0 0 -1 0 0 " << _nb_vertices + 1 << endl; - os << " "; - for(int n = 0; n < _nb_vertices; n++) os << " " << int(_x[n]*10) << " " << int(_y[n]*10); - os << " " << int(_x[0]*10) << " " << int(_y[0]*10); - os << endl; +void Polygon::color_xfig(XFigTracer *tracer) { + tracer->add_color(int(255 * _red), int(255 * _green), int(255 * _blue)); +} + +void Polygon::print_xfig(XFigTracer *tracer) { + tracer->draw_polygon(int(255 * _red), int(255 * _green), int(255 * _blue), + _nb_vertices, _x, _y); } void Polygon::draw(SimpleWindow *window) {