예제 #1
0
        //ger radian angle of vector A and B
        public static double GetAngleOf2Vectors(Pt A, Pt B)
        {
            double length_A = get_vector_length(A);
            double length_B = get_vector_length(B);

            double cos_sita = A.Dot(B) / (length_A * length_B);

            double sita = Math.Acos(cos_sita);

            //degree in 0^180
            //sita = sita * 180.0 / PI;

            return sita;
        }
예제 #2
0
 public static int Ccw(Pt a, Pt b, Pt c)
 {
     b -= a;
     c -= a;
     if (b.Cross(c) > 0) return 1;   //counter clockwise
     if (b.Cross(c) < 0) return -1;  //clockwise
     if (b.Dot(c) < 0) return 2;     //c--a--b on line
     if (b.Norm() < c.Norm()) return -2; //a--b--c on line
     return 0;
 }