so I've been struggling to get the ShortestPathFinder as well as the DijkstraPathFinder working in many scenarios and by now I doubt that the implemented pathfinding algorithms (A* or rather based on that) work correctly. But perhaps it's just something I'm doing wrong, so here 2 examples with ShortestPathFinder (DijkstraPathFinder seems to work in even less cases for me):
I create a LineMap, then just create a ShortestPathFinder using that LineMap and call the .findeRoute() method. As the bounds Rectangle doesn't seem to work at all, I also decided to include the boundaries as 4 lines manually. This field's dimension is 100x50.
It works for a LineMap with the following Line[] array:
- Code: Select all
Line[] lines = {
new Line( -1, 0, 101, 0),
new Line(100, -1, 100, 51),
new Line(101, 50, -1, 50),
new Line( 0, 51, 0, -1),
new Line(20, 51, 20, 20),
new Line(45, -1, 45, 25),
new Line(70, 51, 70, 20)};
Start and end points of the route are these:
- Code: Select all
WayPoint start = new WayPoint(10, 30);
WayPoint end = new WayPoint(90, 10);
It looks like this:

Meanwhile this second example does NOT work, as on calling the .findeRoute() method the program seems to run in an endless loop.
- Code: Select all
Line[] lines = {
new Line( -1, 0, 101, 0),
new Line(100, -1, 100, 51),
new Line(101, 50, -1, 50),
new Line( 0, 51, 0, -1),
new Line(20, 51, 20, 20),
new Line(45, -1, 45, 25),
new Line(55, 51, 55, 20)}; // this one changed
// start end end points stay the same

As you see I already made sure the lines are intersecting oneanother so that the algorithm doesn't try to go through e.g. the corners. But still there are a lot of examples where the algorithm seems to end up in an endless loop.
I wanted to use this for a University project, where multiple teams are working on their own roboter and we're supposed to implement at least rudimentary pathfiding. Now all of the teams are struggling to get the PathFinders work.
Any help would be greatly appreciated!
