Original Post
Hi, The situation is fairly simple: Given a list of line segments, calculate the shortest path from a point A to a point B. This sounds really simple, however I am having a lot of trouble with it. My current algorithm: - Create a new line segment from point A to point B - Loop through all the line segments (or a part of them, determined by RDC/BIN/...) - If the created line intersects an existing line segment, calculate the shortest deviation (either below/above/left/right from the segment) and apply the method from 'start' to 'new point' and from 'new point' to end. To make this more clear, I've added some pseudocode:
calculate(start,end)
{
for(i->obstacles.length)
{
if(collide(start,end,obstacle))
{
newPoint = getDeviation(start,end,obstacle)
path = calc(start,newPoint)
path += newPoint
path += calc(newPoint,end)
return path
}
return start + end;
} Can anyone point me in the right direction ? All help is welcome! :) [Edited by - DauntlessCrowd on November 13, 2008 4:00:43 PM]