// Returns the unit vector from a, and it's magnitude func (a *Point) Normalize() (Point, float32) { mag := math.Sqrt(a.X*a.X + a.Y*a.Y) unit := Point{a.X / mag, a.Y / mag} return unit, mag }
// Returns the squared euclidean distance from a point to a line *segment* func (l *Line) PointDistance(point Point) float32 { return math.Sqrt(l.PointDistanceSquared(point)) }
func (p *Point) PointDistance(p2 Point) float32 { return math.Sqrt(p.PointDistanceSquared(p2)) }