(self, o)
return self.source.distance(o)
Finds the shortest distance between the ray and a point.

        Raises
        ======

        NotImplementedError is raised if o is not a Point

        Examples
        ========

        >>> from sympy import Point, Ray
        >>> p1, p2 = Point(0, 0), Point(1, 1)
        >>> s = Ray(p1, p2)
        >>> s.distance(Point(-1, -1))
        sqrt(2)
Finds the shortest distance between the ray and a point.
Finds the shortest distance between the ray and a point .
def distance(self, o):
        """
        Finds the shortest distance between the ray and a point.

        Raises
        ======

        NotImplementedError is raised if o is not a Point

        Examples
        ========

        >>> from sympy import Point, Ray
        >>> p1, p2 = Point(0, 0), Point(1, 1)
        >>> s = Ray(p1, p2)
        >>> s.distance(Point(-1, -1))
        sqrt(2)
        """
        if not isinstance(o, Point):
            raise NotImplementedError
        s = self.perpendicular_segment(o)
        if isinstance(s, Point):
            if self.contains(s):
                return S.Zero
        else:
            # since arg-order is arbitrary, find the non-o point
            non_o = s.p1 if s.p1 != o else s.p2
            if self.contains(non_o):
                return Line(self).distance(o)  # = s.length but simpler
        # the following applies when neither of the above apply
        return self.source.distance(o)
def distance ( self , o ) : if not isinstance ( o , Point ) : raise NotImplementedError s = self . perpendicular_segment ( o ) if isinstance ( s , Point ) : if self . contains ( s ) : return S . Zero else : # since arg-order is arbitrary, find the non-o point non_o = s . p1 if s . p1 != o else s . p2 if self . contains ( non_o ) : return Line ( self ) . distance ( o ) # = s.length but simpler # the following applies when neither of the above apply return self . source . distance ( o )