If on a 2d plane there are a no. of obstacles of all possible 2d shapes(circles, quadrilaterals, triangles, irregular shapes...) then how do you implement a mechanism to find the shortest path around the obstacles? I'm considering visual c++, as it provides many graphical classes to draw such figures.

I have come quite far

1) Firstly i'll be using A\* search(A-star) to find the path with least cost

2) The path with the least displacement from the straight path will be considered for best path. (not really sure though)

3) The shortest path to get around a figure, for eg from the start, is a line from that point to :

```
a) the farthest vertex in case of a polygon/quadrilateral
b) a point on the circumference such that the line drawn would be tangential to the circle, in case of a circle or arc
c) (not sure about irregular figures)

```

![enter image description here](https://i.stack.imgur.com/O7M8u.png)

---

Now coming back to the 2) point- least displacement between 2 or more paths can be determined by comparing perpendiculars from those lines to the farthest points of an object on their respective sides. (hope i've made myself understood) . 

So then- how do we draw perpendiculars to the straight path? ![enter image description here](https://i.stack.imgur.com/8sNp7.png)

*x1,x2,y1,y2,k and l* are known. We just have to find *a,b*.

Slope of the straight path \* slope of it's perpendicular = -1

```
=> (y2-y1)/(x2-x1) * (b-l)/(1-k) = -1
hence, b = [(x1-x2)/(y2-y1) * (a-k)] + l

```

I've imagined that by using pythagoras theorem we can find the other equation in terms of the co-ordinates. The lengths of each line can be found by this way: 
 dx = x1-x2
 dy = y1-y2
 dist = sqrt(dx*dx + dy*dy) 

And then by solving these 2 eqns we can find the correct values of *a,b*.

---

I can't think of anything further- any ideas or suggestions?