def _get_nearest_line(self, x, y):

        if not (self.b + self.r < x < self.w - self.b):  # In a gutter
            return None

        for i, line in enumerate(self.lines):
            # Check to see if a line drawns from each lines start point is
            # parallel to that line. If it is, then we hit the line.
            orig_x, orig_y = line[:2]
            line_x, line_y = line[2:]
            line = np.array([line_x - orig_x, line_y - orig_y])
            click = np.array([x - orig_x, y - orig_y])
            angle = np.dot(line, click) / norm(line) / norm(click)
            if is_close_to_one(angle):
                return i
Returns the nearest line index, or None.
dataset/ETHPy150Open jminardi/RobotBrain/robot_brain/servers/sensor_server/links_component.py/LinksComponent._get_nearest_line