# How does the districts painting work in cities skyline?

This is an example of what I am trying to ask
So to be specific, here is the questions that I want to ask

-How does the brushed area work?

-How does the boarder of the painted area work?

-How is the area painted/filled with color?

Thank you !!

that describes how to add and subtract two polygons (shapes) together.

In this case what happens if you have the existing district which is object one.

you have the new object which is a collection of all vertices the selection tool has already gone over and you boolean addition them together to create a new polygon.

likewise you can use subtraction to make the district smaller.

the border is just a border.

convex edge selection is easy. Concave is more difficult. Perhaps they just did it the difficult way because it is just a 2d plane so it’s quite possible they used brute force.

The alternative is they took the convex shape, convert it into N number of concave shapes and do edge selection on that. (i’d just do brute force unless it was too many vertices, I doubt this single shape is)

brute force basically means they go through each vertice on the plane, they select another one and then if all the other vertices are on one side of that line it’s an edge. if there are vertices on both sides its not.

so either all vertices should be greater than the smallest of the two points x and greater than the smallest of the two ppoints y. or the opposite. should all be smaller than.
it won’t take too long because the moemnt you find one thats greater than and also one thats smaller than you stop cause thats not an edge.

if it is an edge you take the two points and draw a darker/lighter line over the top of them to create the border.

once you have the polygon just assign it a texture to fill it with color.
Going into fill algorithms isn’t needed. there is a way, but the graphics card takes care of that.
you give it the polygon and the color and it’ll do it for you.