Adding Cells

Overview

Data Structures

There is a series of 2d arrays that contains information on the cells, corner points, and distance distortions.

Variables

The NumColumns and NumRows is the number of entries in the Corner Point Arrays.

Cell Arrays:

These arrays contain information each of the cells in the grid. The cell at 0,0 is in the lower-left of the grid (minimum latitude and longitude)

Corner Point Arrays

These arrays contain data on the corner points that surround the cells. There is one additional column and row for the extra row and column of points on the top and right of the grid of points.

Distance Distortion Arrays

The distortion arrays contain the distortion for the line segements connecting the corner points so there is one fewer column for the horizontal distances and one fewer row for the vertical distances.

Offset Arrays

There are a set of arrays for accessing information when we add a cell. The cell offsets provide offsets to the cell indexes to find the cells that are adjacent to a cell of interest. The Point Offset arrays provide offstes for the point indexes to find the points that are at the corners of a cell.

The Cell Offset arrays provide indexes to find the adjacent cells starting with the one above the target cell and moving clockwise.

Offsets to points in the cells around an existing cell. Note that the lower-left point is the same as the index to the cell
the upper right points is +1,+1 from the cell index

The Point Offset arrays provide indexes to the points that are at the corners of the cell. This starts in the top-right and moves clockwise. The Point Offset arrays index the points that are at the end of a segment that is common with an adjancet cell using the same index. Taking the Index-1 provides the segment at the start of the segment that is common.


Adding the Origin Cells

Adding cells starts by adding the four cells that surround the origin. If these cells cannot be added, creating the desired bounds fails.

1. Finding the first inside cell

2. Adding the other 3 origin cells

Adding Additional Cells

The CellOffsets arrays are used to go "around" the target cell to find the first adjancet cell that is INSIDE the existing Desired Bounding Polygon. This sets:

Check Cell

1. Find the number of OUTSIDE cells that are on adjacent sides of the target cell

1.1 Find the first inside cell

1.2 Find the first outside cell after the first inside cell

Sets StartOutsidePointIndex

1.2 Finding the NumSidesOutside

Going from the Index, we continue around the target cell to find the last side that is shared with a cell that is INSIDE and the first side that is not INSIDE (i.e. OUTSIDE or UNKNOWN). This sets:

2. Checks for all values of NumSidesOutside

2.1 If there is One Outside Cell (NOTCH or CANYON)

  1. If there is a cell oppositte the one we found that is inside
    1. Don't add the cell

2.2 Check for intersections

If any of the sides that have an adjacent cell that is outside intersect the existing bounding polygon, we cannot make the cell INSIDE.

3. If there are two outside adjancet cells

3.1 One outside adjacent cell (NOTCH)

  1. Check for distance distortion
  2. Delete the two points on the inside of the NOTCH

Issue: Do we need to check for intersectinos with the bounds?

3.2 Two outside adjancent cells (GLEN)

 

For this case, there will be one new point that is added and one removed. This is implemented as moving the point.

  1. Do not move the point if:
    1. The new point is within the existing Desired Bounding Polygon
    2. The Distance Distortion is outside the desired limits
    3. The point is already in the bounds points (could happen when the projected space loops around on itself

4.3 If there are three outside adjacent cells (PLATEAU)

Do not add the points if:

  1. The new points are within the existing Desired Bounding Polygon
  2. The Distance Distortion is outside the desired limits
  3. The point is already in the bounds points (could happen when the projected space loops around on itself)
  4. The new segments intersect with each other