Monday, January 22, 2007

Drawing Intersections - Part 1



To draw a road, Road Maker has to determine how to draw the center of the road, the edges, the cut and fill, and the various road lines. Adding an intersection makes it even more complex as everything has to fit together. It would be easy for me to stick to a single road but allowing intersections will provide more options for the artist.

The roads in Road Maker are drawn twice - once in outline form in the Draw Road window and then once in grayscale form in the Image with Road window. This is done to speed up design, as the grayscale roads are slower to create than the outline version. I've mostly finished up the first part, which draws the intersection in the Draw window. The even harder part, the grayscale intersection, is yet to come.

It took longer than I expected to adjust the code (it always does!) but I mostly have it working. There's still a particular road size which cause lines to be drawn to the upper left corner but I should be able to track that down. Mostly I had to modify existing code to add in exceptions (if this is true, then do this, else do this other thing). I've tried to craft the code so it's flexible for the future. For example, the basic road outline code will also be able to do curbing, fencing, telephone poles, guardrails, etc.

Here's an image of the outline drawing of the intersection. Doesn't look like much now but hopefully I'll be able to show a grayscale version soon.

No comments: