#NEWLINE# def perpendicular_line( self , p ) : #NEWLINE# #INDENT# 'Create a new Line perpendicular to this linear entity which passes\n        through the point `p`.\n\n        Parameters\n        ==========\n\n        p : Point\n\n        Returns\n        =======\n\n        line : Line\n\n        See Also\n        ========\n\n        is_perpendicular, perpendicular_segment\n\n        Examples\n        ========\n\n        >>> from sympy import Point, Line\n        >>> p1, p2, p3 = Point(0, 0), Point(2, 3), Point(-2, 2)\n        >>> l1 = Line(p1, p2)\n        >>> l2 = l1.perpendicular_line(p3)\n        >>> p3 in l2\n        True\n        >>> l1.is_perpendicular(l2)\n        True\n\n        ' #NEWLINE# p = Point ( p ) #NEWLINE# ( d1 , d2 ) = ( self . p1 - self . p2 ) . args #NEWLINE# if ( d2 == 0 ) : #NEWLINE# #INDENT# if ( p . y == self . p1 . y ) : #NEWLINE# #INDENT# return Line ( p , ( p + Point ( 0 , 1 ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# p2 = Point ( p . x , self . p1 . y ) #NEWLINE# return Line ( p , p ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# p2 = Point ( ( p . x - d2 ) , ( p . y + d1 ) ) #NEWLINE# return Line ( p , p2 )