In case of external link to other tiles we must find the direction
975152
private void buildExternalLink(MeshData tile, Poly node, MeshData neighbourTile) {
		if (neighbourTile.header.bmin[0] > tile.header.bmin[0]) {
			node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK;
		} else if (neighbourTile.header.bmin[0] < tile.header.bmin[0]) {
			node.neis[PolyUtils.findEdge(node, tile, tile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK | 4;
		} else if (neighbourTile.header.bmin[2] > tile.header.bmin[2]) {
			node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[2], 2)] = NavMesh.DT_EXT_LINK | 2;
		} else {
			node.neis[PolyUtils.findEdge(node, tile, tile.header.bmin[2], 2)] = NavMesh.DT_EXT_LINK | 6;
		}
	}
667695
def direction(self):
        
        if _get_bit(self._mcp.iodir, self._pin):
            return digitalio.Direction.INPUT
        return digitalio.Direction.OUTPUT
506547
def _next_move_direction(self):
        
        nmoves = len(self.moves)
        move = np.random.randint(1, nmoves+1)
        while self.prev_move == (move + 3) % nmoves:
            move = np.random.randint(1, nmoves+1)
        self.prev_move = move
        return np.array(self.moves[move])
762038
function verifyAbsoluteDirection(direction) {
  if (!ABSOLUTE_DIRECTIONS.includes(direction)) {
    throw new Error(
      `Unknown direction: '${direction}'. Should be one of: '${NORTH}', '${EAST}', '${SOUTH}' or '${WEST}'.`,
    );
  }
}
575904
function endTraversal() {
        var pane = _getPane(ACTIVE_PANE);

        if (_traversingFileList) {
            _traversingFileList = false;

            _makeFileMostRecent(pane.id, pane.getCurrentlyViewedFile());
        }
    }
782815
def moves_in_direction(self, direction, position):
        
        current_square = self.location

        while True:
            try:
                current_square = direction(current_square)
            except IndexError:
                return

            if self.contains_opposite_color_piece(current_square, position):
                yield self.create_move(current_square, notation_const.CAPTURE)

            if not position.is_square_empty(current_square):
                return

            yield self.create_move(current_square, notation_const.MOVEMENT)
22572
def finding_path(cls, organization, source, finding):
        """"""
        return google.api_core.path_template.expand(
            "organizations/{organization}/sources/{source}/findings/{finding}",
            organization=organization,
            source=source,
            finding=finding,
        )
1259965
private void followDecoratedComponent(JLayeredPane layeredPane) {
        Point relativeLocationToOwner = anchorLink.getRelativeSlaveLocation(decoratedComponent.getWidth(),
                decoratedComponent.getHeight(), getWidth(), getHeight());

        updateDecorationPainterUnclippedBounds(layeredPane, relativeLocationToOwner);
        updateDecorationPainterClippedBounds(layeredPane, relativeLocationToOwner);

        // Repaint decoration
        if (layeredPane != null) {
            decorationPainter.revalidate();
            decorationPainter.repaint();
        }
    }
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];
        }
373140
def get_tiles(self):
        """"""
        for x, y in griditer(self.root_tile.x, self.root_tile.y, ncol=self.tiles_per_row):
            yield TileCoordinate(self.root_tile.zoom, x, y)
411181
def get_tile_url(self, zoom, x, y):
        
        return self.tile_url.format(**{"$z": zoom, "$x": x, "$y": y})
1175852
private void checkTransitives(Tile neighbor, String group, GroupTransition current, TileRef ref)
    {
        if (!group.equals(current.getOut())
            && TransitionType.CENTER == mapTransition.getTransition(ref, current.getOut()).getType())
        {
            map.setTile(map.createTile(ref.getSheet(), ref.getNumber(), neighbor.getX(), neighbor.getY()));
        }
    }
