-// -*- compile-command:"g++ -lX11 -Wall -g -O3 -o mash misc.o universe.o polygon.o mash.cc xfig_tracer.o -L/usr/X11R6/lib/"; -*-
#include <iostream>
#include <fstream>
ys[k] = scalar_t(h)/2 + radius * sin(-alpha);
}
Polygon *p;
- p = new Polygon(1.0, 0.5, 0.5, 0.5, xs, ys, nb);
+ p = new Polygon(1.0, 0.0, 0.0, 0.0, xs, ys, nb);
p->set_position(scalar_t(w/2), scalar_t(h) * 0.75, 0);
p->set_speed(0, 0, 0);
universe.initialize(p);
cout << "n = " << n << " nb_edges = " << nb_edges << endl;
- blocks[i] = new Polygon(1.0, 1.0, 1.0, 0.0, xs, ys, nb_edges);
+ scalar_t red, green, blue;
do {
- blocks[i]->set_position(drand48() * w/2 + w/4, drand48() * h/2 + h/4, M_PI * drand48());
+ red = scalar_t(16 * int(drand48() * 16))/255.0;
+ green = scalar_t(16 * int(drand48() * 16))/255.0;
+ blue = scalar_t(16 * int(drand48() * 16))/255.0;
+ } while((red > 0.1 && green > 0.1 && blue > 0.1) ||
+ (red < 0.9 && green < 0.9 && blue < 0.9));
+ blocks[i] = new Polygon(1.0, red, green, blue, xs, ys, nb_edges);
+ do {
+ blocks[i]->set_position(drand48() * w * 0.9 + w * 0.05, drand48() * 3 * h / 4 + h/8, M_PI * drand48());
blocks[i]->set_speed(0, 0, 0);
// universe.initialize(blocks[i]);
for(int j = 0; j < i + 1; j++) {
char buffer[1024];
sprintf(buffer, "/tmp/mash_%06d.fig", n);
XFigTracer tracer(buffer);
- universe.print_fig(&tracer);
+ universe.print_xfig(&tracer);
cout << "Wrote " << buffer << endl;
}
}
XFigTracer tracer("/tmp/mash.fig");
- universe.print_fig(&tracer);
+ universe.print_xfig(&tracer);
exit(0);
}