home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.programming
- Path: sparky!uunet!cs.utexas.edu!torn!nott!emr1!jagrant
- From: jagrant@emr1.emr.ca (John Grant)
- Subject: need fast algorithm to intersect wiggly lines with polygons
- Message-ID: <1993Jan24.050819.9948@emr1.emr.ca>
- Organization: Energy, Mines, and Resources, Ottawa
- Date: Sun, 24 Jan 1993 05:08:19 GMT
- Lines: 36
-
- I want to intersect an aircraft flight line with a bunch of polygons,
- both closed and open (i.e. lakes, rivers, roads etc).
-
- There is only 1 flight line, which is more or less straight, but not
- always (availability of GPS navigation has lessened the restrictions
- on flying a really straight line, also crosswinds tend to put a
- few curves in the line).
-
- The flight line has several hundred points in it (i.e. an (x,y) is recorded
- every 1 s). There may be many polygons. For the open polygons, I need
- just the single point(s) (it may intersect more than once). For the
- closed polygons, I need pairs of points (always pairs, i.e. if the
- line starts in the middle of the lake, then that is the first point).
- I won't worry about tangents where the 2 points are the same.
-
- The co-ordinates are all cartesian (UTM), i.e. not geographic long/lat.
-
- I know the bounding rectangle for the flight line and for each of the
- polygons. What I do now is to ignore all polygons whose boundingg
- rectangles do not intersect with the bounding rectangle of the line.
- After that, I do it the hard way. I take every straight line segment
- from [i] to [i+1] of the line and intersect it with every straight
- line segment of the polygon from [j] to [j+1], using the usual
- straight line intersection equations. As you can imagine,
- it is slow, but it works. All co-ordinates and calculations are float.
-
- I need this to draw a profile section of the flight line, showing the
- open polygons it intersects as vertical lines and the closed polygons
- as rectangles.
-
- Any ideas or references?
-
- --
- John A. Grant jagrant@emr1.emr.ca
- Airborne Geophysics
- Geological Survey of Canada, Ottawa
-