算法:从邻接表视觉地图算法、视觉、地图

2023-09-11 04:26:23 作者:看着你的脸、我情何以堪

我正在写一个风险状棋盘游戏在Java中。一个特点是,玩家可以设计自己的地图,他们存放在一个文本文件中。该文本文件列出了世界地图,随后由他们直接相邻的所有领土(==国家)。本场比赛然后扫描文件,并与它们对应的邻接表创建领地的集合。

I'm writing a Risk-like board game in java. A feature is that players can design their own maps which they store in a text file. The text file lists all territories (== countries) in the world map followed by their direct neighbors. The game then scans the file and creates a collection of the territories with their corresponding adjacency lists.

下一步将是这个图形转化为图形重新presentation。这意味着,我想通过一个矩形或其他一些简单的形状重新present各地区。我并不想进入领土之间复杂的,尖锐的边界呢。所以基本上领土看起来像一些非洲和北美国家的水平和垂直边界。

The next step would be to translate this graph into a graphical representation. That means I want to represent each territory by a rectangle or some other simple shape. I don't want to go into complex, edgy borders between territories yet. So basically the territories will look like some African or North American nations with horizontal and vertical borders.

现在我的问题是:尽管它会很容易想象那里的边界被重新通过它们之间画边psented $ P $的图,我发现很难把领土(==顶点)直接相邻的。换句话说领土应该摸对方,就像在现实世界中。

Now my problem is: While it would be easy to visualize a graph where the borders are represented by drawn edges between them, I find it difficult to place the territories (== vertices) directly adjacent to each other. In other words the territories should "touch" each other, like in the real world.

在特定的,这是因为这样的地方,彼此(考虑四个角落在美国亚利桑那州,科罗拉多州,新墨西哥州和犹他州)。

In particular, it is difficult because of such places where 4 or more territories border with each other (Consider Four Corners in USA with Arizona, Colorado, New Mexico, and Utah).

现在我想知道是否有人曾经试图做同样的事情,或者甚至有现有的处理这个问题的算法。我想AP preciate任何帮助和创造性投入。谢谢!

Now I was wondering if anybody ever tried to do something similar or if there are even existing algorithms dealing with this problem. I would appreciate any help and creative input. Thanks!

推荐答案

GMAP 正是我想要的。他们结合了多种技术,包括Voronoi图(这里的算法纸)。现在我只需要弄清楚如何得到它?

GMap is exactly what I want. They're combining a variety of techniques, including Voronoi diagrams (here's a paper on the algorithm). Now I just have to figure out how to get it...