Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     C = new PointF((int)Cx.Value, (int)Cy.Value);
     D = new PointF((int)Dx.Value, (int)Cy.Value);
     r = (float)C.Y / 2;
     Rectangle rectangle = new Rectangle(D,C,r);
     Circle circle = new Circle(r);
     Triangle triangle = new Triangle(D, C);
     if (C.Y > 0 && C.X >= 0 && C.X < D.X)
     {
         k = -C.Y / (D.X - C.X);
         b = C.Y - k * C.X;
         angle = (float)Math.Atan(k);
         rectSquare = rectangle.Sq;
         realSquare = triangle.Sq  + (circle.Sq/ 2);
         RealSquare.Text = realSquare.ToString();
         StartMonteKarlo();
     }
     else
     {
         MessageBox.Show("Некорректные данные!");
     }
 }
Beispiel #2
0
        private void button3_Click(object sender, EventArgs e)
        {

            this.Dx.Value = 4;
            this.Cx.Value = 3;
            this.Cy.Value = 7; 
            C = new PointF((int)Cx.Value, (int)Cy.Value);
            D = new PointF((int)Dx.Value, (int)Cy.Value);
            r = (float)C.Y / 2;
            k = -C.Y / (D.X - C.X);
            b = C.Y - k * C.X;
            Rectangle rectangle = new Rectangle(D, C, r);
            Circle circle = new Circle(r);
            Triangle triangle = new Triangle(D, C);
            angle = (float)Math.Atan(k);
            rectSquare = rectangle.Sq;
            realSquare = triangle.Sq + (circle.Sq / 2);
            RealSquare.Text = realSquare.ToString();
            StartMonteKarlo();
            
        }