code: func (l *Line) SquaredDistanceFrom(point *Point) float64 {
  	x := l.a[0]
  	y := l.a[1]
  	dx := l.b[0] - x
  	dy := l.b[1] - y
  
  	if dx != 0 || dy != 0 {
  		t := ((point[0]-x)*dx + (point[1]-y)*dy) / (dx*dx + dy*dy)
  
  		if t > 1 {
  			x = l.b[0]
  			y = l.b[1]
  		} else if t > 0 {
  			x += dx * t
  			y += dy * t
  		}
  	}
  
  	dx = point[0] - x
  	dy = point[1] - y
  
  	return dx*dx + dy*dy
  }
docs: // SquaredDistanceFrom does NOT use spherical geometry. It finds the squared distance from
  // the line using standard Euclidean geometry, using the units the points are in.