19 lines
407 B
Go
19 lines
407 B
Go
package tins2020
|
|
|
|
type Point struct {
|
|
X, Y int32
|
|
}
|
|
|
|
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} }
|