计算斜率k
double calculate_k(float x1,float y1,float x2,float y2) { double k1 = 0.00001; if (x1 == x2 && y1 == y2)//1.共位 { k1 = 0.00001; } else if (x1 == x2 && y1 != y2) //2.共X { k1 = 0.00001; } else if (x1 != x2 && y1 == y2) //3.共Y { k1 = 1.0000; } else //4.共斜率 { k1 = (y2 - y1) / (x2 - x1); } return k1; }
################
标签:x1,y1,float,斜率,k1,计算,x2,y2 From: https://www.cnblogs.com/herd/p/17231817.html