Skip to content
Raminder Singh edited this page May 29, 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 
  }),

AStarFinder Source code

  BreadthFirstFinder: function({
    allowDiagonal: Boolean, 
    dontCrossCorners: Boolean
  }),

BreadthFirstFinder Source code

  BestFirstFinder: function({
    allowDiagonal: Boolean, 
    dontCrossCorners: Boolean, 
    heuristic: Function 
  }),

BestFirstFinder Source code

  DijkstraFinder: function({
    allowDiagonal: Boolean, 
    dontCrossCorners: Boolean
  }),

DijkstraFinder Source code

  BiAStarFinder: function({
    allowDiagonal: Boolean, 
    dontCrossCorners: Boolean, 
    heuristic: Function 
  }),

BiAStarFinder Source code

  BiBestFirstFinder: function({
    allowDiagonal: Boolean, 
    dontCrossCorners: Boolean, 
    heuristic: Function 
  }),

BiBestFirstFinder Source code

  BiDijkstraFinder: function({
    allowDiagonal: Boolean, 
    dontCrossCorners: Boolean
  }),

BiDijkstraFinder Source code

  BiBreadthFirstFinder: function({
    allowDiagonal: Boolean,
    dontCrossCorners: Boolean
  }),

BiBreadthFirstFinder Source code

  JumpPointFinder:  function({
    heuristic: Function 
  }),

JumpPointFinder Source code

  OrthogonalJumpPointFinder:  function({
    heuristic: Function 
  }),

OrthogonalJumpPointFinder Source code

  IDAStarFinder:  function({
    allowDiagonal: Boolean, 
    dontCrossCorners: Boolean, 
    heuristic: function 
  }),

IDAStarFinder Source code

  Heuristic: {
    manhattan: function(dx, dy){ return dx + dy } (default)
    chebyshev: function(dx, dy){ return Math.max(x, y) },
    euclidean: function(dx, dy){ return Math.sqrt(dx*dx + dy*dy) },
  },

Heuristic Source code

  Grid: function(width, height, [walkableMatrix]){
    nodes: Array,
    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}
  },

Grid Source code

  Node: function(x, y, walkable) { 
    x: Number,
    y: Number,
    walkable: Boolean, 
    closed: Boolean,
    opened: Boolean,
    tested: Boolean        
  },

Node Source code

  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 } 
  },

Util Source code

  Heap: A binary heap implementation in CoffeeScript/JavaScript ported from Python's heapq module.

Heap Source code

}

PathFinding Source code

Clone this wiki locally