From b13501211594fba61e2734b636075fad94be0ac3 Mon Sep 17 00:00:00 2001 From: faiface Date: Tue, 4 Apr 2017 14:02:39 +0200 Subject: [PATCH] minor change --- geometry.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/geometry.go b/geometry.go index e4427fb..502d06a 100644 --- a/geometry.go +++ b/geometry.go @@ -165,6 +165,15 @@ func R(minX, minY, maxX, maxY float64) Rect { } } +// String returns the string representation of the Rect. +// +// r := pixel.R(100, 50, 200, 300) +// r.String() // returns "Rect(100, 50, 200, 300)" +// fmt.Println(r) // Rect(100, 50, 200, 300) +func (r Rect) String() string { + return fmt.Sprintf("Rect(%v, %v, %v, %v)", r.Min.X(), r.Min.Y(), r.Max.X(), r.Max.Y()) +} + // Norm returns the Rect in normal form, such that Max is component-wise greater or equal than Min. func (r Rect) Norm() Rect { return Rect{ @@ -179,15 +188,6 @@ func (r Rect) Norm() Rect { } } -// String returns the string representation of the Rect. -// -// r := pixel.R(100, 50, 200, 300) -// r.String() // returns "Rect(100, 50, 200, 300)" -// fmt.Println(r) // Rect(100, 50, 200, 300) -func (r Rect) String() string { - return fmt.Sprintf("Rect(%v, %v, %v, %v)", r.Min.X(), r.Min.Y(), r.Max.X(), r.Max.Y()) -} - // W returns the width of the Rect. func (r Rect) W() float64 { return r.Max.X() - r.Min.X()