Click here to Skip to main content
13,006,226 members (66,720 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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 ?
Posted 8-Jan-13 21:52pm
L Viljoen5.2K
Sandeep Mewara 9-Jan-13 4:01am
What have you tried so far? Any effort?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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[^]
Espen Harlinn 10-Jan-13 9:56am
Nice reply :-D
jibesh 10-Jan-13 19:07pm
True. 5+
Herbisaurus 18-Aug-13 2:39am
Nice answer!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170628.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100