// RectBound returns a Rect that bounds this entity.
9734
func (cu *CellUnion) RectBound() Rect {
	bound := EmptyRect()
	for _, c := range *cu {
		bound = bound.Union(CellFromCellID(c).RectBound())
	}
	return bound
}
432858
func NewRect(a, b *T) (rect Rect) {
	rect.Min = Min(a, b)
	rect.Max = Max(a, b)
	return rect
}
1252703
func Joined(a, b *Rect) (rect Rect) {
	rect.Min = Min(&a.Min, &b.Min)
	rect.Max = Max(&a.Max, &b.Max)
	return rect
}
346954
func (r Rect) Contains(u Vec) bool {
	return r.Min.X <= u.X && u.X <= r.Max.X && r.Min.Y <= u.Y && u.Y <= r.Max.Y
}
1030727
func (l Line) Bounds() Rect {
	return R(l.A.X, l.A.Y, l.B.X, l.B.Y).Norm()
}
1142724
func (pTypeDef *Rect) Init() *Rect {
	if pTypeDef.P1 == nil {
		pTypeDef.P1 = NewPoint()
	}
	if pTypeDef.P2 == nil {
		pTypeDef.P2 = NewPoint()
	}
	return pTypeDef
}
1099028
func (r Rect) Edges() [4]Line {
	corners := r.Vertices()

	return [4]Line{
		{A: corners[0], B: corners[1]},
		{A: corners[1], B: corners[2]},
		{A: corners[2], B: corners[3]},
		{A: corners[3], B: corners[0]},
	}
}
188276
func (c Collection) Bound() Bound {
	if len(c) == 0 {
		return emptyBound
	}

	var b Bound
	start := -1

	for i, g := range c {
		if g != nil {
			start = i
			b = g.Bound()
			break
		}
	}

	if start == -1 {
		return emptyBound
	}

	for i := start + 1; i < len(c); i++ {
		if c[i] == nil {
			continue
		}

		b = b.Union(c[i].Bound())
	}

	return b
}
1255051
func (s *projector) rect(r image.Rectangle) image.Rectangle {
	return image.Rectangle{s.pt(r.Min), s.pt(r.Max)}
}
43401
func (tb *TextBuf) Rect(x, y, w, h int, style int, fill rune) {
	style = style % len(Edge)

	if h < 0 {
		h = -h
		y -= h
	}
	if w < 0 {
		w = -w
		x -= w
	}

	tb.Put(x, y, Edge[style][0])
	tb.Put(x+w, y, Edge[style][1])
	tb.Put(x, y+h, Edge[style][2])
	tb.Put(x+w, y+h, Edge[style][3])
	for i := 1; i < w; i++ {
		tb.Put(x+i, y, '-')
		tb.Put(x+i, y+h, '-')
	}
	for i := 1; i < h; i++ {
		tb.Put(x+w, y+i, '|')
		tb.Put(x, y+i, '|')
		if fill > 0 {
			for j := x + 1; j < x+w; j++ {
				tb.Put(j, y+i, fill)
			}
		}
	}
}
378622
func (b *Box) GetRect() (int, int, int, int) {
	return b.x, b.y, b.width, b.height
}
961791
func Rect(min, max []float64) string {
	r := grect.Rect{Min: min, Max: max}
	return r.String()
}
56729
func Bound(b, bound orb.Bound) orb.Bound {
	if b.IsEmpty() && bound.IsEmpty() {
		return bound
	}

	if b.IsEmpty() {
		return bound
	} else if bound.IsEmpty() {
		return b
	}

	return orb.Bound{
		Min: orb.Point{
			math.Max(b.Min[0], bound.Min[0]),
			math.Max(b.Min[1], bound.Min[1]),
		},
		Max: orb.Point{
			math.Min(b.Max[0], bound.Max[0]),
			math.Min(b.Max[1], bound.Max[1]),
		},
	}
}
37296
func Bound(b orb.Bound, z maptile.Zoom) maptile.Set {
	lo := maptile.At(b.Min, z)
	hi := maptile.At(b.Max, z)

	result := make(maptile.Set, (hi.X-lo.X+1)*(lo.Y-hi.Y+1))

	for x := lo.X; x <= hi.X; x++ {
		for y := hi.Y; y <= lo.Y; y++ {
			result[maptile.Tile{X: x, Y: y, Z: z}] = true
		}
	}

	return result
}
1039073
func NewRect(init ...*Rect) *Rect {
	var o *Rect
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(Rect)
	}
	return o.Init()
}
1074755
func (r Rect) Intersects(other Rect) bool {
	return r.Lat.Intersects(other.Lat) && r.Lng.Intersects(other.Lng)
}
1222021
func (l *Line) Bound() *Bound {
	return NewBound(math.Max(l.a[0], l.b[0]), math.Min(l.a[0], l.b[0]),
		math.Max(l.a[1], l.b[1]), math.Min(l.a[1], l.b[1]))
}