UndirectedPointGraph getExteriorCornersGraph()

Construct an UndirectedPointGraph from this Grids exterior corners.

The Graph is optimized to only hold adjacencies between exterior corners who are "line of sight" with each other, meaning there are no non-walkable nodes on the straight line between them.

Source

UndirectedPointGraph getExteriorCornersGraph() {
  List<PointNode> exteriorCorners = this.getExteriorCorners();

  UndirectedPointGraph exteriorCornersGraph = new UndirectedPointGraph();

  for (PointNode outerNode in exteriorCorners) {
    for (PointNode innerNode in exteriorCorners) {
      if (_isWalkableLine(outerNode, innerNode)) {
        exteriorCornersGraph.addAdjacency(outerNode, innerNode);
      }
    }
  }

  return exteriorCornersGraph;
}