在表示为二维形状的地图中搜索最短路径

发布于 2024-08-30 09:10:01 字数 258 浏览 7 评论 0原文

我有一个包含一些最短路径搜索算法的小型库。它们是为简单的无向图(正常表示 - 顶点和边)而开发的。现在我想以某种方式将它们应用到稍微不同的场景 - 其中地图表示为二维形状,通过共享边(即多边形的边)连接。在这种情况下,搜索可以在地图对象或某个点 (x,y) 处开始/结束。最好的方法是什么?尝试将算法应用到形状上?或者尝试从形状中提取“正常”图形(我有可用的预处理时间)?任何建议将不胜感激,因为我真的不确定该走哪条路,而且我没有足够的时间(和技能)来探索许多选择......

非常感谢

I have a small library of a few shortest path search algorithms. They were developed for simple undirected graphs (the normal representation - vertices and edges). Now I'd like to somehow apply them on a bit different scenario - where the maps are represented as 2-dimensional shapes, connected by shared edges (edges of the polygons, that is). In this scenario, the search can start/end either at a map object or some point (x,y). What would be the best approach? Try to apply the algorithms onto shapes? or try to extract a 'normal' graph out of the shapes (I have preprocessing time available)? Any advice would be much appreciated, as I'm really not sure which way to go, and I don't have enough time (and skill) to explore many options...

Thanks a lot

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

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

发布评论

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

评论(1

遮了一弯 2024-09-06 09:10:01

您正在寻找的“路径”是什么?要遍历的形状列表? (否则,您只需在起点和终点之间绘制一条直线。)

很容易将其预处理为一种格式,其中形状是顶点,并且当形状共享多边形边时通过边连接。然后,只需将其传递给您现有的图书馆即可获得答案。

What's the "path" you're looking for? A list of the shapes to traverse? (Otherwise you just draw a straight line between start+end points.)

It's easy to preprocess it into a format where the shapes are vertices and are connected by edges when the shapes share a polygon side. Then, just pass it off to your existing library to get the answer.

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