gaffkins / as3pathfinder

Automatically exported from code.google.com/p/as3pathfinder
0 stars 0 forks source link

diag = false do not return any Points #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. The code I have provided do not return any Points.
2.
3.

What is the expected output? What do you see instead?
An array with non diagonal points / An empty Array.

What version of the product are you using? On what operating system?
1.2 / W7

Please provide any additional information below.
First thing first. Great job with Dijkstra's algorithm!
Well, maybe I have misunderstood something here but I need to get the 
Points/steps between A & B. When I pass in "diag = true" it seems to work, but 
when I pass in false the getPath() function do not return any points. Any 
suggestions? Thanks!

var map:Array = [[0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
         [0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
         [0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
         [0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
         [0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
         [0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
         [0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
         [0, 0, 1, 1, 0, 0, 0, 0, 0, 0]];

var pt:Pathfinder = new Pathfinder();           
pt.loadMap(map, 10, 10);
var path:Array = pt.getPath(new Point(1, 1), new Point(8, 8), false);    

Original issue reported on code.google.com by ralf.him...@gmail.com on 20 Oct 2011 at 3:29

GoogleCodeExporter commented 8 years ago
Just uploaded version 1.3 should work with your example... pretty strange there 
was a bug that I never saw before.... Thanks!

Original comment by avetis.z...@gmail.com on 23 Dec 2011 at 10:24

GoogleCodeExporter commented 8 years ago
I am using the above example, it works
except for if i change this line

var path:Array = pt.getPath(new Point(1, 1), new Point(8, 8), false);
to
var path:Array = pt.getPath(new Point(0, 0), new Point(9, 9), false);

I want to get the path from one corner to the other, it returns
"TypeError: Error #1010: A term is undefined and has no properties.
    at Pathfinder/getPathArray()
    at Pathfinder/getPath()"

Which is 'if (i < dimensionX && tmpMap[i + 1][j] == iteration)'

The tmpMap[i + 1][j] is empty, it applies to most if functions in the 
getpatharray because with some paths, tiles next to the destination are 
non-existant, is there a quick fix for this?

Thank you

Original comment by crisyfal...@gmail.com on 1 Jan 2015 at 10:31