Click here to Skip to main content
12,406,098 members (37,649 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# WPF Algorithms
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 ?
Posted 8-Jan-13 21:52pm
L Viljoen5.1K
Comments
Sandeep Mewara 9-Jan-13 4:01am
   
What have you tried so far? Any effort?

1 solution

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

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
Web02 | 2.8.160726.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2016
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