-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Home
rafaelcastrocouto edited this page Jan 15, 2014
·
4 revisions
Welcome to the PathFinding.js wiki!
After including this line in your node server...
var PF = require('pathfinding');
...or this line in your client website...
<script type="text/javascript" src="http://qiao.github.io/PathFinding.js/lib/pathfinding-browser.min.js"></script>
...the PathFinding.js library will be available through the "PF" object.
PF = {
AStarFinder: function({
allowDiagonal: Boolean,
dontCrossCorners: Boolean,
heuristic: Function
}),
BreadthFirstFinder: function({
allowDiagonal: Boolean,
dontCrossCorners: Boolean
}),
BreadthFirstFinder Source code
BestFirstFinder: function({
allowDiagonal: Boolean,
dontCrossCorners: Boolean,
heuristic: Function
}),
DijkstraFinder: function({
allowDiagonal: Boolean,
dontCrossCorners: Boolean
}),
BiAStarFinder: function({
allowDiagonal: Boolean,
dontCrossCorners: Boolean,
heuristic: Function
}),
BiBestFirstFinder: function({
allowDiagonal: Boolean,
dontCrossCorners: Boolean,
heuristic: Function
}),
BiDijkstraFinder: function({
allowDiagonal: Boolean,
dontCrossCorners: Boolean
}),
BiBreadthFirstFinder: function({
allowDiagonal: Boolean,
dontCrossCorners: Boolean
}),
BiBreadthFirstFinder Source code
JumpPointFinder: function({
heuristic: Function
}),
IDAStarFinder: function({
allowDiagonal: Boolean,
dontCrossCorners: Boolean,
heuristic: function
}),
Heuristic: {
chebyshev: function(dx, dy){ return Math.max(x, y) },
euclidean: function(dx, dy){ return Math.sqrt(dx*dx + dy*dy) },
manhattan: function(dx, dy){ return dx + dy }
},
Grid: function(width, height, [walkableMatrix]){
width: Number,
heigth: Number,
clone: function (){ return a new grid clone },
getNeighbors: function (node, allowDiagonal, dontCrossCorners){ return walkable neighbors },
getNodeAt: function (x, y){ return grid.nodes[y][x] },
isInside: function (x, y){ return true if point is inside grid area },
isWalkableAt: function (x, y){ return true if point is walkable },
setWalkableAt: function (x, y, Boolean) { grid.nodes[y][x].walkable = Boolean}
},
Node: function(x, y, walkable) {
x: Number,
y: Number,
walkable: Boolean,
closed: Boolean,
opened: Boolean,
tested: Boolean
},
Util: {
backtrace: function(node){ return reversed path },
biBacktrace: function(nodeA, nodeB){ return pathA.concat(pathB.reverse) },
expandPath: function(path){ return a new path with all segments interpolated },
interpolate: function(x0, y0, x1, y1){ return a line based on Bresenham's algorithm }
pathLength: function(path){ return path.length } ,
smoothenPath: function(grid, path){ return a new smoothed path }
},
Heap: A binary heap implementation in CoffeeScript/JavaScript ported from Python's heapq module.
}