在 2D 地图上生成区域

发布于 2024-09-25 03:57:07 字数 61 浏览 3 评论 0原文

有没有什么好的方法来生成二维地图的区域?假设您有一张世界地图,并且想要创建具有某种现实外观的国家或省份边界。

Are there any good approaches to generating regions for a 2D map? Suppose you have a world map and would like to create country or province borders with a somewhat realistic look.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

初心 2024-10-02 03:57:07

我最近发现了这篇博文(及其两篇后续文章),我认为它与您正在寻找的内容非常接近。

http://simblob.blogspot.com/2010/09 /polygon-map- Generation-part-1.html

他正在使用他的方法来创建逼真的景观,但希望您能看到使用相同技术将区域分组为可信区域的方法。

I found this blog post (and its two successors) recently, and I think it's quite close to what you're looking for.

http://simblob.blogspot.com/2010/09/polygon-map-generation-part-1.html

He's using his methods to create realistic landscapes but hopefully you can see ways to use the same techniques to group areas into believable regions.

月依秋水 2024-10-02 03:57:07

使用 Voroni 图 进行镶嵌是一种方法,虽然形状可以变得非常不规则,但它是不太现实。

Tessellation using a Voroni diagram is one approach, and whilst the shapes can be made quite irregular, it is not very realistic.

灯角 2024-10-02 03:57:07

马丁·卡尔曼的想法似乎是最好的方法,因为你没有自然地形来定义一些边界。在您的边界内生成随机点,然后将它们纳入国家边界。我可能会更进一步,比所需的国家/地区提出更多的点,然后合并几个相邻的单元格以使一些结果区域凹入。您可以使用类似于随机 Kruskal 的算法来执行合并(获取所有国家/地区,合并两个相邻国家/地区,重复直到获得所需的总数)。我无法访问 Kylotan 的链接,但它可能描述了一种更好的方法来合并由 Voronoi 生成的单元格。

Martin Källman's idea seems the best way to do it since you don't have natural terrain to define some of the borders. Generate random points within your borders and then Voronoi them into country borders. I would probably take it one step further and make more points than desired countries, and then merge several adjacent cells to make some of the resulting areas concave. You could use an algorithm similar to a randomized Kruskal to perform the merging (take all the countries, merge two adjacent countries, repeat until you have the desired total). I can't get to Kylotan's link, but it may describe a better way to merge the cells generated by the Voronoi.

依 靠 2024-10-02 03:57:07

我会使用可编写脚本/可编程 CAD 或矢量图包来手动绘制形状,然后使用自定义脚本将数据处理为自定义数据文件或直接处理为源代码。事实上,我过去曾多次这样做过(通常是生成 VB.NET 代码,用于从 CAD 线条图创建 GraphicsPath 对象)。

你能说得更具体一些吗?这些区域需要什么样的格式?您已经拥有什么类型的数据?

I'd use a scriptable/programmable CAD or Vector illustration package to draw the shapes by hand, then process the data with a custom script into custom data files or directly into source code. In fact I have done this a number of times in the past (usually to generate VB.NET code for creating GraphicsPath objects from CAD line drawings).

Could you be more specific? What kind of format do these regions need to have? What kind of data do you already have?

悲念泪 2024-10-02 03:57:07

我最近发现一个链接,其中涵盖了生成 3D 景观。您可能会在那里找到一些想法。基本要点似乎是使用 1/f 随机噪声;只看一下图片,这似乎比 Voronoi 图方法更现实(我假设您正在尝试生成任意“国家”轮廓,而不是尝试遵循任何现实世界的数据)。

I recently came across a link that covers generating 3D landscapes. You might find some ideas there. The basic gist seems be using 1/f random noise; just glancing at the pictures this seems more realistic than the Voronoi diagram approach (I assume you're trying to generate arbitrary "country" outlines, not trying to follow any real world data).

感悟人生的甜 2024-10-02 03:57:07

一种可能的(部分)解决方案是在随机点之间进行大量路径检查。许多路径聚集的区域表示阻塞点,这是“旅行者”必须经过的物理位置。这些点很适合用作国家之间的分隔符。

纪尧姆

One possible (and partial) solution is to do a lot of path check between to random point. Zone where a lot of pathway are grouped indicate a chokepoint, that is a physical where "traveler" would have to go throught. Those point are good to use as separator between country.

Guillaume

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文