// At creates a tile for the point at the given zoom.
// Will create a valid tile for the zoom. Points outside
// the range lat [-85.0511, 85.0511] will be snapped to the
// max or min tile as appropriate.
779965
func At(ll orb.Point, z Zoom) Tile {
	f := Fraction(ll, z)
	t := Tile{
		X: uint32(f[0]),
		Y: uint32(f[1]),
		Z: z,
	}

	return t
}
560054
func (k *Kernel) At(x, y int) float64 {
	return k.Matrix[y*k.Width+x]
}
134571
func (t *Tree) At(index int) interface{} {

	if t.root != nil && index < t.root.size && index >= 0 {
		node := indexer(t.root, index)
		if node != nil {
			return node.value
		}
	}

	return nil
}
130309
func Point(p0, p1, p2, p3 *vec2.T, t float64) vec2.T {
	t1 := 1.0 - t

	f := t1 * t1 * t1
	result := p0.Scaled(f)

	f = 3.0 * t1 * t1 * t
	p1f := p1.Scaled(f)
	result.Add(&p1f)

	f = 3.0 * t1 * t * t
	p2f := p2.Scaled(f)
	result.Add(&p2f)

	f = t * t * t
	p3f := p3.Scaled(f)
	result.Add(&p3f)

	return result
}
221238
func lagrange(pts []point, x float64) (y float64) {
	y = 0.0
	for j := range pts {
		l := 1.0
		for m := range pts {
			if j == m {
				continue
			}
			l *= (x - pts[m].X) / (pts[j].X - pts[m].X)
		}
		y += pts[j].Y * l
	}
	return y
}
357459
func MultiPolygon(mp orb.MultiPolygon, z maptile.Zoom) maptile.Set {
	set := make(maptile.Set)
	for _, p := range mp {
		polygon(set, p, z)
	}

	return set
}
267699
func (r Region) Contains(point int) bool {
	return point >= r.Begin() && point <= r.End()
}
162977
func (t Tile) Range(z Zoom) (min, max Tile) {
	if z < t.Z {
		t = t.toZoom(z)
		return t, t
	}

	offset := z - t.Z
	return Tile{
			X: t.X << offset,
			Y: t.Y << offset,
			Z: z,
		}, Tile{
			X: ((t.X + 1) << offset) - 1,
			Y: ((t.Y + 1) << offset) - 1,
			Z: z,
		}
}
150000
func FromQuadkey(k uint64, z Zoom) Tile {
	t := Tile{Z: z}

	for i := Zoom(0); i < z; i++ {
		t.X |= uint32((k & (1 << (2 * i))) >> i)
		t.Y |= uint32((k & (1 << (2*i + 1))) >> (i + 1))
	}

	return t
}
734904
func Geometry(g orb.Geometry, z maptile.Zoom) maptile.Set {
	if g == nil {
		return nil
	}

	switch g := g.(type) {
	case orb.Point:
		return Point(g, z)
	case orb.MultiPoint:
		return MultiPoint(g, z)
	case orb.LineString:
		return LineString(g, z)
	case orb.MultiLineString:
		return MultiLineString(g, z)
	case orb.Ring:
		return Ring(g, z)
	case orb.Polygon:
		return Polygon(g, z)
	case orb.MultiPolygon:
		return MultiPolygon(g, z)
	case orb.Collection:
		return Collection(g, z)
	case orb.Bound:
		return Bound(g, z)
	}

	panic(fmt.Sprintf("geometry type not supported: %T", g))
}
167784
func (p *Image) At(x, y int) color.Color {
	return p.RGBAAt(x, y)
}
548618
func Point(p orb.Point, proj orb.Projection) orb.Point {
	return proj(p)
}
1050170
func (p *Point) Set(x, y float32) *Point {
	p.X = x
	p.Y = y
	return p
}
1069141
func (t *stringTree) At(values ...string) StringChanger {
	var path []nodeContent
	for _, value := range values {
		path = append(path, justValue{value})
	}
	n, err := t.container.root.at(path...)
	return &stringChanger{n, err}
}
1158243
def tile_at(self, zoom, position):
        
        x, y = self.project_pixels(position, zoom)
        return (zoom, int(x/self.tilesize), int(y/self.tilesize))
241053
func (t *keyValueTree) At(keys ...string) KeyValueChanger {
	var path []nodeContent
	for _, key := range keys {
		path = append(path, keyValue{key, nil})
	}
	n, err := t.container.root.at(path...)
	return &keyValueChanger{n, err}
}
41325
func (l *Line) Project(point *Point) float64 {
	if point.Equals(&l.a) {
		return 0.0
	}

	if point.Equals(&l.b) {
		return 1.0
	}

	dx := l.b[0] - l.a[0]
	dy := l.b[1] - l.a[1]
	d := (dx*dx + dy*dy)
	if d == 0 {
		return 0
	}

	return ((point[0]-l.a[0])*dx + (point[1]-l.a[1])*dy) / d
}