'The intersection with other geometrical entity.
Parameters
Point, Point3D, LinearEntity, LinearEntity3D, Plane
Returns
List
Examples
>>> from sympy import Point, Point3D, Line, Line3D, Plane
>>> a = Plane(Point3D(1, 2, 3), normal_vector=(1, 1, 1))
>>> b = Point3D(1, 2, 3)
>>> a.intersection(b)
[Point3D(1, 2, 3)]
>>> c = Line3D(Point3D(1, 4, 7), Point3D(2, 2, 2))
>>> a.intersection(c)
[Point3D(2, 2, 2)]
>>> d = Plane(Point3D(6, 0, 0), normal_vector=(2, -5, 3))
>>> e = Plane(Point3D(2, 0, 0), normal_vector=(3, 4, -3))
>>> d.intersection(e)
[Line3D(Point3D(78/23, -24/23, 0), Point3D(147/23, 321/23, 23))]'

def intersection(self, o):

    from sympy.geometry.line import LinearEntity, LinearEntity3D
    if (not isinstance(o, GeometryEntity)):
        o = Point(o, dim=3)
    if isinstance(o, Point):
        if (o in self):
            return [o]
        else:
            return []
    if isinstance(o, (LinearEntity, LinearEntity3D)):
        if (o in self):
            (p1, p2) = (o.p1, o.p2)
            if isinstance(o, Segment):
                o = Segment3D(p1, p2)
            elif isinstance(o, Ray):
                o = Ray3D(p1, p2)
            elif isinstance(o, Line):
                o = Line3D(p1, p2)
            else:
                raise ValueError(('unhandled    linear    entity:    %s' % o.func))
            return [o]
        else:
            (x, y, z) = map(Dummy, 'xyz')
            t = Dummy()
            a = Point3D(o.arbitrary_point(t))
            b = self.equation(x, y, z)
            c = solve(b.subs(list(zip((x, y, z), a.args))), t)
            if (not c):
                return []
            else:
                p = a.subs(t, c[0])
                if (p not in self):
                    return []
                return [p]
    if isinstance(o, Plane):
        if self.equals(o):
            return [self]
        if self.is_parallel(o):
            return []
        else:
            (x, y, z) = map(Dummy, 'xyz')
            (a, b) = (Matrix([self.normal_vector]), Matrix([o.normal_vector]))
            c = list(a.cross(b))
            d = self.equation(x, y, z)
            e = o.equation(x, y, z)
            result = list(linsolve([d, e], x, y, z))[0]
            for i in (x, y, z):
                result = result.subs(i, 0)
            return [Line3D(Point3D(result), direction_ratio=c)]
