Ejemplo n.º 1
0
        public List <Node> RandomizeStartedNodesInTriangle(int nodesCount, CoordRange startedRange, int areaSize)
        {
            var points = new List <Point>(nodesCount);

            for (int index = 0; index < nodesCount; index++)
            {
                points.Add(RandomizePointInTriangle(startedRange, areaSize));
            }

            return(Translator.TranslatePointsToNodes(points));
        }
Ejemplo n.º 2
0
        public Point RandomizePointInTriangle(CoordRange coordRange, int areaSize)
        {
            int pointX, pointY, xBoundMin, xBoundMax;

            do
            {
                pointY    = ExclusiveRandomizeInRange(coordRange.MinY, coordRange.MaxY);
                xBoundMin = (areaSize + (areaSize / 10) - pointY) / 2;
                xBoundMax = (pointY + areaSize - (areaSize / 10)) / 2;
                pointX    = ExclusiveRandomizeInRange(coordRange.MinX, coordRange.MaxX);
            } while (pointX < xBoundMin || pointX > xBoundMax);

            return(new Point(pointX, pointY));
        }