+ static circle_coord_t*circle_order = 0;
+ static int circle_order_size = 0;
+
+ if(!circle_order) {
+ circle_order_size = (max_radius*(max_radius+1))/2;
+ circle_order = malloc(sizeof(circle_coord_t)*circle_order_size);
+ int x,y;
+ int i = 0;
+ for(y=0;y<max_radius;y++) {
+ for(x=0;x<=y;x++) {
+ circle_order[i].x=x;
+ circle_order[i].y=y;
+ i++;
+ }
+ }
+ assert(i==circle_order_size);
+ qsort(circle_order, circle_order_size, sizeof(circle_coord_t), compare_circle_coord);
+ }
+