return the tile position corresponding to the specified pixel
@ignore
19212
function (x, y, v) {
            var ret = v || new me.Vector2d();

            var alignedX = x,
                alignedY = y;

            if (this.staggerX) {
                alignedX -= this.staggerEven ? this.sideoffsetx : 0;
            } else {
                alignedY -= this.staggerEven ? this.sideoffsety : 0;
            }

            // Start with the coordinates of a grid-aligned tile
            var referencePoint = me.pool.pull("me.Vector2d",
                Math.floor(alignedX / this.tilewidth),
                Math.floor(alignedY / this.tileheight)
            );

            // Adjust the reference point to the correct tile coordinates
            if (this.staggerX) {
                referencePoint.x = referencePoint.x * 2;
                if (this.staggerEven) {
                    ++referencePoint.x;
                }
            } else {
                referencePoint.y = referencePoint.y * 2;
                if (this.staggerEven) {
                    ++referencePoint.y;
                }
            }

            // Relative x and y position on the base square of the grid-aligned tile
            var rel = me.pool.pull("me.Vector2d",
                alignedX - referencePoint.x * this.tilewidth,
                alignedY - referencePoint.y * this.tileheight
            );

            // Check whether the cursor is in any of the corners (neighboring tiles)
            var y_pos = rel.x * (this.tileheight / this.tilewidth);

            if (this.sideoffsety - y_pos > rel.y) {
                referencePoint = this.topLeft(referencePoint.x, referencePoint.y, referencePoint);
            }
            if (-this.sideoffsety + y_pos > rel.y) {
                referencePoint = this.topRight(referencePoint.x, referencePoint.y, referencePoint);
            }
            if (this.sideoffsety + y_pos < rel.y) {
                referencePoint = this.bottomLeft(referencePoint.x, referencePoint.y, referencePoint);
            }
            if (this.sideoffsety * 3 - y_pos < rel.y) {
                referencePoint = this.bottomRight(referencePoint.x, referencePoint.y, referencePoint);
            }

            ret = this.tileToPixelCoords(referencePoint.x, referencePoint.y, ret);

            ret.set(x - ret.x, y - ret.y);

            // Start with the coordinates of a grid-aligned tile
            ret.set(
                ret.x - (this.tilewidth / 2),
                ret.y * (this.tilewidth / this.tileheight)
            );

            ret.div(this.tilewidth / Math.sqrt(2)).rotate(me.Math.degToRad(-45)).add(referencePoint);

            me.pool.push(referencePoint);
            me.pool.push(rel);

            return ret;
        }
2494
def get_tile_image(self, x, y, l):
        
        # disabled for now, re-enable when support for generic maps is restored
        # # since the tile has been queried, assume it wants to be checked
        # # for animations sometime in the future
        # if self._animation_queue:
        #     self._tracked_tiles.add((x, y, l))

        try:
            # animated, so return the correct frame
            return self._animated_tile[(x, y, l)]

        except KeyError:

            # not animated, so return surface from data, if any
            return self._get_tile_image(x, y, l)
1034681
function(rectangle) {
        return $.Rect.fromSummits(
            this.pixelFromPoint(rectangle.getTopLeft(), true),
            this.pixelFromPoint(rectangle.getTopRight(), true),
            this.pixelFromPoint(rectangle.getBottomLeft(), true)
        );
    }
363227
def getTileOrigin(self, tileX, tileY, level):
        '''
        
        '''
        pixelX, pixelY = self.convertTileXYToPixelXY(tileX, tileY)
        lng, lat = self.convertPixelXYToLngLat(pixelX, pixelY, level)
        return (lat, lng)
64206
private double pixelsToUnits(int pixels) {
		Coordinate c1 = mapPresenter.getViewPort().getTransformationService()
				.transform(new Coordinate(0, 0), RenderSpace.SCREEN, RenderSpace.WORLD);
		Coordinate c2 = mapPresenter.getViewPort().getTransformationService()
				.transform(new Coordinate(pixels, 0), RenderSpace.SCREEN, RenderSpace.WORLD);
		return MathService.distance(c1, c2);
	}
