7 typedef enum {DIR_UP, DIR_DOWN} segment_dir_t;
8 typedef enum {EVENT_CROSS, EVENT_END, EVENT_START} eventtype_t;
9 typedef enum {SLOPE_POSITIVE, SLOPE_NEGATIVE} slope_t;
11 typedef struct _point {
16 typedef struct _segment {
20 double k; //k = a.x*b.y-a.y*b.x = delta.y*a.x - delta.x*a.y (=0 for points on the segment)
24 struct _segment*right;
28 dict_t scheduled_crossings;
31 #define LINE_EQ(p,s) ((double)(s)->delta.y*(p).x - (double)(s)->delta.x*(p).y - (s)->k)
33 typedef segment_t gfxpoly_t;
34 gfxpoly_t* gfxpoly_new();
35 void gfxpoly_dump(gfxpoly_t*poly);
37 typedef struct _event {
44 void segment_init(segment_t*s, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
45 segment_t*segment_new(int32_t x1, int32_t y1, int32_t x2, int32_t y2);
46 void segment_insert_before(segment_t**list, segment_t*add);