//与X轴的夹角
Point pt1 = new Point(20, 30);
Point pt2 = new Point(30, 50);
double angle = Math.Atan2(pt2.Y - pt1.Y, pt2.X - pt1.X); //弧度:1.1071487177940904
double theta = angle * 180 / Math.PI;// 角度: 63.43494882292201
//与Y轴的夹角
double angle2 = Math.Atan2(pt2.X - pt1.X, pt2.Y - pt1.Y); //弧度:0.46364760900080609
double theta2 = angle2 * 180 / Math.PI; // 角度: 26.56505117707799
c# 两点连线与X轴Y轴的夹角
最新推荐文章于 2024-02-16 08:47:56 发布