2020-05-08 16:38:26 +00:00
|
|
|
package tins2020
|
|
|
|
|
|
|
|
type Point struct {
|
2020-05-09 11:55:37 +00:00
|
|
|
X, Y int32
|
2020-05-08 16:38:26 +00:00
|
|
|
}
|
2020-05-09 11:55:37 +00:00
|
|
|
|
|
|
|
func (p Point) Add(q Point) Point { return Pt(p.X+q.X, p.Y+q.Y) }
|
|
|
|
|
|
|
|
type PointF struct {
|
|
|
|
X, Y float32
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p PointF) Add(q PointF) PointF { return PtF(p.X+q.X, p.Y+q.Y) }
|
|
|
|
|
|
|
|
func (p PointF) Sub(q PointF) PointF { return PtF(p.X-q.X, p.Y-q.Y) }
|
|
|
|
|
|
|
|
func Pt(x, y int32) Point { return Point{x, y} }
|
|
|
|
func PtF(x, y float32) PointF { return PointF{x, y} }
|