func Joined(a, b *Rect) (rect Rect) {
	rect.Min = Min(&a.Min, &b.Min)
	rect.Max = Max(&a.Max, &b.Max)
	return rect
}
Joined returns the minimal rectangle containing both a and b.
package vec2
import (
	"fmt"
)
type Rect struct {
	Min T
	Max T
}
func NewRect(a, b *T) (rect Rect) {
	rect.Min = Min(a, b)
	rect.Max = Max(a, b)
	return rect
}
func ParseRect(s string) (r Rect, err error) {
	_, err = fmt.Sscan(s, &r.Min[0], &r.Min[1], &r.Max[0], &r.Max[1])
	return r, err
}
func (rect *Rect) String() string {
	return rect.Min.String() + " " + rect.Max.String()
}
func (rect *Rect) ContainsPoint(p *T) bool {
	return p[0] >= rect.Min[0] && p[0] <= rect.Max[0] &&
		p[1] >= rect.Min[1] && p[1] <= rect.Max[1]
}
func (rect *Rect) Contains(other *Rect) bool {
	return rect.Min[0] <= other.Min[0] &&
		rect.Min[1] <= other.Min[1] &&
		rect.Max[0] >= other.Max[0] &&
		rect.Max[1] >= other.Max[1]
}
func (rect *Rect) Area() float64 {
	return (rect.Max[0] - rect.Min[0]) * (rect.Max[1] - rect.Min[1])
}
func (rect *Rect) Join(other *Rect) {
	rect.Min = Min(&rect.Min, &other.Min)
	rect.Max = Max(&rect.Max, &other.Max)
}