From c81dedd9a1e1fb611b7a94f2faaa606dbef2ea8c Mon Sep 17 00:00:00 2001 From: faiface <faiface@ksp.sk> Date: Tue, 14 Mar 2017 18:25:39 +0100 Subject: [PATCH] add Rect.Size --- geometry.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/geometry.go b/geometry.go index 9b61048..06139fa 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 -- GitLab