func (point Point) InsideShape(shape *Shape) bool { for _, rect := range shape.Rects { if point.Inside(rect) { return true } } return false }
(shape *Shape)
| 111 | // } |
| 112 | |
| 113 | func (point Vector) InsideShape(shape *Shape) int { |
| 114 | for index, rect := range shape.Rects { |
| 115 | if point.Inside(rect) { |
| 116 | return index |
| 117 | } |
| 118 | } |
| 119 | return -1 |
| 120 | } |
| 121 | |
| 122 | func (point Vector) Sub(other Vector) Vector { |
| 123 | return Vector{point.X - other.X, point.Y - other.Y} |