Calculates the tile grid location for the specified world position.

@param pos
The world position for the query. [(x, y, z)]
@return 2-element int array with (tx,ty) tile location
542824
public int[] calcTileLoc(float[] pos) {
        int tx = (int) Math.floor((pos[0] - m_orig[0]) / m_tileWidth);
        int ty = (int) Math.floor((pos[2] - m_orig[2]) / m_tileHeight);
        return new int[] { tx, ty };
    }
467755
@Pure
	public Point1d getNearestPosition(Point2D<?, ?> pos) {
		Point2d pp = null;
		final Vector2d v = new Vector2d();
		double currentPosition = 0.;
		double bestPosition = Double.NaN;
		double bestDistance = Double.POSITIVE_INFINITY;
		for (final Point2d p : points()) {
			if (pp != null) {
				double position = Segment2afp.findsProjectedPointPointLine(
						pos.getX(), pos.getY(),
						pp.getX(), pp.getY(),
						p.getX(), p.getY());
				if (position < 0.) {
					position = 0.;
				}
				if (position > 1.) {
					position = 1.;
				}
				v.sub(p, pp);
				final double t = v.getLength();
				v.scale(position);
				final double dist = Point2D.getDistanceSquaredPointPoint(
						pos.getX(),
						pos.getY(),
						pp.getX() + v.getX(),
						pp.getY() + v.getY());
				if (dist < bestDistance) {
					bestDistance = dist;
					bestPosition = currentPosition + v.getLength();
				}
				currentPosition += t;
			}
			pp = p;
		}
		if (Double.isNaN(bestPosition)) {
			return null;
		}
		return new Point1d(toSegment1D(), bestPosition, 0.);
	}
1110871
public function getValueForPosition($pos) {
        return (isset($this->cells[$pos])) ? $this->cells[$pos]->getValue(): null;
    }
485845
public void putInt(int pos, int i) {
		adaptSize(pos + 4);
		ByteBuffer bb = getBuffer(pos);
		int index = pos % _bufferSize;
		if (bb.limit() - index >= 4) {
			bb.putInt(index, i);
		} else {
			byte b0 = (byte)i;
			byte b1 = (byte)(i >> 8);
			byte b2 = (byte)(i >> 16);
			byte b3 = (byte)(i >> 24);
			
			if (_order == ByteOrder.BIG_ENDIAN) {
				putBytes(pos, b3, b2, b1, b0);
			} else {
				putBytes(pos, b0, b1, b2, b3);
			}
		}
	}
1219439
def store_pos(mdTopLt, mdBotRt, x1, y1, x2, y2)  # :nodoc:
    record  = 0x104F     # Record identifier.
    length  = 0x0014     # Number of bytes to follow.
    # mdTopLt            # Top left.
    # mdBotRt            # Bottom right.
    # x1                 # X coordinate.
    # y1                 # Y coordinate.
    # x2                 # Width.
    # y2                 # Height.

    header = [record, length].pack('vv')
    data  = [mdTopLt].pack('v')
    data += [mdBotRt].pack('v')
    data += [x1].pack('V')
    data += [y1].pack('V')
    data += [x2].pack('V')
    data += [y2].pack('V')

    append(header, data)
  end
774869
public int getColumn(int pos) {
	int line = getLine(pos) - 1;
	if (line == 0) return pos + 1;
	return pos - lines[line - 1].intValue();
    }
1335508
private function getSourcePosition($pos)
    {
        $low = 0;
        $high = count($this->sourcePositions);

        while ($low < $high) {
            $mid = (int) (($high + $low) / 2);

            if ($pos < $this->sourcePositions[$mid]) {
                $high = $mid - 1;
                continue;
            }

            if ($pos >= $this->sourcePositions[$mid + 1]) {
                $low = $mid + 1;
                continue;
            }

            return [$mid + 1, $pos - $this->sourcePositions[$mid]];
        }

        return [$low + 1, $pos - $this->sourcePositions[$low]];
    }
134201
@Pure
	public Point2d getPosition2D() {
		final Rectangle2d b = getBoundingBox();
		if (b == null) {
			return null;
		}
		return new Point2d(b.getCenterX(), b.getCenterY());
	}
