Returns the node coordinate in the given direction at the given tile identifier.

    :param tile_id: tile identifier, int
    :param direction: direction, str
    :return: node coord, int
776413
def node_coord_in_direction(tile_id, direction):
    
    tile_coord = tile_id_to_coord(tile_id)
    for node_coord in nodes_touching_tile(tile_id):
        if tile_node_offset_to_direction(node_coord - tile_coord) == direction:
            return node_coord
    raise ValueError('No node found in direction={} at tile_id={}'.format(
        direction,
        tile_id
    ))
1258468
public static int findEdge(Poly node, Poly neighbour, MeshData tile, MeshData neighbourTile) {
		// Compare indices first assuming there are no duplicate vertices
		for (int i = 0; i < node.vertCount; i++) {
			int j = (i + 1) % node.vertCount;
			for (int k = 0; k < neighbour.vertCount; k++) {
				int l = (k + 1) % neighbour.vertCount;
				if ((node.verts[i] == neighbour.verts[l] && node.verts[j] == neighbour.verts[k])
						|| (node.verts[i] == neighbour.verts[k] && node.verts[j] == neighbour.verts[l])) {
					return i;
				}
			}
		}
		// Fall back to comparing actual positions in case of duplicate vertices
		for (int i = 0; i < node.vertCount; i++) {
			int j = (i + 1) % node.vertCount;
			for (int k = 0; k < neighbour.vertCount; k++) {
				int l = (k + 1) % neighbour.vertCount;
				if ((samePosition(tile.verts, node.verts[i], neighbourTile.verts, neighbour.verts[l])
						&& samePosition(tile.verts, node.verts[j], neighbourTile.verts, neighbour.verts[k]))
						|| (samePosition(tile.verts, node.verts[i], neighbourTile.verts, neighbour.verts[k])
								&& samePosition(tile.verts, node.verts[j], neighbourTile.verts, neighbour.verts[l]))) {
					return i;
				}
			}
		}
		return -1;
	}
117487
def ladderize(self, direction=0):
        
        nself = deepcopy(self)
        nself.treenode.ladderize(direction=direction)
        nself._fixed_order = None
        nself._coords.update()
        return nself
129870
private String getDirectionString(String direction) {
        if (direction == null || !(direction.equals("Start") || direction.equals("End"))) {
            getLogger().debug("Unrecognized direction string. The standard value 'Start' will be used.");
            return "Start";
        }
        return direction;
    }
1366565
def coord(self, offset=(0,0)):
		''''''
		(tilex, tiley) = self.tile
		(offsetx, offsety) = offset
		world_tiles = 1<<self.zoom
		x = ( tilex + 1.0*offsetx/TILES_WIDTH ) / (world_tiles/2.) - 1
		y = ( tiley + 1.0*offsety/TILES_HEIGHT) / (world_tiles/2.) - 1
		lon = x * 180.0
		y = math.exp(-y*2*math.pi)
		e = (y-1)/(y+1)
		lat = 180.0/math.pi * math.asin(e)
		return (lat, lon)
1056789
def line_id(self, lat):
        ''' 

        '''
        if self.grid == 'WAC':
            line = np.rint(1.0 + self.LINE_PROJECTION_OFFSET -
                           self.A_AXIS_RADIUS * np.pi * lat / (self.MAP_SCALE * 1e-3 * 180))
        else:
            line = np.rint(float(self.LINE_PROJECTION_OFFSET) - float(self.MAP_RESOLUTION)
                           * (lat - float(self.CENTER_LATITUDE))) + 1
        return self._control_line(line)
369450
function(tile) {
    var x = tile.x;
    var y = tile.y;
    var xUp = x + 1 < xUpperBound;
    var xDown = x >= 0;
    var yUp = y + 1 < yUpperBound;
    var yDown = y >= 0;

    var adjacents = [];
    if (xUp) {
      adjacents.push({x: x + 1, y: y});
      if (yUp) {
        adjacents.push({x: x + 1, y: y + 1});
      }
      if (yDown) {
        adjacents.push({x: x + 1, y: y - 1});
      }
    }
    if (xDown) {
      adjacents.push({x: x - 1, y: y});
      if (yUp) {
        adjacents.push({x: x - 1, y: y + 1});
      }
      if (yDown) {
        adjacents.push({x: x - 1, y: y - 1});
      }
    }
    if (yUp) {
      adjacents.push({x: x, y: y + 1});
    }
    if (yDown) {
      adjacents.push({x: x, y: y - 1});
    }
    return adjacents;
  }
