diff --git a/geometry.go b/geometry.go index 9b610488aa0bd03bb11b955c417eda1b587710a5..06139faf4de035e1a47d882fbd9073a4c386b163 100644 --- a/geometry.go +++ b/geometry.go @@ -182,6 +182,11 @@ func (r Rect) H() float64 { return r.Max.Y() - r.Min.Y() } +// Size returns the vector of width and height as components respectively. +func (r Rect) Size() Vec { + return V(r.W(), r.H()) +} + // Center returns the position of the center of the rectangle. func (r Rect) Center() Vec { return (r.Min + r.Max) / 2