Example #1
0
        } // End function DotP

        public static T Angle_Rad(MyVector2D <T> a, MyVector2D <T> b)
        {
            T axbx = Arithmetics <T> .Multiply(a.X, b.X);

            T ayby = Arithmetics <T> .Multiply(a.Y, b.Y);

            T azbz = Arithmetics <T> .ZERO;

            T sumAB = Arithmetics <T> .Sum(axbx, ayby, azbz);

            T ax2 = Arithmetics <T> .Pow(a.X, 2);

            T ay2 = Arithmetics <T> .Pow(a.Y, 2);

            T az2 = Arithmetics <T> .ZERO;

            T bx2 = Arithmetics <T> .Pow(b.X, 2);

            T by2 = Arithmetics <T> .Pow(b.Y, 2);

            T bz2 = Arithmetics <T> .ZERO;


            T aSquare = Arithmetics <T> .Sum(ax2, ay2, az2);

            T bSquare = Arithmetics <T> .Sum(bx2, by2, bz2);

            T val = Arithmetics <T> .Divide(sumAB,
                                            (
                                                Arithmetics <T> .Multiply(Arithmetics <T> .Sqrt(aSquare), Arithmetics <T> .Sqrt(bSquare))
                                            )
                                            );

            T nReturnValue = Arithmetics <T> .Acos(val);

            return(nReturnValue);
        }  // End function Angle_Rad