#include <bits/stdc++.h> using namespace std; struct point{ double x,y; point(double A,double B){ x=A,y=B; } point() = default; }; struct line{ point point_A,point_B; line(point A,point B){ point_A = A,point_B = B; } line() = default; }; double getDistance(point P, line L){ // TODO: 计算点P到直线L的距离(两点式) double a=abs((L.point_A.x-L.point_B.x)*(P.y-L.point_B.y)-(L.point_A.y-L.point_B.y)*(P.x-L.point_B.x)); double n=sqrt((L.point_A.x-L.point_B.x)*(L.point_A.x-L.point_B.x)+(L.point_A.y-L.point_B.y)*(L.point_A.y-L.point_B.y)); return a/n; }