Exemple #1
0
        /// <summary>
        /// 向量夹角
        /// </summary>
        /// <param name="v1"></param>
        /// <param name="v2"></param>
        /// <returns>返回值范围:[0,360)</returns>
        public static float Angle(GVector2 v1, GVector2 v2)
        {
            float v = GMath.Atan(v1.x, v1.y) - GMath.Atan(v2.x, v2.y);

            if (v < 0)
            {
                v += 360;
            }
            return(v);
        }
Exemple #2
0
        public static void gmathtest(float[] c)
        {
            int i = 0;

            c[i++] = GMath.Abs((long)-42.3F);
            c[i++] = GMath.Acos(42.3F);
            c[i++] = GMath.Asin(42.3F);
            c[i++] = GMath.Atan(42.3F);
            c[i++] = GMath.Atan2(42.3F, 3.8F);
            c[i++] = GMath.Ceiling(42.3F);
            c[i++] = GMath.Cos(42.3F);
            c[i++] = GMath.Cosh(2.3F);
            c[i++] = GMath.E;
            c[i++] = GMath.Exp(1.3F);
            c[i++] = GMath.Floor(3.9F);
            c[i++] = GMath.Log(5.8F);
            c[i++] = GMath.Log10(3.5F);
            c[i++] = GMath.Max(4.8F, 4.9F);
            c[i++] = GMath.Min(4.8F, 4.9F);
            c[i++] = GMath.PI;
            c[i++] = GMath.Pow(4.4F, 2.3F);
            c[i++] = GMath.Round(5.5F);
            c[i++] = GMath.Sin(4.2F);
            c[i++] = GMath.Sinh(3.1F);
            c[i++] = GMath.Sqrt(8.1F);
            c[i++] = GMath.Sqrt(-1.0F);
            c[i++] = GMath.Tan(4.3F);
            c[i++] = GMath.Tanh(8.1F);
            //c[i++] = (float)(Single.IsNaN(GMath.Sqrt(-1.0F)) ? 1.0F : 0.0F);//GMath.Sqrt(-1.0F)
            c[i++] = GMath.Truncate(10.14334325F);
            float zero = 0.0F;

            c[i++] = Single.IsInfinity(1 / zero) ? 1.0F : 0.0F;
            c[60]  = Single.PositiveInfinity;
            c[61]  = Single.NegativeInfinity;
            c[62]  = Single.NaN;
        }