public static Polygon RandomCircleSweep(FP scale, int vertexCount)
        {
            PolygonPoint point;

            PolygonPoint[] points;
            FP             radius = scale / 4;

            points = new PolygonPoint[vertexCount];
            for (int i = 0; i < vertexCount; i++)
            {
                do
                {
                    if (i % 250 == 0)
                    {
                        radius += scale / 2 * (0.5 - RNG.NextFP());
                    }
                    else if (i % 50 == 0)
                    {
                        radius += scale / 5 * (0.5 - RNG.NextFP());
                    }
                    else
                    {
                        radius += 25 * scale / vertexCount * (0.5 - RNG.NextFP());
                    }
                    radius = radius > scale / 2 ? scale / 2 : radius;
                    radius = radius < scale / 10 ? scale / 10 : radius;
                } while (radius < scale / 10 || radius > scale / 2);
                point = new PolygonPoint(radius * FP.Cos((PI_2 * i) / vertexCount),
                                         radius * FP.Sin((PI_2 * i) / vertexCount));
                points[i] = point;
            }
            return(new Polygon(points));
        }
Example #2
0
        public static List <TriangulationPoint> UniformDistribution(int n, FP scale)
        {
            List <TriangulationPoint> points = new List <TriangulationPoint>();

            for (int i = 0; i < n; i++)
            {
                points.Add(new TriangulationPoint(scale * (0.5 - RNG.NextFP()), scale * (0.5 - RNG.NextFP())));
            }
            return(points);
        }