diff options
author | neoraider <devnull@localhost> | 2007-06-26 21:30:01 +0200 |
---|---|---|
committer | neoraider <devnull@localhost> | 2007-06-26 21:30:01 +0200 |
commit | f10436d8168840417c000e08038350dd5de4fc15 (patch) | |
tree | 1149581315fae39c27c741b81c6e130ff5cd666c /geometry.c | |
parent | b8549034bef0de090547f32af07df248e68c7064 (diff) | |
download | zoomedit-f10436d8168840417c000e08038350dd5de4fc15.tar zoomedit-f10436d8168840417c000e08038350dd5de4fc15.zip |
zoomedit: Added room selection and hover effect.
Diffstat (limited to 'geometry.c')
-rw-r--r-- | geometry.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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; |