AddPoint returns a rect that encompasses both the current rect and the given point.
(p Point)
| 458 | |
| 459 | // AddPoint returns a rect that encompasses both the current rect and the given point. |
| 460 | func (r Rect) AddPoint(p Point) Rect { |
| 461 | x0 := math.Min(r.X0, p.X) |
| 462 | y0 := math.Min(r.Y0, p.Y) |
| 463 | x1 := math.Max(r.X1, p.X) |
| 464 | y1 := math.Max(r.Y1, p.Y) |
| 465 | return Rect{x0, y0, x1, y1} |
| 466 | } |
| 467 | |
| 468 | // Expand expands the rectangle. |
| 469 | func (r Rect) Expand(d float64) Rect { |
no outgoing calls