示例#1
0
        /// <summary>
        /// Generates a random angle within an arc
        /// </summary>
        /// <param name="arcStart">lowest angle of an arc</param>
        /// <param name="arcEnd">highest angle of an arc</param>
        /// <returns>random angle from within an arc</returns>
        public static double RandomAngle(double arcStart, double arcEnd)
        {
            arcStart = Numerical.Modulo(arcStart, 360);
            arcEnd   = Numerical.Modulo(arcEnd, 360);
            if (arcStart >= arcEnd)
            {
                arcEnd += 360;
            }
            double angle = arcStart + (RNG.NextDouble() * (arcEnd - arcStart));

            return(Numerical.Modulo(angle, 360));
        }
示例#2
0
        /// <summary>
        /// Adds all of the points within a circle definition to an existing blob
        /// </summary>
        /// <param name="blob"></param>
        /// <param name="circleCenter"></param>
        /// <param name="circleRadius"></param>
        public static void AddMinimapIconToBlob(ref Blob blob, Point circleCenter)
        {
            const int circleRadius = 7;
            double    maxRadius    = circleRadius + Numerical.NonZero(0);
            Point     point;

            for (int x = circleCenter.X - circleRadius; x <= circleCenter.X + circleCenter.X; x++)
            {
                for (int y = circleCenter.Y - circleRadius; y <= circleCenter.Y + circleRadius; y++)
                {
                    point = new Point(x, y);
                    if (DistanceBetweenPoints(point, circleCenter) <= maxRadius)
                    {
                        blob.AddPixel(point, true);
                    }
                }
            }
        }