tins2020/point.go

19 lines
407 B
Go
Raw Normal View History

2020-05-08 16:38:26 +00:00
package tins2020
type Point struct {
X, Y int32
2020-05-08 16:38:26 +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} }