找到点的最短路径 [英] Finding Shortest path to points

查看:127
本文介绍了找到点的最短路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在寻找一种在两个盒子之间绘制连接器的方法,它将在两个盒子之间绘制最短的非碰撞路径而不会与其他盒子碰撞



说我想从表格上的第25,10点画出一条路径并点200,225



这条线应该避免他们之间的任何和所有方框

规则是该线可以在x或y轴上增加/减少而不是两者(也就是说没有vet​​ors)



有人能给我一个快速简单的算法吗?

解决方案

Hello Chona1171,



针对您的问题,最常见的解决方案算法是使用 Dijkstra'的算法



点击阅读 Dijkstra'的算法



有''这是CodeProject中的好文章:

C# - 使用Dijkstra,AStar,双向Dijkstra和双向A *算法可视化路径查找 [ ^ ]

Hi
I am looking for a way to draw a connector between two boxes that will draw the shortest non colliding path between two boxes without colliding with other boxes

say I want to draw a path from point 25,10 on the form and point 200,225

and this line shoudl avoid any and all boxes between them
also the rule is that the line can ony incremennt/decrememnet on the x or y axis not both (as to say no vetors)

can anyone give me a quick easy algorithm to do this ?

解决方案

Hello Chona1171,

A most common solution algorithm for your problem is to use the Dijkstra''s Algorithm.

Click to read about Dijkstra''s Algorithm

There''s this nice article in CodeProject:
C# - Visualizing Path Finding With Dijkstra, AStar, Bi-directional Dijkstra''s, and Bi-directional A* Algorithms[^]


这篇关于找到点的最短路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