1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package layout
type Point struct {
X, Y int
}
func (p Point) Add(other Point) Point {
return Point{X: p.X + other.X, Y: p.Y + other.Y}
}
func (p Point) Sub(other Point) Point {
return Point{X: p.X - other.X, Y: p.Y - other.Y}
}
func (p Point) In(r Rect) bool {
return r.Contains(p.X, p.Y)
}
|