def perpendicular_line(self, p):
        p = Point(p)
        d1, d2 = (self.p1 - self.p2).args
        if d2 == 0:  # If a horizontal line
            if p.y == self.p1.y:  # if p is on this linear entity
                return Line(p, p + Point(0, 1))
            else:
                p2 = Point(p.x, self.p1.y)
                return Line(p, p2)
        else:
            p2 = Point(p.x - d2, p.y + d1)
            return Line(p, p2)
Create a new Line perpendicular to this linear entity which passes
dataset/ETHPy150Open sympy/sympy/sympy/geometry/line.py/LinearEntity.perpendicular_line