Esempio n. 1
0
    static void Main()
    {
        int x = 10;
        int y = 25;
        int z = x + y;

        //Console.Write("Sum of x + y = "+ z);


        CRectangulo[] rects = new CRectangulo[5];

        rects[0] = new CRectangulo(10, 12);
        rects[1] = new CRectangulo(5, 2);

        rects[2] = new CRectangulo(10, 10);

        rects[3] = new CRectangulo(29, 2);

        rects[4] = new CRectangulo(4, 8);

        foreach (CRectangulo rect in rects)
        {
            Console.WriteLine(rect);
        }

        Console.WriteLine("*********************");

        Array.Sort(rects);

        foreach (CRectangulo rect in rects)
        {
            Console.WriteLine(rect);
        }
    }
Esempio n. 2
0
        public void CalculaAreaRectangulo()
        {
            CRectangulo rectangulo = new CRectangulo();
            Dictionary <string, double> valores = new Dictionary <string, double>();

            valores.Add("base", 30d);
            valores.Add("altura", 10d);

            Assert.AreEqual(300d, rectangulo.CalcularArea(valores));
        }
Esempio n. 3
0
        public void CalculaPerimetroRectangulo()
        {
            CRectangulo rectangulo = new CRectangulo();
            Dictionary <string, double> valores = new Dictionary <string, double>();

            valores.Add("lado", 25d);
            valores.Add("ancho", 15d);
            double perimetro = rectangulo.CalcularPerimetro(valores);

            Assert.AreEqual(80d, perimetro);
        }
Esempio n. 4
0
    int IComparable.CompareTo(object obj)
    {
        CRectangulo temp = (CRectangulo)obj;

        if (Area > temp.Area)
        {
            return(1);
        }

        if (Area < temp.Area)
        {
            return(-1);
        }

        return(0);
    }
