Ejemplo n.º 1
0
        public static List <DgLine> Design1(double height, double width)
        {
            var topLeft     = new DgPoint(0, 0);
            var topRight    = new DgPoint(width, 0);
            var bottomLeft  = new DgPoint(0, height);
            var bottomRight = new DgPoint(width, height);
            var middle      = new DgPoint(width / 2, height / 2);

            var lines = new List <DgLine>();

            lines.AddRange(ShapeSpin(new List <DgPoint> {
                middle, topRight, topLeft
            }));
            lines.AddRange(ShapeSpin(new List <DgPoint> {
                middle, topLeft, bottomLeft
            }));
            lines.AddRange(ShapeSpin(new List <DgPoint> {
                middle, bottomLeft, bottomRight
            }));
            lines.AddRange(ShapeSpin(new List <DgPoint> {
                middle, bottomRight, topRight
            }));

            return(lines);
        }
Ejemplo n.º 2
0
        public static List <DgLine> Design3(double height, double width)
        {
            const double spacing = 160;

            var points = new List <DgPoint>();

            for (int y = -1; y < height / spacing + 1; y++)
            {
                for (int x = -1; x < width / spacing + 1; x++)
                {
                    if (y % 2 == 0)
                    {
                        points.Add(new DgPoint(x * spacing, y * spacing));
                    }
                    else
                    {
                        points.Add(new DgPoint(x * spacing + (0.5 * spacing), y * spacing));
                    }
                }
            }

            var lines = new List <DgLine>();

            foreach (var point in points)
            {
                var top    = point;
                var right  = new DgPoint(point.X + (0.5 * spacing), point.Y + spacing);
                var left   = new DgPoint(point.X - (0.5 * spacing), point.Y + spacing);
                var bottom = new DgPoint(point.X, point.Y + (2 * spacing));

                lines.AddRange(ShapeSpin(new List <DgPoint> {
                    top, right, left
                }, 0.05f));
                lines.AddRange(ShapeSpin(new List <DgPoint> {
                    right, left, bottom
                }, 0.05f));
            }

            return(lines);
        }