def _do_line_intersection(self, o):
        """
        Find the intersection of a LinearEntity and the ellipse.

        All LinearEntities are treated as a line and filtered at
        the end to see that they lie in o.

        """

        hr_sq = self.hradius ** 2
        vr_sq = self.vradius ** 2
        lp = o.points

        ldir = lp[1] - lp[0]
        diff = lp[0] - self.center
        mdir = Point(ldir.x/hr_sq, ldir.y/vr_sq)
        mdiff = Point(diff.x/hr_sq, diff.y/vr_sq)

        a = ldir.dot(mdir)
        b = ldir.dot(mdiff)
        c = diff.dot(mdiff) - 1
        det = simplify(b*b - a*c)

        result = []
        if det == 0:
            t = -b / a
            result.append(lp[0] + (lp[1] - lp[0]) * t)
        # Definite and potential symbolic intersections are allowed.
        elif (det > 0) != False:
            root = sqrt(det)
            t_a = (-b - root) / a
            t_b = (-b + root) / a
            result.append( lp[0] + (lp[1] - lp[0]) * t_a )
            result.append( lp[0] + (lp[1] - lp[0]) * t_b )

        return [r for r in result if r in o]
dataset/ETHPy150Open sympy/sympy/sympy/geometry/ellipse.py/Ellipse._do_line_intersection/original