Esempio n. 5
0
        public static CRectangulo Crear_Seccion_DES(string Nombre_seccion, float b, float h, float tw, float tf, MAT_CONCRETE material, int[] Diametros_Seccion, int CapasX, int CapasY, int CapasXw, int CapasYw)
        {
            CRectangulo temp = new CRectangulo(Nombre_seccion, b / 100, h / 100, material, TipodeSeccion.Rectangular, new List <float[]>());

            temp.Refuerzos  = Set_Refuerzo_Seccion(Diametros_Seccion, CapasX, CapasY, CapasXw, CapasYw, b, h, tw, tf);
            temp.Acero_Long = temp.Refuerzos.Sum(X => X.As_Long);

            temp.Estribo = new Estribo(3)
            {
                NoRamasH1 = CapasY,
                NoRamasV1 = CapasX
            };

            temp.Calc_vol_inex(r: 0.04f, FY: 4220, gDE: GDE.DES);
            return(temp);
        }
 static void Main(string[] args)
 {
     #region Usando CRectangulo Para IComparable
     //IComparable.CompareTo() implementado
     CRectangulo[] rectangulos = new CRectangulo[5];
     rectangulos[0] = new CRectangulo(7, 5);
     rectangulos[1] = new CRectangulo(4, 1);
     rectangulos[2] = new CRectangulo(2, 8);
     rectangulos[3] = new CRectangulo(1, 9);
     rectangulos[4] = new CRectangulo(4, 3);
     foreach (CRectangulo r in rectangulos)
     {
         Console.WriteLine(r);
     }
     Console.WriteLine("-------------");
     Array.Sort(rectangulos);//ejecucion de Icomparable.CompareTo
     foreach (CRectangulo r in rectangulos)
     {
         Console.WriteLine(r);
     }
     Console.ReadLine();
     #endregion
     Console.ReadLine();
 }
        private void Crear_Seccion(string Tipo_Seccion, float b, float h, float tw, float tf, float r)
        {
            ISeccion       N_Seccion = null;
            string         Nombre_Seccion = "";
            GDE            gde = GDE.DMO;
            List <float[]> Vertices_Temp = new List <float[]>();
            List <float[]> Vertices = new List <float[]>();
            double         Xc, Yc;
            double         Numerador, Denominador;

            MAT_CONCRETE material = new MAT_CONCRETE()
            {
                Name = "H" + tbFc.Text,
                FC   = Convert.ToSingle(tbFc.Text)
            };

            if (Radio_Dmo.Checked)
            {
                gde = GDE.DMO;
            }

            if (Radio_Des.Checked)
            {
                gde = GDE.DES;
            }

            if (Tipo_Seccion == TipodeSeccion.Rectangular.ToString())
            {
                Nombre_Seccion = $"C{b}X{h}{material.Name}";
                N_Seccion      = new CRectangulo(Nombre_Seccion, b / 100, h / 100, material, TipodeSeccion.Rectangular, null);
                N_Seccion.Calc_vol_inex(r / 100, 4220, gde);
                N_Seccion.Refuerzo_Base(r);
            }

            if (Tipo_Seccion == TipodeSeccion.Circle.ToString())
            {
                Nombre_Seccion = $"C{b}{material.Name}";
                N_Seccion      = new CCirculo(Nombre_Seccion, b / 200, new double[] { 0, 0 }, material, TipodeSeccion.Circle, null);
                N_Seccion.Calc_vol_inex(r / 100, 4220, gde);
                N_Seccion.Refuerzo_Base(r);
            }

            if (Tipo_Seccion == TipodeSeccion.Tee.ToString() | Tipo_Seccion == TipodeSeccion.L.ToString())
            {
                Nombre_Seccion = $"C{b}X{h}X{tw}X{tf}{Tipo_Seccion}{material.Name}";

                if (Tipo_Seccion == TipodeSeccion.Tee.ToString())
                {
                    Vertices_Temp.Add(new float[] { 0, h / 200 });
                    Vertices_Temp.Add(new float[] { 0, (h - tw) / 200 });
                    Vertices_Temp.Add(new float[] { (b - tf) / 400, (h - tw) / 200 });
                    Vertices_Temp.Add(new float[] { (b - tf) / 400, 0 });
                    Vertices_Temp.Add(new float[] { (b + tf) / 400, 0 });
                    Vertices_Temp.Add(new float[] { (b + tf) / 400, (h - tw) / 200 });
                    Vertices_Temp.Add(new float[] { b / 200, (h - tw) / 200 });
                    Vertices_Temp.Add(new float[] { b / 200, h / 200 });

                    Numerador   = ((b / 2) * b * tw) + ((b / 2) * (tf * (h - tw)));
                    Denominador = (b * tw) + (tf * (h - tw));

                    Xc = b / 200;

                    double y1 = (h - tw) * (h - tw) * tf / 2;
                    double y2 = (h - (tw / 2)) * b * tw;

                    Numerador   = y1 + y2;
                    Denominador = (b * tw) + (tf * (h - tw));

                    Yc = h / 200;

                    for (int i = 0; i < Vertices_Temp.Count; i++)
                    {
                        var Aux = B_Operaciones_Matricialesl.Operaciones.Traslacion(Vertices_Temp[i][0] - Xc, Vertices_Temp[i][1] - Yc, Vertices_Temp[i][0], Vertices_Temp[i][1]);
                        Vertices.Add(new float[] { (float)Aux[0], (float)Aux[1] });
                    }

                    N_Seccion = new CSD(Nombre_Seccion, b / 100, h / 100, tw / 100, tf / 100, material, TipodeSeccion.Tee, Vertices);
                }

                if (Tipo_Seccion == TipodeSeccion.L.ToString())
                {
                    Vertices_Temp.Add(new float[] { 0, 0 });
                    Vertices_Temp.Add(new float[] { b / 200, 0 });
                    Vertices_Temp.Add(new float[] { b / 200, tw / 200 });
                    Vertices_Temp.Add(new float[] { tf / 200, tw / 200 });
                    Vertices_Temp.Add(new float[] { tf / 200, h / 200 });
                    Vertices_Temp.Add(new float[] { 0, h / 200 });

                    Numerador   = ((b / 2) * b * tw) + ((tf / 2) * (tf * (h - tw)));
                    Denominador = (b * tw) + (tf * (h - tw));

                    Xc = b / 200;

                    Numerador   = ((tw / 2) * b * tw) + ((h + tf / 2) * (tf * (h - tw)));
                    Denominador = (b * tw) + (tf * (h - tw));

                    Yc = h / 200;

                    for (int i = 0; i < Vertices_Temp.Count; i++)
                    {
                        var Aux = B_Operaciones_Matricialesl.Operaciones.Traslacion(Vertices_Temp[i][0] - Xc, Vertices_Temp[i][1] - Yc, Vertices_Temp[i][0], Vertices_Temp[i][1]);
                        Vertices.Add(new float[] { (float)Aux[0], (float)Aux[1] });
                    }

                    N_Seccion = new CSD(Nombre_Seccion, b / 100, h / 100, tw / 100, tf / 100, material, TipodeSeccion.L, Vertices);
                }

                N_Seccion.Calc_vol_inex(r / 100, 4220, gde);
                N_Seccion.Refuerzo_Base(r);
            }

            if (N_Seccion != null)
            {
                if (Radio_Dmo.Checked)
                {
                    if (Form1.secciones_predef.Secciones_DMO.Exists(x => x.Equals(N_Seccion)) == false)
                    {
                        Form1.secciones_predef.Secciones_DMO.Add(N_Seccion);
                    }
                }
                if (Radio_Des.Checked)
                {
                    if (Form1.secciones_predef.Secciones_DES.Exists(x => x.Equals(N_Seccion)) == false)
                    {
                        Form1.secciones_predef.Secciones_DES.Add(N_Seccion);
                    }
                }
            }
        }