chiark / gitweb /
found in ian@chiark:things/moebius.old-before-cvs
[moebius.git] / graphics.hh
1 /*
2  * Graphics library
3  */
4
5 #ifndef GRAPHICS_HH
6 #define GRAPHICS_HH
7
8 #include "library.hh"
9 #include "output.hh"
10
11 class Cell {
12   void display(Output& o);
13   friend class SortedCellList;
14 public:
15   Point p[4];
16   double index() { return p[0].index(); }
17 };
18
19 #define fragmentsize 10
20 class SortedCellList {
21   struct Entry {
22     double index;
23     Cell *cell;
24   };
25   struct Fragment {
26     int used;
27     Entry entries[fragmentsize];
28   };
29   Fragment **fragments;
30   int size,used;
31   
32   Fragment *insertfragment(int at);
33 public:
34   SortedCellList() { fragments=0; size=used=0; }
35   ~SortedCellList();
36   void insert(Cell*);
37   void display(Output& o);
38 };
39
40 #endif