core/util library

Functions

abs(num val) num
backtrace(dynamic node) List
Backtrace according to the parent records and return the path. (including both start and end nodes) @param {Node} node End node @return {Array.<Array.
biBacktrace(dynamic nodeA, dynamic nodeB) → dynamic
Backtrace from start and end node, and return the path. (including both start and end nodes) @param {Node} @param {Node}
getLine(dynamic x0, dynamic y0, dynamic x1, dynamic y1) → dynamic
Given the start and end coordinates, return all the coordinates lying on the line formed by these coordinates, based on Bresenham's algorithm. http://en.wikipedia.org/wiki/Bresenham's_line_algorithm#Simplification @param {number} x0 Start x coordinate @param {number} y0 Start y coordinate @param {number} x1 End x coordinate @param {number} y1 End y coordinate @return {Array.<Array.
pathLength(dynamic path) → dynamic
Compute the length of the path. @param {Array.<Array.
smoothenPath(dynamic grid, dynamic path) → dynamic
Smoothen the give path. The original path will not be modified; a new path will be returned. @param {PF.Grid} grid @param {Array.<Array.