#NEWLINE# def distance( self , o ) : #NEWLINE# #INDENT# '\n        Finds the shortest distance between the ray and a point.\n\n        Raises\n        ======\n\n        NotImplementedError is raised if o is not a Point\n\n        Examples\n        ========\n\n        >>> from sympy import Point3D, Ray3D\n        >>> p1, p2 = Point3D(0, 0, 0), Point3D(1, 1, 2)\n        >>> s = Ray3D(p1, p2)\n        >>> s.distance(Point3D(-1, -1, 2))\n        sqrt(6)\n        >>> s.distance((-1, -1, 2))\n        sqrt(6)\n        ' #NEWLINE# if ( not isinstance ( o , Point3D ) ) : #NEWLINE# #INDENT# if is_sequence ( o ) : #NEWLINE# #INDENT# o = Point3D ( o ) #NEWLINE# #UNINDENT# #UNINDENT# if ( o in self ) : #NEWLINE# #INDENT# return S . Zero #NEWLINE# #UNINDENT# s = self . perpendicular_segment ( o ) #NEWLINE# if ( not isinstance ( s , Point3D ) ) : #NEWLINE# #INDENT# non_o = ( s . p1 if ( s . p1 == o ) else non_o . p2 ) #NEWLINE# if self . contains ( non_o ) : #NEWLINE# #INDENT# return Line3D ( self ) . distance ( o ) #NEWLINE# #UNINDENT# #UNINDENT# return self . source . distance ( o )