Skip to content

Instantly share code, notes, and snippets.

View dmcglone's full-sized avatar

Daniel McGlone dmcglone

  • Azavea
  • Philadelphia
View GitHub Profile
@dmcglone
dmcglone / README.md
Created October 14, 2019 19:24 — forked from veltman/README.md
Redistricting

Old vs. new proposed North Carolina congressional districts, data via WRAL.

Polygons were pre-processed for gentler animation as follows:

  1. For each district, find the difference n in the number of vertices between the old and new district.
  2. Add n vertices to whichever one has fewer, evenly spaced along the existing polyline, so the old and new shape each have the same number of vertices (not great for performance).
  3. For each pair of old/new district, wind the old district around to minimize the sum of the squared distances between point index i in the old district and point index i in the new district.