34 lines
864 B
C
34 lines
864 B
C
#ifndef GEOMETRY_H_
|
|
#define GEOMETRY_H_
|
|
|
|
|
|
#include "Vertex.h"
|
|
#include "Polygon.h"
|
|
#include "Line.h"
|
|
#include <glib.h>
|
|
|
|
#define EDGE_NONE 0
|
|
#define EDGE_LEFT (1<<0)
|
|
#define EDGE_RIGHT (1<<1)
|
|
#define EDGE_TOP (1<<2)
|
|
#define EDGE_BOTTOM (1<<3)
|
|
#define EDGE_ALL (EDGE_LEFT|EDGE_RIGHT|EDGE_TOP|EDGE_BOTTOM)
|
|
|
|
|
|
|
|
|
|
typedef struct _RECTANGLE {
|
|
double x, y, width, height;
|
|
} RECTANGLE;
|
|
|
|
|
|
int vertexOnLine(const Vertex *v, const LINE *l);
|
|
int vertexInRect(const Vertex *v, const RECTANGLE *rect);
|
|
|
|
|
|
int lineRectIntersection(const LINE *l, const RECTANGLE *rect, int edge, Vertex *v);
|
|
int lineRectIntersections(const LINE *line, const RECTANGLE *rect, int edge, Vertex *v1, Vertex *v2);
|
|
//gboolean linePolygonIntersection(const LINE *l, const POLYGON *p);
|
|
void simplifyPolygon(const Polygon *in, const RECTANGLE *rect, Polygon *out);
|
|
|
|
#endif /*GEOMETRY_H_*/
|