From 5ea7f0464eb13581322215f0614eaae52393e02a Mon Sep 17 00:00:00 2001 From: neoraider Date: Sun, 16 Sep 2007 19:06:02 +0000 Subject: zoomedit: C++ized Polygon --- geometry.h | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'geometry.h') diff --git a/geometry.h b/geometry.h index 7badc74..cefd9a3 100644 --- a/geometry.h +++ b/geometry.h @@ -3,6 +3,8 @@ #include "Vertex.h" +#include "Polygon.h" +#include "Line.h" #include #define EDGE_NONE 0 @@ -12,45 +14,21 @@ #define EDGE_BOTTOM (1<<3) #define EDGE_ALL (EDGE_LEFT|EDGE_RIGHT|EDGE_TOP|EDGE_BOTTOM) -#define INTERSECTION_ERROR -1 -#define INTERSECTION_NONE 0 -#define INTERSECTION_IDENTICAL 1 -#define INTERSECTION_LINE 2 -#define INTERSECTION_LINE_LINE 2 -#define INTERSECTION_LINE_SEGMENT 3 -#define INTERSECTION_SEGMENT_LINE 6 -#define INTERSECTION_SEGMENT_SEGMENT 7 + typedef struct _RECTANGLE { double x, y, width, height; } RECTANGLE; -typedef struct _LINE { - Vertex v1, v2; -} LINE; - -typedef struct _VERTEX_LIST { - unsigned int nVertices; - Vertex *vertices; -} VERTEX_LIST, POLYGON; - - -void addVertex(VERTEX_LIST *list, const Vertex *v); -void insertVertex(VERTEX_LIST *list, const Vertex *v, unsigned int n); -void deleteVertex(VERTEX_LIST *list, unsigned int n); int vertexOnLine(const Vertex *v, const LINE *l); int vertexInRect(const Vertex *v, const RECTANGLE *rect); -gboolean vertexInPolygon(const Vertex *v, const POLYGON *p); -double polygonPerimeter(const POLYGON *p); -double polygonArea(const POLYGON *p); -int lineIntersection(const LINE *la, const LINE *lb, Vertex *v); 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); +//gboolean linePolygonIntersection(const LINE *l, const POLYGON *p); +void simplifyPolygon(const Polygon *in, const RECTANGLE *rect, Polygon *out); #endif /*GEOMETRY_H_*/ -- cgit v1.2.3