1074961
void connectIntLinks(MeshTile tile) {
        if (tile == null) {
            return;
        }

        long base = getPolyRefBase(tile);

        for (int i = 0; i < tile.data.header.polyCount; ++i) {
            Poly poly = tile.data.polys[i];
            poly.firstLink = DT_NULL_LINK;

            if (poly.getType() == Poly.DT_POLYTYPE_OFFMESH_CONNECTION) {
                continue;
            }

            // Build edge links backwards so that the links will be
            // in the linked list from lowest index to highest.
            for (int j = poly.vertCount - 1; j >= 0; --j) {
                // Skip hard and non-internal edges.
                if (poly.neis[j] == 0 || (poly.neis[j] & DT_EXT_LINK) != 0) {
                    continue;
                }

                int idx = allocLink(tile);
                Link link = tile.links.get(idx);
                link.ref = base | (poly.neis[j] - 1);
                link.edge = j;
                link.side = 0xff;
                link.bmin = link.bmax = 0;
                // Add to linked list.
                link.next = poly.firstLink;
                poly.firstLink = idx;
            }
        }
    }
1317646
function( historyEntry, direction ) {
                    // make sure to create a new object to pass down as the navigate event data
                    event.hashchangeState = $.extend({}, historyEntry);
                    event.hashchangeState.direction = direction;
                }
1073130
private String getNeighborGroup(Tile tile, Tile neighbor)
    {
        final String neighborGroup;
        if (isTransition(neighbor))
        {
            if (isTransition(tile))
            {
                neighborGroup = getOtherGroup(tile, neighbor);
            }
            else
            {
                neighborGroup = null;
            }
        }
        else
        {
            neighborGroup = mapGroup.getGroup(neighbor);
        }
        return neighborGroup;
    }
