f64/d2/rect.go
func (r Rectangle) Inset(n float64) Rectangle {
	if r.Dx() < 2*n {
		r.Min.X = (r.Min.X + r.Max.X) / 2
		r.Max.X = r.Min.X
	} else {
		r.Min.X += n
		r.Max.X -= n
	}
	if r.Dy() < 2*n {
		r.Min.Y = (r.Min.Y + r.Max.Y) / 2
		r.Max.Y = r.Min.Y
	} else {
		r.Min.Y += n
		r.Max.Y -= n
	}
	return r
}
func (r Rectangle) Inset(n float64) Rectangle {
	if r.Dx() < 2*n {
		r.Min.X = (r.Min.X + r.Max.X) / 2
		r.Max.X = r.Min.X
	} else {
		r.Min.X += n
		r.Max.X -= n
	}
	if r.Dy() < 2*n {
		r.Min.Y = (r.Min.Y + r.Max.Y) / 2
		r.Max.Y = r.Min.Y
	} else {
		r.Min.Y += n
		r.Max.Y -= n
	}
	return r
}
func ( r Rectangle ) Inset ( n float64 ) Rectangle { if r . Dx ( ) < 2 * n { r . Min . X = ( r . Min . X + r . Max . X ) / 2 r . Max . X = r . Min . X } else { r . Min . X += n r . Max . X -= n } if r . Dy ( ) < 2 * n { r . Min . Y = ( r . Min . Y + r . Max . Y ) / 2 r . Max . Y = r . Min . Y } else { r . Min . Y += n r . Max . Y -= n } return r }
// Inset returns the rectangle r inset by n, which may be negative. If either
// of r's dimensions is less than 2*n then an empty rectangle near the center
// of r will be returned.
Inset returns the rectangle r inset by n which may be negative . If either of r s dimensions is less than 2 * n then an empty rectangle near the center of r will be returned .