1082207
def tilequeue_tile_status(cfg, peripherals, args):
    
    logger = make_logger(cfg, 'tile_status')

    # friendly warning to avoid confusion when this command outputs nothing
    # at all when called with no positional arguments.
    if not args.coords:
        logger.warning('No coordinates given on the command line.')
        return

    # pre-load TOI to avoid having to do it for each coordinate
    toi = None
    if peripherals.toi:
        toi = peripherals.toi.fetch_tiles_of_interest()

    # TODO: make these configurable!
    tile_format = lookup_format_by_extension('zip')
    store = _make_store(cfg)

    for coord_str in args.coords:
        coord = deserialize_coord(coord_str)

        # input checking! make sure that the coordinate is okay to use in
        # the rest of the code.
        if not coord:
            logger.warning('Could not deserialize %r as coordinate', coord_str)
            continue

        if not coord_is_valid(coord):
            logger.warning('Coordinate is not valid: %r (parsed from %r)',
                           coord, coord_str)
            continue

        # now we think we probably have a valid coordinate. go look up
        # whether it exists in various places.

        logger.info("=== %s ===", coord_str)
        coord_int = coord_marshall_int(coord)

        if peripherals.inflight_mgr:
            is_inflight = peripherals.inflight_mgr.is_inflight(coord)
            logger.info('inflight: %r', is_inflight)

        if toi:
            in_toi = coord_int in toi
            logger.info('in TOI: %r' % (in_toi,))

        data = store.read_tile(coord, tile_format)
        logger.info('tile in store: %r', bool(data))
1210385
def get_direction(self, direction, rev=False):
        
        if (direction < 90.0) or (direction >= 270.0):
            if not rev:
                return 'up'
            else:
                return 'down'
        elif (90.0 <= direction < 270.0):
            if not rev:
                return 'down'
            else:
                return 'up'
        else:
            return 'none'
9192
def direction(direction, allow_bi=False):
    
    valid = [Direction.CAUSE, Direction.EFFECT]
    if allow_bi:
        valid.append(Direction.BIDIRECTIONAL)

    if direction not in valid:
        raise ValueError('`direction` must be one of {}'.format(valid))

    return True
834109
def arrow(self, JOIN, _id):
        """"""
        r = JOIN
        for node in self.lattice.get_elements(JOIN):
            if node.left_hand_side == _id:
                r = r ^ self.lattice.el2bv[node]
        return r
18148
function getCoordinates(location) {
  var tile_width = 40;
  var x = location.r * tile_width;
  var y = location.c * tile_width;
  return {x: x, y: y};
}
472362
def coastal_coords():
    
    coast = list()
    for tile_id in coastal_tile_ids():
        tile_coord = tile_id_to_coord(tile_id)
        for edge_coord in coastal_edges(tile_id):
            dirn = tile_edge_offset_to_direction(edge_coord - tile_coord)
            if tile_id_in_direction(tile_id, dirn) is None:
                coast.append((tile_id, dirn))
    # logging.debug('coast={}'.format(coast))
    return coast
827515
def get(self, node_id):
        
        return \
            self._nodes[_node.Root.ID].get(node_id) or \
            self._nodes[_node.Root.ID].get(self._sid_map.get(node_id))
492433
function getDirection(x, y) {
  if (x === y) {
    return DIRECTION_NONE;
  }

  if (abs(x) >= abs(y)) {
    return x > 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
  }
  return y > 0 ? DIRECTION_UP : DIRECTION_DOWN;
}
246785
function(currentDirection){
            var directions = ['up', 'right', 'down', 'left'],
                currentDirIndex = directions.indexOf(currentDirection),
                newDirIndex;
            // if currentDirection is not valid or is the last in the array use the first direction in the array
            if(currentDirIndex === -1 || currentDirIndex === directions.length - 1){
                newDirIndex = 0;
            } else {
                newDirIndex = currentDirIndex + 1;
            }
            return directions[newDirIndex];
        }
411181
def get_tile_url(self, zoom, x, y):
        
        return self.tile_url.format(**{"$z": zoom, "$x": x, "$y": y})