Some Algorithms for Polygons on a Sphere - PowerPoint PPT Presentation

1 / 53
About This Presentation
Title:

Some Algorithms for Polygons on a Sphere

Description:

Now the baseline is the South Pole and the. trapezoid is replaced by a ... of the California-Nevada border is SE from a specified lat, lon (in Lake Tahoe) ... – PowerPoint PPT presentation

Number of Views:97
Avg rating:3.0/5.0
Slides: 54
Provided by: RGC6
Category:

less

Transcript and Presenter's Notes

Title: Some Algorithms for Polygons on a Sphere


1
Some Algorithms for Polygons on a Sphere
Robert.G.Chamberlain_at_jpl.nasa.gov William.H.Duquet
te_at_jpl.nasa.gov
  • Jet Propulsion Laboratory
  • California Institute of Technology
  • 4800 Oak Grove Drive
  • Pasadena, CA 91109-8099

Association of American Geographers Annual
Meeting San Francisco, CA 1721 April 2007
2
Algorithms for Polygons on a Sphere
We are developing a new training simulation for
the Army
  • Q Why bother with spherical trig?
  • A To avoid implementing a sophisticated
    projection
  • Many other simulations interfaces doomed,
    unless
  • Use spherical coordinates lat and lon
  • Algorithms Area, Point-in-Polygon,
    Polygon-on-Polygon Area
  • But a search found only planar algorithms
  • What is a straight line?
  • Great circle segments, of course
  • But political boundaries are rhumb lines!
  • KISS Can we just use a straightedge on a plot
    of lat vs lon?
  • Any of these are okay if the lines are not too
    long
  • How long is too long?

This is aka an equidistant cylindrical,
equirectangular, or Plate-Carée projection
3
Preliminaries
  • Earth
  • Sphere with radius R
  • , lat (Latitude), is zero at equator, north is
    positive
  • , lon (Longitude), is zero at Greenwich, east
    is positive
  • Polygon
  • Described by counterclockwise sequence of
    vertices, numbered from i 0 to N1 thus it has
    N sides (edges)
  • Coordinates of point i are and
  • Simply connected (one piece)
  • No holes
  • No edge crosses or touches another
  • Neither pole is inside the polygon

4
  • The Planimeter
  • Algorithm to Compute
  • the
  • Area of a Polygon

5
Area The Planar Algorithm
Area is the sum of signed areas of trapezoids
between the edges and a baseline
1
N 2
polygon
0 or N
2
3
N 1
y
x
baseline
6
Area The Planar Algorithm
Positive Area
Polygon is CCW, soright-to-left is a top
edge with a positive area
1
N 2
0 or N
2
3
N 1
y
x
baseline
7
Area The Planar Algorithm
More Positive Area
1
N 2
0 or N
2
3
N 1
y
x
baseline
8
Area The Planar Algorithm
Negative Area
(Same Formula)
Left-to-right is a bottom edge with a negative
area
1
N 2
0 or N
2
3
N 1
y
x
baseline
9
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
10
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
11
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
12
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
13
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
14
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
15
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
16
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
17
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
18
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
19
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
20
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
21
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
22
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
23
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
24
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
25
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
26
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
27
Area The Planar Algorithm
1
N 2
0 or N
2
3
N 1
y
x
baseline
28
Area The Planar Algorithm
Note that the coordinates of the baseline
canceled out
1
N 2
0 or N
2
3
N 1
y
x
baseline
29
  • The
  • Area of a Polygon
  • on a
  • Sphere

30
Area The Spherical Case
  • Now the baseline is the South Pole and the
  • trapezoid is replaced by a spherical triangle.

But a simple exact expression for the areas of
these triangles has eluded us.
31
  • Point
  • in
  • Polygon

32
Point in Polygon
  • Standard algorithm
  • Construct a ray from the test point to a point
    known to be outside the polygon. (North Pole)
  • Compare test ray to each edge in the polygon
  • Count the number of edges crossed
  • An odd implies the Test Point is inside
  • What if the test ray goes through a vertex?
  • Count it as crossing both edges? Neither?
  • No Vertices that are exactly on the test ray are
    all arbitrarily on one side of the ray (East)

Polygon
Test Point
33
  • Overlapping
  • Polygons

34
Overlapping Polygons
  • What is the area covered by both of two polygons?
  • Simple cases

One entirelyinside the other
Non-overlapping bounding boxes
Bounding boxes overlap, but polygons do not
intersect
  • Otherwise, add vertices at all intersections
    (if needed)
  • Mark changes from inside to out and from out to
    in as crossings(all intersections are now
    vertices, but some might not be crossings)

35
Overlapping Polygons
  • To find the shared sub-polygons
  • Follow the perimeter of one polygon (red) to a
    crossing point, starting outside the other
    polygon (green)
  • Remember the starting point (so youll know when
    youve checked all the (red) edges)

