def contains?(x, y)
      points_distance(x1, y1, x, y) <= length &&
      points_distance(x2, y2, x, y) <= length &&
      (((@y2 - @y1) * x - (@x2 - @x1) * y + @x2 * @y1 - @y2 * @x1).abs / length) <= 0.5 * @width
    end
def contains?(x, y)
      points_distance(x1, y1, x, y) <= length &&
      points_distance(x2, y2, x, y) <= length &&
      (((@y2 - @y1) * x - (@x2 - @x1) * y + @x2 * @y1 - @y2 * @x1).abs / length) <= 0.5 * @width
    end
Line contains a point if the point is closer than the length of line from
 both ends and if the distance from point to line is smaller than half of
 the width. For reference:
   https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line