399324
public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getCode();
                break;
            case 1:
                return $this->getAtosCode();
                break;
            case 2:
                return $this->getDecimals();
                break;
            default:
                return null;
                break;
        } // switch()
    }
976215
public boolean invert(World world, BlockPos pos)
	{
		boolean value = !get(world, pos);
		set(world, pos, value);
		return value;
	}
441317
public static Point2D gridToWorld( GridGeometry2D gridGeometry, int x, int y )
            throws InvalidGridGeometryException, TransformException {
        final Point2D worldPosition = new Point2D.Double(x, y);
        gridGeometry.getGridToCRS2D().transform(worldPosition, worldPosition);
        return worldPosition;
    }
1018576
function (x, y, points) {
            this.pos.set(x, y);

            if (!Array.isArray(points)) {
                return this;
            }

            // convert given points to me.Vector2d if required
            if (!(points[0] instanceof me.Vector2d)) {
                var _points = this.points = [];
                points.forEach(function (point) {
                   _points.push(new me.Vector2d(point.x, point.y));
                });
            } else {
                // array of me.Vector2d
                this.points = points;
            }

            this.recalc();
            this.updateBounds();

            return this;
        }
387466
public Result<Float> getPolyHeight(long ref, float[] pos) {

        Result<Tupple2<MeshTile, Poly>> tileAndPoly = m_nav.getTileAndPolyByRef(ref);
        if (tileAndPoly.failed()) {
            return Result.of(tileAndPoly.status, tileAndPoly.message);
        }
        MeshTile tile = tileAndPoly.result.first;
        Poly poly = tileAndPoly.result.second;

        if (Objects.isNull(pos) || !vIsFinite2D(pos)) {
            return Result.invalidParam();
        }

        // We used to return success for offmesh connections, but the
        // getPolyHeight in DetourNavMesh does not do this, so special
        // case it here.
        if (poly.getType() == Poly.DT_POLYTYPE_OFFMESH_CONNECTION) {
            int i = poly.verts[0] * 3;
            float[] v0 = new float[] { tile.data.verts[i], tile.data.verts[i + 1], tile.data.verts[i + 2] };
            i = poly.verts[1] * 3;
            float[] v1 = new float[] { tile.data.verts[i], tile.data.verts[i + 1], tile.data.verts[i + 2] };
            Tupple2<Float, Float> dt = distancePtSegSqr2D(pos, v0, v1);
            return Result.success(v0[1] + (v1[1] - v0[1]) * dt.second);
        }
        Optional<Float> height = m_nav.getPolyHeight(tile, poly, pos);
        return height.isPresent() ? Result.success(height.get()) : Result.invalidParam();
    }
958664
public void insert(final int pos, final double latitude, final double longitude) {
        ensureCapacity(size + 1);
        System.arraycopy(this.longitude, pos, this.longitude, pos + 1, size - pos);
        System.arraycopy(this.latitude, pos, this.latitude, pos + 1, size - pos);
        this.longitude[pos] = longitude;
        this.latitude[pos] = latitude;
        ++size;
    }
1181688
long getValueAtPosition(final int pos) {
    if (itemsSeen_ == 0) {
      throw new SketchesArgumentException("Requested element from empty reservoir.");
    } else if ((pos < 0) || (pos >= getNumSamples())) {
      throw new SketchesArgumentException("Requested position must be between 0 and "
          + (getNumSamples() - 1) + ", inclusive. Received: " + pos);
    }

    return data_[pos];
  }
613461
private String getPart(int pos) {
    String value = this.getValue();
    if (value == null) {
      return null;
    }
    String[] parts = value.split("/");
    return parts.length >= pos + 1 ? parts[pos] : null;
  }
1032135
function(pos) {
            var layers = this.getChildren(),
                len = layers.length,
                end = len - 1,
                n, shape;

            for(n = end; n >= 0; n--) {
                shape = layers[n].getIntersection(pos);
                if (shape) {
                    return shape;
                }
            }

            return null;
        }