Skip to content

Commit

Permalink
vg: introduce Rectangle.Add
Browse files Browse the repository at this point in the history
sbinet committed Jul 1, 2021
1 parent bd0e370 commit 2a53c6f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vg/geom.go
Original file line number Diff line number Diff line change
@@ -46,6 +46,14 @@ func (r Rectangle) Size() Point {
}
}

// Add returns the rectangle r translated by p.
func (r Rectangle) Add(p Point) Rectangle {
return Rectangle{
Min: r.Min.Add(p),
Max: r.Max.Add(p),
}
}

// Path returns the path of a Rect specified by its
// upper left corner, width and height.
func (r Rectangle) Path() (p Path) {

0 comments on commit 2a53c6f

Please sign in to comment.