Example #1
0
        public override Location GetRandomLocation()
        {
            double ba = Rnd.NextDouble();
            double ca = Rnd.NextDouble();

            if ((ba + ca) > 1)
            {
                ba = 1 - ba;
                ca = 1 - ca;
            }

            int x = Ax + (int)((ba * BAx) + (ca * CAx));
            int y = Ay + (int)((ba * BAy) + (ca * CAy));

            return(new Location(x, y, Rnd.Get(_minZ, _maxZ)));
        }
Example #2
0
        public override Location GetRandomLocation()
        {
            int size = Rnd.Get(Size);

            foreach (AShape shape in Shapes)
            {
                size -= shape.GetSize();
                if (size < 0)
                {
                    return(shape.GetRandomLocation());
                }
            }

            // should never happen
            return(null);
        }
Example #3
0
 public override Location GetRandomLocation()
 {
     return(new Location(X + Rnd.Get(A), Y + Rnd.Get(A), 0));
 }
Example #4
0
 public override Location GetRandomLocation()
 {
     return(new Location(X + Rnd.Get(W), Y + Rnd.Get(H), Rnd.Get(_minZ, _maxZ)));
 }
Example #5
0
        public override Location GetRandomLocation()
        {
            // get uniform distance and angle
            double distance = Math.Sqrt(Rnd.NextDouble()) * R;
            double angle    = Rnd.NextDouble() * Math.PI * 2;

            return(new Location((int)(distance * Math.Cos(angle)), (int)(distance * Math.Sin(angle)), Rnd.Get(_minZ, _maxZ)));
        }