package mx // The type describes a simple // math circle. type Circle struct { Center Vector Radius Float } func (c Circle) ContainsPoint( pt Vector, ) bool { d := c.Center.Sub(pt) dx, dy := d.XY() d2 := dx*dx + dy*dy r2 := c.Radius*c.Radius return r2 > d2 } func (c Circle) GetContainedPoints( pts Vectors, ) Vectors { ret := make(Vectors, 0, len(pts)) for _, pt := range pts { if c.ContainsPoint(pt) { ret = append(ret, pt) } } return ret }