Exemplo n.º 1
0
 double Py(varf P)
 {
     return(PrY(P.y, P.z));
 }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ViewPort(50, 50, 650, 500);

            System.Drawing.Pen myPen;
            myPen = new System.Drawing.Pen(System.Drawing.Color.Chocolate);
            System.Drawing.Graphics formGraphics = this.CreateGraphics();

            System.IO.StreamReader Fc = new System.IO.StreamReader("C:/Users/Catalin/source/repos/WindowsFormsApp2/WindowsFormsApp2/FileCorp.txt");
            String Line = Fc.ReadLine();

            String[] Split = Line.Split(new Char[] { ' ', ',', '\t' });
            int      n = Convert.ToInt32(Split[0]); varf[] V = new varf[n + 1];

            for (int i = 1; i <= n; i++)
            {
                Line  = Fc.ReadLine();
                Split = Line.Split(new Char[] { ' ', ',', '\t' });
                int X = Convert.ToInt32(Split[0]);
                int Z = Convert.ToInt32(Split[1]);
                int Y = Convert.ToInt32(Split[2]) - 100; // y <--->z
                V[i] = new varf(X, Y, Z);                // V V V !!
            }
            Line  = Fc.ReadLine();
            Split = Line.Split(new Char[] { ' ', ',', '\t' });
            int m = Convert.ToInt32(Split[0]); muchie[] M = new muchie[m + 1];

            for (int j = 1; j <= m; j++) // Cit. Muchii
            {
                Line    = Fc.ReadLine();
                Split   = Line.Split(new Char[] { ' ', ',', '\t' });
                M[j]    = new muchie();
                M[j].st = Convert.ToInt32(Split[0]);
                M[j].dr = Convert.ToInt32(Split[1]);
            }

            Line  = Fc.ReadLine(); // Cit. Car. Pr. Tip, r, α
            Split = Line.Split(new Char[] { ' ', ',', '\t' });
            Tip   = Convert.ToInt32(Split[0]);
            Raza  = Convert.ToDouble(Split[1]);
            Alfa  = Convert.ToDouble(Split[2]);
            Fc.Close();

            DefPr(Raza, Alfa); // 1=Par(r,α), 2=Persp.(d,q);
            a = b = Px(V[1]); c = d = Py(V[1]);
            for (int i = 2; i <= n; i++)
            {
                double px = Px(V[i]);
                if (px < a)
                {
                    a = px;
                }
                else if (px > b)
                {
                    b = px;
                }
                double py = Py(V[i]);
                if (py < c)
                {
                    c = py;
                }
                else if (py > d)
                {
                    d = py;
                }
            }
            Window(a, d, b, c);          // Fereasta Reală

            for (int j = 1; j <= m; j++) // Desenare muchii
            {
                formGraphics.DrawLine(myPen, u(Px(V[M[j].st])), v(Py(V[M[j].st])),
                                      u(Px(V[M[j].dr])), v(Py(V[M[j].dr])));
            }
            myPen.Dispose();
            formGraphics.Dispose();
        }
Exemplo n.º 3
0
 double Px(varf P)
 {
     return(PrX(P.x, P.z));
 }