Added methods to calculate width & height for RectangleF.
This commit is contained in:
parent
e181615d9e
commit
cac351f290
@ -16,7 +16,17 @@ func RectF(x0, y0, x1, y1 float64) RectangleF {
|
||||
return RectangleF{PtF(x0, y0), PtF(x1, y1)}
|
||||
}
|
||||
|
||||
// Dx returns the width of r.
|
||||
func (r RectangleF) Dx() float64 {
|
||||
return r.Max.X - r.Min.X
|
||||
}
|
||||
|
||||
// Dy returns the height of r.
|
||||
func (r RectangleF) Dy() float64 {
|
||||
return r.Max.Y - r.Min.Y
|
||||
}
|
||||
|
||||
// Size returns the size of the rectangle.
|
||||
func (r RectangleF) Size() PointF {
|
||||
return PtF(r.Max.X-r.Min.X, r.Max.Y-r.Min.Y)
|
||||
return PointF{r.Max.X - r.Min.X, r.Max.Y - r.Min.Y}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user