Skip to content

Commit 2a53c6f

Browse files
committed
vg: introduce Rectangle.Add
1 parent bd0e370 commit 2a53c6f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

vg/geom.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ func (r Rectangle) Size() Point {
4646
}
4747
}
4848

49+
// Add returns the rectangle r translated by p.
50+
func (r Rectangle) Add(p Point) Rectangle {
51+
return Rectangle{
52+
Min: r.Min.Add(p),
53+
Max: r.Max.Add(p),
54+
}
55+
}
56+
4957
// Path returns the path of a Rect specified by its
5058
// upper left corner, width and height.
5159
func (r Rectangle) Path() (p Path) {

0 commit comments

Comments
 (0)