36
Overlapping Polygons
  • Unmark the crossing point
  • Continue to the next crossing, copying the (red)
    edge(s) as the first edge(s) in the shared
    sub-polygon
  • Change to the other (green) polygon

37
Overlapping Polygons
  • Unmark the crossing point
  • Continue to the next crossing, copying the
    (green) edge(s) into the shared sub-polygon
  • Change to the other (red) polygon

38
Overlapping Polygons
  • Repeat
  • Unmark the crossing point, continue to next
    crossing point
  • Copying the (red) edge(s) into the shared
    sub-polygon
  • Change to the other (green) polygon

39
Overlapping Polygons
  • Repeat
  • Until back at the start of the shared sub-polygon

40
Overlapping Polygons
  • Continue along the (red) polygon to the next
    marked crossing point

41
Overlapping Polygons
  • Do it again

42
Overlapping Polygons
  • And again

43
Overlapping Polygons
  • And again

44
Overlapping Polygons
  • Until there are no more marked crossing points

45
Overlapping Polygons
  • Until there are no more marked crossing points
  • Use the Area algorithm for each of the
    sub-polygons

46
  • Three Kinds
  • of
  • Straight Lines

47
Three Kinds of Straight Lines
  • Those algorithms are topological but
  • Crossing requires knowing the shape of the
    edges
  • Great circle segment shortest distance on
    surface
  • Rhumb line most (all?) straight political
    boundaries
  • US Supreme Court 1980 The oblique portion of the
    California-Nevada border is SE from a specified
    lat, lon (in Lake Tahoe)
  • How about a straightedge line on a lat-lon plot?
  • This lat-lon line is closer to a rhumb line
    than a great circle is if the lines are not too
    long
  • The paper gives formulas for lat vs lon, bounding
    boxes, and intersection tests for these 3
    definitions
  • Using a northerly ray in the intersection test
    simplifies the intersection tests

48
  • How Long
  • is
  • Too Long?

49
How Long is Too Long?
  • When does it matter which kind of straight line
    we use?
  • Edge Length?
  • LAX (Los Angeles) to JFK (New York) is only 1
    farther on a rhumb line than on a great circle
    segment (2165 nm vs 2144 nm)
  • Exact lengths can be computed from formulas in
    the paper
  • Area?
  • Unless the polygon is extremely gerrymandered,
    area has very little dependence on which of
    these definitions is used
  • If polygon is entirely in the Northern or
    Southern Hemisphere, errors near the northern
    edges will tend to cancel those near the southern
  • Great circle and lat-lon formulas are in the
    paper
  • Point in Polygon?
  • Yes so we looked at the maximum separation
    between the three kinds of line
  • But, back in the application, how big is the
    point? If its an M1A1 tank, for example, it is
    3 meters wide and almost 10 meters long!

50
How Long is Too Long?
North
MaxGC
Great Circle Segment
Rhumb Line
Azimuth
Lat-lon Line
MaximumEdge Length
MaxSL
Latitude
Longitude
  • Closed-form expressions for MaxGC and MaxSL are
    too complicated to give any insight
  • The paper gives tables
  • Pick how big is a point MaxGC or MaxSL ? which
    table
  • 1, 5, 10, 20, 50, 100, 200, 500 meters
  • Select latitude or latitude range of interest ?
    which row or rows
  • If you can select azimuth, do so ? which column
    or columns
  • Then Maximum Edge Length is the cell contents in
    the table

51
How Long is Too Long?
North
MaxGC
Great Circle Segment
Rhumb Line
Azimuth
Lat-lon Line
MaximumEdge Length
MaxSL
Latitude
Longitude
Example MaxSL10 meters, Latitude 33, Azimuth
62 Maximum Edge Length 38
kilometers
Latitude

42 31 27 25 25 25
27 31 42
50
50 37 32 30 30 30
32 37 50
40
60 44 38 36 36 36
38 44 60
30
72 53 45 43 43 43
46 53 72

0 10 20 30 40 50 60
70 80 90
Azimuth
52
How Long is Too Long?
North
MaxGC
Great Circle Segment
Rhumb Line
Azimuth
Lat-lon Line
MaximumEdge Length
MaxSL
Latitude
Longitude
  • Example MaxSL10 meters, 30 lt Latitude lt
    50,Azimuth unknown Maximum Edge Length 30
    kilometers

Latitude

42 31 27 25 25 25
27 31 42
50
50 37 32 30 30 30
32 37 50
40
60 44 38 36 36 36
38 44 60
30
72 53 45 43 43 43
46 53 72

0 10 20 30 40 50 60
70 80 90
Azimuth
53
How Long is Too Long? Bottom Line
Great Circle Segment
Rhumb Line
Lat-lon Line
Maximum Edge Length
Write a Comment
User Comments (0)
About PowerShow.com