示例#1
0
 public static double dis2(MyPoint a, MyPoint b)
 {
     return(Math.Pow(Math.Abs((double)b.x - (double)a.x), 2) + Math.Pow(Math.Abs((double)b.y - (double)a.y), 2));
 }
示例#2
0
 public static MyPoint GetVector(MyPoint a, MyPoint b)
 {
     return(new MyPoint {
         x = b.x - a.x, y = b.y - a.y
     });
 }
示例#3
0
 public static double length(MyPoint a, MyPoint b)
 {
     return(Math.Sqrt(Math.Pow(Math.Abs((double)b.x - (double)a.x), 2) + Math.Pow(Math.Abs((double)b.y - (double)a.y), 2)));
 }
示例#4
0
 public static bool LineJudge(MyPoint A1, MyPoint A2, MyPoint B1, MyPoint B2)
 {
     return(dir(A1, A2, B1) * dir(A1, A2, B2) <= 0 && dir(B1, B2, A1) * dir(B1, B2, A2) <= 0);
 }
示例#5
0
 public static double Multiply(MyPoint other1, MyPoint other2)
 {
     return((double)(other1.x * other2.y - other1.y * other2.x));
 }
示例#6
0
 public static double disline(MyPoint a, MyPoint b, MyPoint p)
 {
     return(Math.Abs(GetCross(a, b, p)) / Math.Sqrt(dis2(a, b)));
 }