Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            canvas = new Bitmap(1920, 1024);
            Point center = new Point(bitMap.Size.Width / 2, bitMap.Size.Height / 2);

            vertexRectangle = new Rectangle()
            {
                Size = new Size(Vertex.radius, Vertex.radius)
            };
            currentPolygon = new LinkedList <Vertex>(PolygonFactory.GetRegularPolygon(center, 6));
            polygons       = new List <LinkedList <Vertex> > {
                currentPolygon
            };

            // Add initial relations
            Vertex v1 = currentPolygon.First.Value;
            var    v3 = v1.next.next;

            _ = new EqualLengthRelation(v1, v3);
            _ = new EqualLengthRelation(v3.next, v3.next.next);
            //_ = new PerpendicularityRelation(v1.next, v3.next);


            centreXTextBox.Text = center.X.ToString();
            centreYTextBox.Text = center.Y.ToString();
        }
Ejemplo n.º 2
0
        private void GeneratePolygonButton_Click(object sender, EventArgs e)
        {
            if (!TryParseAllParameters(out Point centre, out int numOfPoints, out int sideLength))
            {
                MessageBox.Show("Błąd", "Niewłaściwa wartość", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            polygons.Add(new LinkedList <Vertex>(PolygonFactory.GetRegularPolygon(centre, numOfPoints, sideLength)));
            ClearAllSelection();
            GetNewCurrentPolygon();
            if (inAddPolygonMode)
            {
                TurnOffAddPolygonMode();
            }

            menuControl.SelectedTab = tab1;
            bitMap.Invalidate();
        }