2

I'm curious what kind of algorithm can calculate the country's borderline, according to it's cities, buildings, and of course nearby city's and building's radius?

Strategy

Picture from the game "Rise of Nations": enter image description here

And how can one render this shape with lines or triangle strips (With 5m width for example)? How to get the points's coordinates from the borderline in good order? How it works in games?

Thanks.

Z4urce
  • 438
  • 4
  • 14
  • A good example I think is to look at how Civ5 does it. The map is split into hexes. When you look at the borders, you'll notice it uses the hex borders, but smoothed out, to give it the appearance of a natural border. – Steven Mills Jan 22 '14 at 12:47
  • But if you have a square shaped grid (assuming your buildings are square shaped, as most of the buildings) how can you compare the two different grid system, to get the borderline? – Z4urce Jan 22 '14 at 13:13
  • I think what you're trying to do is draw a [Bezier Curve](http://en.wikipedia.org/wiki/B%C3%A9zier_curve) by using the points of the squares along the border. Here's an article I found that might help: http://www.codeproject.com/Articles/25237/Bezier-Curves-Made-Simple – Steven Mills Jan 22 '14 at 13:52

1 Answers1

2

One way to do this is to use all the points of interest on the map and generate a Voronoi diagram.

http://en.wikipedia.org/wiki/Voronoi_diagram

There are some different algorithms to chose from, such as Fortune's algorithm.

http://en.wikipedia.org/wiki/Fortune%27s_algorithm

There are also other posts regarding this on SO.

Easiest algorithm of Voronoi diagram to implement?

Community
  • 1
  • 1
Martin G
  • 17,357
  • 9
  • 82
  • 98