Perpendicular distance between a point and a Line in 2 D | Java program to find the distance between a given point and a given line in 2 D . ; Function to find distance ; Driver code
import java . io . * ; class GFG { static void shortest_distance ( float x1 , float y1 , float a , float b , float c ) { double d = Math . abs ( ( ( a * x1 + b * y1 + c ) ) / ( Math . sqrt ( a * a + b * b ) ) ) ; System . out . println ( " Perpendicular ▁ " + " distance ▁ is ▁ " + d ) ; return ; } public static void main ( String [ ] args ) { float x1 = 5 ; float y1 = 6 ; float a = - 2 ; float b = 3 ; float c = 4 ; shortest_distance ( x1 , y1 , a , b , c ) ; } }