1234567891011121314151617181920212223 |
- package rectangle
- type Rectangle struct {
- X float64
- Y float64
- W float64
- H float64
- }
- func New(x, y, w, h float64) Rectangle {
- r := Rectangle{ x, y, w, h }
- return r
- }
- func (rect Rectangle) X2() float64 {
- return rect.X + rect.W
- }
- func (rect Rectangle) Y2() float64 {
- return rect.Y + rect.H
- }
|