214334
function (x, y, v) {
            var ret = v || new me.Vector2d();

            if (this.staggerX) { //flat top
                x -= this.staggerEven ? this.tilewidth : this.sideoffsetx;
            }
            else { //pointy top
                y -= this.staggerEven ? this.tileheight : this.sideoffsety;
            }

            // Start with the coordinates of a grid-aligned tile
            var referencePoint = me.pool.pull("me.Vector2d",
                Math.floor(x / (this.columnwidth * 2)),
                Math.floor((y / (this.rowheight * 2)))
            );

            // Relative x and y position on the base square of the grid-aligned tile
            var rel = me.pool.pull("me.Vector2d",
                x - referencePoint.x * (this.columnwidth * 2),
                y - referencePoint.y * (this.rowheight * 2)
            );

            // Adjust the reference point to the correct tile coordinates
            if (this.staggerX) {
                referencePoint.x = referencePoint.x * 2;
                if (this.staggerEven) {
                    ++referencePoint.x;
                }
            }
            else {
                referencePoint.y = referencePoint.y * 2;
                if (this.staggerEven) {
                    ++referencePoint.y;
                }
            }

            // Determine the nearest hexagon tile by the distance to the center
            var left, top, centerX, centerY;
            if (this.staggerX) {
                left = this.sidelengthx / 2;
                centerX = left + this.columnwidth;
                centerY = this.tileheight / 2;

                this.centers[0].set(left, centerY);
                this.centers[1].set(centerX, centerY - this.rowheight);
                this.centers[2].set(centerX, centerY + this.rowheight);
                this.centers[3].set(centerX + this.columnwidth, centerY);
            }
            else {
                top = this.sidelengthy / 2;
                centerX = this.tilewidth / 2;
                centerY = top + this.rowheight;

                this.centers[0].set(centerX, top);
                this.centers[1].set(centerX - this.columnwidth, centerY);
                this.centers[2].set(centerX + this.columnwidth, centerY);
                this.centers[3].set(centerX, centerY + this.rowheight);
            }

            var nearest = 0;
            var minDist = Number.MAX_VALUE;
            for (var i = 0; i < 4; ++i) {
                var dc = this.centers[i].sub(rel).length2();
                if (dc < minDist) {
                    minDist = dc;
                    nearest = i;
                }
            }

            var offsets = (this.staggerX) ? offsetsStaggerX : offsetsStaggerY;

            ret.set(
                referencePoint.x + offsets[nearest].x,
                referencePoint.y + offsets[nearest].y
            );

            me.pool.push(referencePoint);
            me.pool.push(rel);

            return ret;
        }
1261293
function getPositionFromBoard(board, position) {
    try {
        return board[position.y][position.x];
    } catch (e) {
        throw new Error('Error getting position');
    }
}
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};
}
590228
def get_position(stream=STD_OUTPUT_HANDLE):
    '''  '''
    stream = kernel32.GetStdHandle(stream)
    csbi = CONSOLE_SCREEN_BUFFER_INFO()
    kernel32.GetConsoleScreenBufferInfo(stream, byref(csbi))

    pos = csbi.dwCursorPosition
    # zero based, add ones for compatibility.
    return (pos.X + 1, pos.Y + 1)
1164418
function (pos) {
        var layerSize = this.layerSize,
            tiles = this.tiles

        if (pos.x < 0 || pos.y < 0 || pos.x >= layerSize.width || pos.y >= layerSize.height) {
            throw "TMX Layer: Invalid position"
        }

        var tile,
            gid = this.tileGIDAt(pos)

        // if GID is 0 then no tile exists at that point
        if (gid) {
            var z = pos.x + pos.y * layerSize.width
            tile = this.getChild({tag: z})
        }

        return tile
    }
527887
def map_pixel_location(self, point_x, point_y):
        '''
        
        '''
        row, col = map_pixel(point_x, point_y, self.x_cell_size, self.y_cell_size,
                             self.xmin, self.ymax)
        return np.array([row, col])
1080457
function(bounds, position) {
        var tile = new this.tileClass(
            this, position, bounds, null, this.tileSize, this.tileOptions
        );
        this.events.triggerEvent("addtile", {tile: tile});
        return tile;
    }
916802
public Point getTileCoords (int x, int y)
    {
        return MisoUtil.screenToTile(_metrics, x, y, new Point());
    }
