Example #1
0
        //public CircularTrack(Point center, double radius, double angularVelocity, double creationTime, double annihilationTime, Angle phaseOrigin, Color color)
        //{
        //    Center = center;
        //    Radius = radius;
        //    AngularVelocity = angularVelocity;
        //    CreationTime = creationTime;
        //    AnnihilationTime = annihilationTime;
        //    PhaseOrigin = phaseOrigin;
        //    Color = color;
        //}

        public CircularTrack(Point origin, Vector velocity, double curvature, double creationTime, double annihilationTime, Color color)
        {
            Contract.Requires <ArgumentOutOfRangeException>(curvature != 0);
            Radius = 1 / GMath.Abs(curvature);
            if (curvature < 0)
            {
                Center = origin + new Vector(Radius, velocity.Direction - Angle.Deg(90));
            }
            else
            {
                Center = origin + new Vector(Radius, velocity.Direction + Angle.Deg(90));
            }
            AngularVelocity  = GMath.Sign(curvature) * velocity.Magnitude / Radius;
            PhaseOrigin      = GMath.Atan2(velocity - Angle.Deg(90 * GMath.Sign(curvature)));
            CreationTime     = creationTime;
            AnnihilationTime = annihilationTime;
            Color            = color;
        }
Example #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;
        }