I have 3 points
p1 = 48.36736702002282, 11.112351406920268
p2 = 48.36728222003929, 11.112716801718284
p3 = 48.36720362305641,11.112587917596102
I want to find the perpendicular distance from p3
to p1
& p2
.
To do so, my plan is, create a line using p1
and p2
and then will try to find the perpendicular distance from point p3
to line(created from p1
& p2
).
I am following from HERE
Code from geeksforgeeks:
# Python program to find the distance between
# a given point and a given line in 2 D.
import math
# Function to find distance
def shortest_distance(x1, y1, a, b, c):
d = abs((a * x1 + b * y1 + c)) / (math.sqrt(a * a + b * b))
print("Perpendicular distance is"),d
# Driver Code
x1 = 5
y1 = 6
a = -2
b = 3
c = 4
shortest_distance(x1, y1, a, b, c)
What I am not able to understand is how to create line using p1
and p2
and what should be the value of x1, y1, a, b, c
in above code