Distance from a point to a line
<p>I have created a class "Point" and i want to calculate the shortest distance between a given point and a line ( characterized by 2 other points ), all points are known. 
I tried to use this formula : |Ax+By+C| / sqrt(A^2+B^2) , but i messed up and got more confused by the minute (mostly because of math formulas :( )...</p>

<p>I did find some sites where people asked this question too, but it either was not for Python or it was in a 3D system not 2D ...</p>

<p>​​<br>
Below is my class :   </p>

<pre><code>class Point:
        def __init__(self,initx,inity):
            self.x = initx
            self.y = inity
        def getX(self):
            return self.x
        def getY(self):
            return self.y
        def __str__(self):
            return "x=" + str(self.x) + ", y=" + str(self.y)
        def distance_from_point(self,the_other_point):
            dx = the_other_point.getX() - self.x
            dy = the_other_point.getY() - self.y
        def slope(self,other_point):
            if self.x - other_point.getX() == 0 :
                return 0
            else:
                panta = (self.y - other_point.getY())/ (self.x - other_point.getX())
                return panta
</code></pre>

<p>Can someone help me write a separate function or a method that does what i want ? I tried for 2 hours and I can't figure it out ...</p>