355868
function (tiles) {
		const maxDist = 5;
		
		let t, tile, tileBody, tileVertices, n, neighbour, neighbourBody, neighbourVertices, i, j, tv0, tv1, tv2, tv3, nv1, nv2, edge;
		
		for (t = 0; t < tiles.length; t++) {
			tile = tiles[t];
			
			// Skip over irrelevant tiles
			if (isIrrelevant(tile)) {
				continue;
			}
			
			// Grab the tile's body and vertices to build its edges and compare with neighbours
			tileBody = tile.physics.matterBody.body;
			tileVertices = tileBody.vertices;
			
			tileBody.edges = [];
			tileBody.ignormals = [];
			
			for (i = 0; i < tileVertices.length; i++) {
				tv1 = tileVertices[i];
				tv2 = tileVertices[(i + 1) % tileVertices.length];
				
				// Find or build the edge for this tile vertex
				edge = tileBody.edges[i];
				
				// Build the edge
				edge = buildEdge(tv1, tv2, tileBody);
				edge.ignore = tv1.isInternal;
				
				// Add it to the tile's edge list
				tileBody.edges[i] = edge;
			}
			
			for (n in tile.physics.slopes.neighbours) {
				neighbour = tile.physics.slopes.neighbours[n];
				
				// Skip over irrelevant neighbouring tiles
				if (isIrrelevant(neighbour)) {
					continue;
				}
				
				// Grab the neighbour's body and vertices
				neighbourBody = neighbour.physics.matterBody.body;
				neighbourVertices = neighbourBody.vertices;
				
				// Skip over tile-neighbour pairs that don't overlap
				if (!Bounds.overlaps(tileBody.bounds, neighbourBody.bounds)) {
					continue;
				}
				
				// Iterate over the vertices of both the tile and its neighbour
				for (i = 0; i < tileVertices.length; i++) {
					tv1 = tileVertices[i];
					tv2 = tileVertices[(i + 1) % tileVertices.length];
					
					// Find the edge for this tile vertex
					edge = tileBody.edges[i];
					
					// Find neighbouring edges leading into this vertex
					for (j = 0; j < neighbourVertices.length; j++) {
						nv1 = neighbourVertices[j];
						nv2 = neighbourVertices[(j + 1) % neighbourVertices.length];
						
						// Skip internal neighbouring edges
						if (nv1.isInternal) {
							continue;
						}
						
						// Check for a leading or trailing ghost edges
						let leadingEdge = distance(tv1, nv2) < maxDist;
						let trailingEdge = distance(tv2, nv1) < maxDist;
						
						if (leadingEdge || trailingEdge) {
							// Add leading/trailing edge vertices
							if (leadingEdge && !edge.vertices[0]) {
								edge.vertices[0] = buildEdgeVertex(0, nv1.x, nv1.y, tileBody, true);
								
								// Link edges to each other
								if (neighbourBody.edges) {
									edge.prev = neighbourBody.edges[j];
									neighbourBody.edges[j].next = edge;
								}
							}
							
							if (trailingEdge && !edge.vertices[3]) {
								edge.vertices[3] = buildEdgeVertex(3, nv2.x, nv2.y, tileBody, true);
							}
							
							// Find the ignormals
							let ignormalVertex = leadingEdge ? nv2 : nv1;
							let tileEdgeNormal = tileBody.axes[i];
							let neighbourEdgeNormal = neighbourBody.axes[j];
							let ignormalCandidate = Vector.dot(tileEdgeNormal, neighbourEdgeNormal) > 0;// && !isAxisAligned(tileEdgeNormal) && !isAxisAligned(neighbourEdgeNormal);
							
							// If the tile edge normal and its neighbouring ghost edge normal are less than
							// 90 degrees different, we can set ignormals based on which bounds the joining
							// vertex lands on
							if (ignormalCandidate) {
								/**
								 * If the joining vertex is on a bounds edge, and the normal of its edge and the
								 * the neighbouring edge are not exactly the same as the corresponding direction
								 * constant, we can add an axis aligned ignormal
								 */
								
								// Leftwards ignormal
								if (Math.abs(ignormalVertex.x - tileBody.bounds.min.x) < 1 && !containsNormal(Constants.Directions.LEFT, tileBody.axes) && Vector.dot(tileEdgeNormal, Constants.Directions.LEFT) < 1 && Vector.dot(neighbourEdgeNormal, Constants.Directions.LEFT) < 1) {
									tileBody.ignormals.push(Constants.Directions.LEFT);
								}
								
								// Upwards ignormal
								if (Math.abs(ignormalVertex.y - tileBody.bounds.min.y) < 1 && !containsNormal(Constants.Directions.UP, tileBody.axes) && Vector.dot(tileEdgeNormal, Constants.Directions.UP) < 1 && Vector.dot(neighbourEdgeNormal, Constants.Directions.UP) < 1) {
									tileBody.ignormals.push(Constants.Directions.UP);
								}
								
								// Rightwards ignormal
								if (Math.abs(ignormalVertex.x - tileBody.bounds.max.x) < 1 && !containsNormal(Constants.Directions.RIGHT, tileBody.axes) && Vector.dot(tileEdgeNormal, Constants.Directions.RIGHT) < 1 && Vector.dot(neighbourEdgeNormal, Constants.Directions.RIGHT) < 1) {
									tileBody.ignormals.push(Constants.Directions.RIGHT);
								}
								
								// Downwards ignormal
								if (Math.abs(ignormalVertex.y - tileBody.bounds.max.y) < 1 && !containsNormal(Constants.Directions.DOWN, tileBody.axes) && Vector.dot(tileEdgeNormal, Constants.Directions.DOWN) < 1 && Vector.dot(neighbourEdgeNormal, Constants.Directions.DOWN) < 1) {
									tileBody.ignormals.push(Constants.Directions.DOWN);
								}
							}
						}
					}
				}
			}
			
			// Resolve edge normal data, now that we've seen all the neighbours
			// and ensure ghost vertices are set on each edge
			for (i = 0; i < tileVertices.length; i++) {
				edge = tileBody.edges[i];
				
				if (edge.ignore) {
					continue;
				}
				
				tv0 = tileVertices[((i - 1) % tileVertices.length + tileVertices.length) % tileVertices.length];
				tv1 = tileVertices[i];
				tv2 = tileVertices[(i + 1) % tileVertices.length];
				tv3 = tileVertices[(i + 2) % tileVertices.length];
				
				// Use this body's vertices as ghost vertices if neighbours
				// haven't provided them, and if they aren't internal edges
				if (!edge.vertices[0] && !tv0.isInternal) {
					edge.vertices[0] = buildEdgeVertex(0, tv0.x, tv0.y, tileBody, true);
				}
				
				if (!edge.vertices[3] && !tv2.isInternal) {
					edge.vertices[3] = buildEdgeVertex(3, tv3.x, tv3.y, tileBody, true);
				}
				
				// Calculate edge normals
				edge.normals = Axes.fromVertices(edge.vertices);
				
				// Calculate edge normal ranges
				buildEdgeNormalRanges(edge);
			}
		}
	}
509400
@SideOnly(Side.CLIENT)
	public static void updateGui(TileEntity te)
	{
		if (te != currentTileEntity)
			return;
		currenGui.updateGui();
	}