summaryrefslogtreecommitdiffstats
path: root/geometry.c
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2007-06-26 21:30:01 +0200
committerneoraider <devnull@localhost>2007-06-26 21:30:01 +0200
commitf10436d8168840417c000e08038350dd5de4fc15 (patch)
tree1149581315fae39c27c741b81c6e130ff5cd666c /geometry.c
parentb8549034bef0de090547f32af07df248e68c7064 (diff)
downloadzoomedit-f10436d8168840417c000e08038350dd5de4fc15.tar
zoomedit-f10436d8168840417c000e08038350dd5de4fc15.zip
zoomedit: Added room selection and hover effect.
Diffstat (limited to 'geometry.c')
-rw-r--r--geometry.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/geometry.c b/geometry.c
index 322deee..057fea0 100644
--- a/geometry.c
+++ b/geometry.c
@@ -140,7 +140,10 @@ int lineIntersection(const LINE *la, const LINE *lb, VERTEX *v) {
double xb2 = lb->v2.x, yb2 = lb->v2.y;
double temp;
int switched = 0;
+ VERTEX v2;
+
+ if(v == NULL) v = &v2;
if(xa1 == xa2 && ya1 == ya2) return INTERSECTION_ERROR;
if(xb1 == xb2 && yb1 == yb2) return INTERSECTION_ERROR;
@@ -227,6 +230,21 @@ int lineRectIntersections(const LINE *line, const RECTANGLE *rect, int edge, VER
return ret;
}
+gboolean linePolygonIntersection(const LINE *l, const POLYGON *p) {
+ int i;
+ LINE line;
+
+ for(i = 0; i < p->nVertices; i++) {
+ line.v1 = p->vertices[i];
+ line.v2 = p->vertices[(i+1)%p->nVertices];
+
+ if(lineIntersection(l, &line, NULL) == INTERSECTION_SEGMENT_SEGMENT)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
void simplifyPolygon(const POLYGON *in, const RECTANGLE *rect, POLYGON *out) {
int i, j;
int a;