计算斜率k
计算斜率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; }
################
QQ 3087438119