f32/d3/rect.go
func (r Rectangle) Inset(n float32) Rectangle {
	if r.Dx() < 2*n {
		r.Min[0] = (r.Min[0] + r.Max[0]) / 2
		r.Max[0] = r.Min[0]
	} else {
		r.Min[0] += n
		r.Max[0] -= n
	}
	if r.Dy() < 2*n {
		r.Min[1] = (r.Min[1] + r.Max[1]) / 2
		r.Max[1] = r.Min[1]
	} else {
		r.Min[1] += n
		r.Max[1] -= n
	}
	return r
}
func (r Rectangle) Inset(n float32) Rectangle {
	if r.Dx() < 2*n {
		r.Min[0] = (r.Min[0] + r.Max[0]) / 2
		r.Max[0] = r.Min[0]
	} else {
		r.Min[0] += n
		r.Max[0] -= n
	}
	if r.Dy() < 2*n {
		r.Min[1] = (r.Min[1] + r.Max[1]) / 2
		r.Max[1] = r.Min[1]
	} else {
		r.Min[1] += n
		r.Max[1] -= n
	}
	return r
}
func ( r Rectangle ) Inset ( n float32 ) Rectangle { if r . Dx ( ) < 2 * n { r . Min [ 0 ] = ( r . Min [ 0 ] + r . Max [ 0 ] ) / 2 r . Max [ 0 ] = r . Min [ 0 ] } else { r . Min [ 0 ] += n r . Max [ 0 ] -= n } if r . Dy ( ) < 2 * n { r . Min [ 1 ] = ( r . Min [ 1 ] + r . Max [ 1 ] ) / 2 r . Max [ 1 ] = r . Min [ 1 ] } else { r . Min [ 1 ] += n r . Max [ 1 ] -= 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 .