(from, endPoints)
| 475 | |
| 476 | // heuristic method to determine the distance between two points |
| 477 | function estimateCost(from, endPoints) { |
| 478 | |
| 479 | var min = Infinity; |
| 480 | |
| 481 | for (var i = 0, len = endPoints.length; i < len; i++) { |
| 482 | var cost = from.manhattanDistance(endPoints[i]); |
| 483 | if (cost < min) min = cost; |
| 484 | } |
| 485 | |
| 486 | return min; |
| 487 | } |
| 488 | |
| 489 | // find points around the bbox taking given directions into account |
| 490 | // lines are drawn from anchor in given directions, intersections recorded |