bolson: (Default)
I wrote my own rasterizer. Given some loops of points, yield pixels. I probably didn't do it in the most efficient way, but on the plus side I got to run exactly the code I wanted over every pixel, yielding a somewhat unusual setup where every pixel is associated with a 64 bit key, rather than a color (they key is used to look up the color later. rasterize once, color many). On the down side, there are annoying corner cases that a rugged rigorous library would have taken care of, like what happens when the scan line happens to exactly intersect a point. In my code this can lead to either under-counting or over-counting of that intersection. Uf. Fix it eventually, worked around for now by winding up leaving that scan line blank out of the offending polygon.
bolson: (Default)
I did finally wrestle the census map data into something useable and I wrote up the code to rasterize it. This really does help:

before: after:

And a big png map of CA congressional districts

When you look at the big map it shows that my rasterizing is still missing a few pixels here and there and sometimes whole triangles it looks like. Also the map has lost the information about what regions are water. So, the whole SF bay has disappeared. That and some major cities would be some nice landmarks to add.

[Update Sun, 5:12 PT] Fixed the triangle rendering problem. It's even prettier now, but still has no water or cities.
bolson: (Default)
I'm trying to make my redistricting output prettier, but it isn't easy.
rant about the Census map data's file format )


bolson: (Default)

September 2017

1011121314 1516


RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 20th, 2017 06:04 pm
Powered by Dreamwidth Studios