コード例 #1
0
ファイル: Form1.cs プロジェクト: Winterpuma/bmstu_CG
 void h2(Point center, int r1, int r2, Color c1, Color c2)
 {
     Canonical.DrawCircle(result, center, r1, c2);
     Canonical.DrawEllipse(result, center, r1, r2, c2);
     Parametric.DrawCircle(result, center, r1, c1);
     Parametric.DrawEllipse(result, center, r1, r2, c1);
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Winterpuma/bmstu_CG
        private void Draw(Point drawCenter, int Rx, int Ry = 1, int dRx = 0, int n = 1)
        {
            int dRy = Ry * dRx / Rx;

            for (int i = 0; i < n; i++)
            {
                Rx += dRx;
                Ry += dRy;
                if (radioButtonStandard.Checked)
                {
                    if (radioButtonCircle.Checked)
                    {
                        g.DrawEllipse(penDraw, drawCenter.X - Rx / 2, drawCenter.Y - Rx / 2, Rx, Rx);
                    }
                    else if (radioButtonEllipse.Checked)
                    {
                        g.DrawEllipse(penDraw, drawCenter.X - Rx / 2, drawCenter.Y - Ry / 2, Rx, Ry);
                    }
                }
                else if (radioButtonCanonic.Checked)
                {
                    if (radioButtonCircle.Checked)
                    {
                        Canonical.DrawCircle(result, drawCenter, Rx, cDraw);
                    }
                    else if (radioButtonEllipse.Checked)
                    {
                        Canonical.DrawEllipse(result, drawCenter, Rx, Ry, cDraw);
                    }
                }
                else if (radioButtonParametric.Checked)
                {
                    if (radioButtonCircle.Checked)
                    {
                        Parametric.DrawCircle(result, drawCenter, Rx, cDraw);
                    }
                    else if (radioButtonEllipse.Checked)
                    {
                        Parametric.DrawEllipse(result, drawCenter, Rx, Ry, cDraw);
                    }
                }
                else if (radioButtonMiddle.Checked)
                {
                    if (radioButtonCircle.Checked)
                    {
                        MiddleDot.DrawCircle(result, drawCenter, Rx, cDraw);
                    }
                    else if (radioButtonEllipse.Checked)
                    {
                        MiddleDot.DrawEllipse(result, drawCenter, Rx, Ry, cDraw);
                    }
                }
                else if (radioButtonBresenham.Checked)
                {
                    if (radioButtonCircle.Checked)
                    {
                        Bresenham.DrawCircle(result, drawCenter, Rx, cDraw);
                    }
                    else if (radioButtonEllipse.Checked)
                    {
                        Bresenham.DrawEllipse(result, drawCenter, Rx, Ry, cDraw);
                    }
                }
            }
            canvas.Refresh();
            checkBox1.Checked = false;
            checkBox1_CheckedChanged(null, null);
        }