code: public NavMesh build(TileBasedMap map, boolean tileBased) {
  		this.tileBased = tileBased;
  		
  		ArrayList spaces = new ArrayList();
  		
  		if (tileBased) {
  			for (int x=0;x<map.getWidthInTiles();x++) {
  				for (int y=0;y<map.getHeightInTiles();y++) {
  					if (!map.blocked(this, x, y)) {
  						spaces.add(new Space(x,y,1,1));
  					}
  				}
  			}
  		} else {
  			Space space = new Space(0,0,map.getWidthInTiles(),map.getHeightInTiles());
  		
  			subsection(map, space, spaces);
  		}
  		
  		while (mergeSpaces(spaces)) {}
  		linkSpaces(spaces);
  		
  		return new NavMesh(spaces);
  	}
docs: Build a navigation mesh based on a tile map
  
  @param map The map to build the navigation mesh from
  @param tileBased True if we'll use the tiles for the mesh initially
  rather than quad spacing
  @return The newly created navigation mesh