83778
def pixel(self, x, y, size=None):
        """"""
        if (size is None):
            size = self.sz
        # Have we go to the smallest element?
        if (size <= 3):
            if (_middle(x, y)):
                return (None)
            else:
                return (0, 0, 0)
        divisor = size // 3
        if (_middle(x // divisor, y // divisor)):
            return None
        return self.pixel(x % divisor, y % divisor, divisor)
812406
def pixel(self, x, y, color=None):
        """"""
        if self.rotation == 1:
            x, y = y, x
            x = self.width - x - 1
        if self.rotation == 2:
            x = self.width - x - 1
            y = self.height - y - 1
        if self.rotation == 3:
            x, y = y, x
            y = self.height - y - 1

        if x < 0 or x >= self.width or y < 0 or y >= self.height:
            return None
        if color is None:
            return self.format.get_pixel(self, x, y)
        self.format.set_pixel(self, x, y, color)
        return None
113030
public TilePreparationInfo call() {
        return this.context.mdcContext(() -> {
            try {
                final ReferencedEnvelope mapGeoBounds = this.bounds.toReferencedEnvelope(this.paintArea);
                final CoordinateReferenceSystem mapProjection = mapGeoBounds.getCoordinateReferenceSystem();
                Dimension tileSizeOnScreen = this.tiledLayer.getTileSize();

                final double resolution = this.tiledLayer.getResolution();
                Coordinate tileSizeInWorld = new Coordinate(tileSizeOnScreen.width * resolution,
                                                            tileSizeOnScreen.height * resolution);

                // The minX minY of the first (minY, minY) tile
                Coordinate gridCoverageOrigin =
                        this.tiledLayer.getMinGeoCoordinate(mapGeoBounds, tileSizeInWorld);

                final String commonUrl = this.tiledLayer.createCommonUrl();

                ReferencedEnvelope tileCacheBounds = this.tiledLayer.getTileCacheBounds();
                double rowFactor = 1 / (resolution * tileSizeOnScreen.height);
                double columnFactor = 1 / (resolution * tileSizeOnScreen.width);

                int imageWidth = 0;
                int imageHeight = 0;
                int xIndex;
                int yIndex = (int) Math.floor((mapGeoBounds.getMaxY() - gridCoverageOrigin.y) /
                                                      tileSizeInWorld.y) + 1;

                double gridCoverageMaxX = gridCoverageOrigin.x;
                double gridCoverageMaxY = gridCoverageOrigin.y;

                List<SingleTilePreparationInfo> tiles = new ArrayList<>();

                for (double geoY = gridCoverageOrigin.y; geoY < mapGeoBounds.getMaxY();
                     geoY += tileSizeInWorld.y) {
                    yIndex--;
                    imageHeight += tileSizeOnScreen.height;
                    imageWidth = 0;
                    xIndex = -1;

                    gridCoverageMaxY = geoY + tileSizeInWorld.y;
                    for (double geoX = gridCoverageOrigin.x; geoX < mapGeoBounds.getMaxX();
                         geoX += tileSizeInWorld.x) {
                        xIndex++;
                        imageWidth += tileSizeOnScreen.width;
                        gridCoverageMaxX = geoX + tileSizeInWorld.x;

                        ReferencedEnvelope tileBounds = new ReferencedEnvelope(
                                geoX, gridCoverageMaxX, geoY, gridCoverageMaxY, mapProjection);

                        int row = (int) Math.round((tileCacheBounds.getMaxY() -
                                tileBounds.getMaxY()) * rowFactor);
                        int column = (int) Math.round((tileBounds.getMinX() -
                                tileCacheBounds.getMinX()) * columnFactor);

                        ClientHttpRequest tileRequest =
                                this.tiledLayer.getTileRequest(this.httpRequestFactory,
                                                               commonUrl, tileBounds,
                                                               tileSizeOnScreen, column,
                                                               row);
                        if (isInTileCacheBounds(tileCacheBounds, tileBounds)) {
                            if (isTileVisible(tileBounds)) {
                                tileRequest = this.requestCache.register(tileRequest);
                                tiles.add(new SingleTilePreparationInfo(xIndex, yIndex, tileRequest));
                            }
                        } else {
                            LOGGER.debug("Tile out of bounds: {}", tileRequest);
                            tiles.add(new SingleTilePreparationInfo(xIndex, yIndex, null));
                        }
                    }
                }

                return new TilePreparationInfo(tiles, imageWidth, imageHeight, gridCoverageOrigin,
                                               gridCoverageMaxX, gridCoverageMaxY, mapProjection);
            } catch (Exception e) {
                throw ExceptionUtils.getRuntimeException(e);
            }
        });
    }
799553
def pixel(self, x, y, size=None):
        """"""
        if (size is None):
            size = self.sz
        # Have we go to the smallest element?
        if (size <= 3):
            if (_not_diagonal(x, y)):
                return None
            else:
                return (0, 0, 0)
        divisor = size // 3
        if (_not_diagonal(x // divisor, y // divisor)):
            return None
        return self.pixel(x % divisor, y % divisor, divisor)