Does the following simulation is what you need?

You can drag S,P to different location.
The red segments show the path which is shertest distance (or smallest time value).

translate strings in simulation to different language format before download
Full screen applet or Problem viewing java?Add to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
Download EJS jar file(1005kB):double click downloaded file to run it. (7 times by 6 users) , Download EJS source View EJS source