tips to improve anti-aliasing/rendering
in
Programming Questions
•
3 years ago
Hi all;
As illustrated above, the edges of the neighbourhoods are jagged and uneven, and in some places (particularly in the outermost neighbourhoods in the northwest corner of the city) the border of the fill seems to exceed the stroke.
I'm fairly new to processing, and I'm working on a sketch that is meant to draw the neighbourhoods of my city and colour them based on various data (e.g. people per dwelling, population density, crime rate, etc.).
The neighbourhoods are drawn for every frame, ie:
- void draw() {
- // DRAW OBJECTS
- // neighbourhoods
- for(int i = 0; i < hoods.length; i++) { // neighbourhoods are stored in "hoods" array
- hoods[i].draw(dMode, maxMins); // each neighbourhood's "draw" method called here
- }
- }
The data for the outline of the neighbourhoods comes from a KML file provided by the city. Each neighbourhood's outline is defined by a series of points specified in terms of latitude and longitude, which my code converts to pixel values for rendering.
My problem is that the on-screen rendering doesn't look as great as I'd like it to:
As illustrated above, the edges of the neighbourhoods are jagged and uneven, and in some places (particularly in the outermost neighbourhoods in the northwest corner of the city) the border of the fill seems to exceed the stroke.
I thought that this may have had something to do with my data/algorithm, as there were some precision issues involved owing to the fact that coordinates were specified in latitude and longitude (in these terms, the span of the entire city is about 0.4 units, meaning the smallest neighbourhood features were being traced out in terms about 5-6 decimal points deep) and the inability of Processing to use doubles for plotting functions. To check this, I thought I'd plot the data using another method and see how that worked out. Below is a screenshot of a pdf generated using exactly the same algorithm:
This version looks much better, which suggests the problem probably isn't precision.Unfortunately, however, I have no idea what the heck the problem might be.
I've already enabled anti-aliasing, and I tried the other rendering engines available with Processing (and found that the default renderer works the best). So, I'm kind of stumped. Any suggestions to improve the quality of the first image -- to make it look more like the second image, essentially -- would be very much appreciated.
(And: bonus points for any suggestions on jazzing up this display a little bit; even the pdf version, though rendered acceptably, seems a bit flat).
Many thanks!
Josh
1