MCPcopy Create free account
hub / github.com/tdewolff/canvas / AddPoint

Method AddPoint

util.go:460–466  ·  view source on GitHub ↗

AddPoint returns a rect that encompasses both the current rect and the given point.

(p Point)

Source from the content-addressed store, hash-verified

458
459// AddPoint returns a rect that encompasses both the current rect and the given point.
460func (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.
469func (r Rect) Expand(d float64) Rect {

Callers 3

SimplifyMethod · 0.95
TestRectFunction · 0.95
RectFromPointsFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestRectFunction · 0.76