Exemplo n.º 1
0
        public void RotateAroundEdge(List <_3D_Point> p, int iWhichEdge, float th)
        {
            _3D_Point p1 = new _3D_Point(p[L_Edges[iWhichEdge].i]);
            _3D_Point p2 = new _3D_Point(p[L_Edges[iWhichEdge].j]);

            Transformation.RotateArbitrary(L_3D_Pts, p1, p2, th);
        }
Exemplo n.º 2
0
        public void DrawYourSelf(Graphics g, bool rgb)
        {
            Font FF = new Font("System", 10);

            for (int k = 0; k < L_Edges.Count; k++)
            {
                int i = L_Edges[k].i;
                int j = L_Edges[k].j;

                _3D_Point pi = L_3D_Pts[i];
                _3D_Point pj = L_3D_Pts[j];

                PointF pi_2D = cam.TransformToOrigin_And_Rotate_And_Project(pi);
                PointF pj_2D = cam.TransformToOrigin_And_Rotate_And_Project(pj);


                Pen Pn;

                if (rgb)
                {
                    Pn = new Pen(Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256)));
                }
                else
                {
                    Pn = new Pen(L_Edges[k].cl, 2);
                }

                g.DrawLine(Pn, pi_2D.X, pi_2D.Y, pj_2D.X, pj_2D.Y);
                //g.FillEllipse(Brushes.Red , pi_2D.X-5, pi_2D.Y-5, 10,10);
            }
        }
        public static void RotateArbitrary(List <_3D_Point> L_Pts,
                                           _3D_Point v1,
                                           _3D_Point v2,
                                           float ang)
        {
            Transformation.TranslateX(L_Pts, v1.X * -1);
            Transformation.TranslateY(L_Pts, v1.Y * -1);
            Transformation.TranslateZ(L_Pts, v1.Z * -1);

            float dx = v2.X - v1.X;
            float dy = v2.Y - v1.Y;
            float dz = v2.Z - v1.Z;

            float theta = (float)Math.Atan2(dy, dx);
            float phi   = (float)Math.Atan2(Math.Sqrt(dx * dx + dy * dy), dz);

            theta = (float)(theta * 180 / Math.PI);
            phi   = (float)(phi * 180 / Math.PI);
            Transformation.RotatZ(L_Pts, theta * -1);
            Transformation.RotatY(L_Pts, phi * -1);

            Transformation.RotatZ(L_Pts, ang);

            Transformation.RotatY(L_Pts, phi * 1);
            Transformation.RotatZ(L_Pts, theta * 1);
            Transformation.TranslateZ(L_Pts, v1.Z * 1);
            Transformation.TranslateY(L_Pts, v1.Y * 1);
            Transformation.TranslateX(L_Pts, v1.X * 1);
        }
 public static void TranslateZ(List <_3D_Point> L_Pts, float tz)
 {
     for (int i = 0; i < L_Pts.Count; i++)
     {
         _3D_Point p = L_Pts[i];
         p.Z += tz;
     }
 }
 public static void TranslateY(List <_3D_Point> L_Pts, float ty)
 {
     for (int i = 0; i < L_Pts.Count; i++)
     {
         _3D_Point p = L_Pts[i];
         p.Y += ty;
     }
 }
 public static void TranslateX(List <_3D_Point> L_Pts, float tx)
 {
     for (int i = 0; i < L_Pts.Count; i++)
     {
         _3D_Point p = L_Pts[i];
         p.X += tx;
     }
 }
Exemplo n.º 7
0
        static public void Normalise(_3D_Point v)
        {
            float length;

            length = (float)Math.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z);
            v.X   /= length;
            v.Y   /= length;
            v.Z   /= length;
        }
Exemplo n.º 8
0
 void Form1_MouseMove(object sender, MouseEventArgs e)
 {
     if (right_mouse_down)
     {
         if (e.X > mx)
         {
             _3D_Point v1 = new _3D_Point(rotatingz.L_3D_Pts[0].X, rotatingz.L_3D_Pts[0].Y, rotatingz.L_3D_Pts[0].Z);
             _3D_Point v2 = new _3D_Point(rotatingz.L_3D_Pts[5].X, rotatingz.L_3D_Pts[5].Y, rotatingz.L_3D_Pts[5].Z);
             Transformation.RotateArbitrary(middlepart.L_3D_Pts, v1, v2, -5f);
             //Transformation.RotateArbitrary(middlepart2.L_3D_Pts, v1, v2, -5f);
         }
         else if (e.X < mx)
         {
             _3D_Point v1 = new _3D_Point(rotatingz.L_3D_Pts[0].X, rotatingz.L_3D_Pts[0].Y, rotatingz.L_3D_Pts[0].Z);
             _3D_Point v2 = new _3D_Point(rotatingz.L_3D_Pts[5].X, rotatingz.L_3D_Pts[5].Y, rotatingz.L_3D_Pts[5].Z);
             Transformation.RotateArbitrary(middlepart.L_3D_Pts, v1, v2, 5f);
             //Transformation.RotateArbitrary(middlepart2.L_3D_Pts, v1, v2, 5f);
         }
     }
     else if (left_mouse_down)
     {
         if (e.X > mx)
         {
             _3D_Point v1 = new _3D_Point(rotatingx.L_3D_Pts[2].X, rotatingx.L_3D_Pts[2].Y, rotatingx.L_3D_Pts[2].Z);
             _3D_Point v2 = new _3D_Point(rotatingx.L_3D_Pts[5].X, rotatingx.L_3D_Pts[5].Y, rotatingx.L_3D_Pts[5].Z);
             Transformation.RotateArbitrary(middlepart.L_3D_Pts, v1, v2, 5f);
             //Transformation.RotateArbitrary(middlepart2.L_3D_Pts, v1, v2, 5f);
         }
         else if (e.X < mx)
         {
             _3D_Point v1 = new _3D_Point(rotatingx.L_3D_Pts[2].X, rotatingx.L_3D_Pts[2].Y, rotatingx.L_3D_Pts[2].Z);
             _3D_Point v2 = new _3D_Point(rotatingx.L_3D_Pts[5].X, rotatingx.L_3D_Pts[5].Y, rotatingx.L_3D_Pts[5].Z);
             Transformation.RotateArbitrary(middlepart.L_3D_Pts, v1, v2, -5f);
             //Transformation.RotateArbitrary(middlepart2.L_3D_Pts, v1, v2, -5f);
         }
         else if (e.Y > my)
         {
             _3D_Point v1 = new _3D_Point(rotatingy.L_3D_Pts[2].X, rotatingy.L_3D_Pts[2].Y, rotatingy.L_3D_Pts[2].Z);
             _3D_Point v2 = new _3D_Point(rotatingy.L_3D_Pts[5].X, rotatingy.L_3D_Pts[5].Y, rotatingy.L_3D_Pts[5].Z);
             Transformation.RotateArbitrary(middlepart.L_3D_Pts, v1, v2, 5f);
             //Transformation.RotateArbitrary(middlepart2.L_3D_Pts, v1, v2, 5f);
         }
         else if (e.Y < my)
         {
             _3D_Point v1 = new _3D_Point(rotatingy.L_3D_Pts[2].X, rotatingy.L_3D_Pts[2].Y, rotatingy.L_3D_Pts[2].Z);
             _3D_Point v2 = new _3D_Point(rotatingy.L_3D_Pts[5].X, rotatingy.L_3D_Pts[5].Y, rotatingy.L_3D_Pts[5].Z);
             Transformation.RotateArbitrary(middlepart.L_3D_Pts, v1, v2, -5f);
             //Transformation.RotateArbitrary(middlepart2.L_3D_Pts, v1, v2, -5f);
         }
     }
     else
     {
     }
     mx = e.X;
     my = e.Y;
 }
Exemplo n.º 9
0
        static public _3D_Point CrossProduct(_3D_Point p1, _3D_Point p2)
        {
            _3D_Point p3;

            p3   = new _3D_Point(0, 0, 0);
            p3.X = p1.Y * p2.Z - p1.Z * p2.Y;
            p3.Y = p1.Z * p2.X - p1.X * p2.Z;
            p3.Z = p1.X * p2.Y - p1.Y * p2.X;
            return(p3);
        }
Exemplo n.º 10
0
        public void TransformToOrigin_And_Rotate(_3D_Point a, _3D_Point e)
        {
            _3D_Point w = new _3D_Point(a.X, a.Y, a.Z);

            w.X -= cop.X;
            w.Y -= cop.Y;
            w.Z -= cop.Z;

            e.X = w.X * basisa.X + w.Y * basisa.Y + w.Z * basisa.Z;
            e.Y = w.X * basisc.X + w.Y * basisc.Y + w.Z * basisc.Z;
            e.Z = w.X * lookDir.X + w.Y * lookDir.Y + w.Z * lookDir.Z;
        }
Exemplo n.º 11
0
        void Create_Cube(_3D_Model M, float XLeft, float wWidth, float YBottom, float hHight, float ZS, float Depth, Color vvv)
        {
            float[] vert =
            {
                XLeft + wWidth, YBottom + hHight, ZS,
                XLeft + wWidth, YBottom + hHight, ZS + Depth,
                XLeft,          YBottom + hHight, ZS + Depth,
                XLeft,          YBottom + hHight, ZS,
                XLeft + wWidth, YBottom,          ZS,
                XLeft + wWidth, YBottom,          ZS + Depth,
                XLeft,          YBottom,          ZS + Depth,
                XLeft,          YBottom,          ZS
            };


            _3D_Point pnn;
            int       j = 0;

            for (int i = 0; i < 8; i++)
            {
                pnn = new _3D_Point(vert[j], vert[j + 1], vert[j + 2]);
                j  += 3;
                M.AddPoint(pnn);
            }


            int[] Edges =
            {
                0, 1,
                1, 2,
                2, 3,
                3, 0,
                4, 5,
                5, 6,
                6, 7,
                7, 4,
                0, 4,
                3, 7,
                2, 6,
                1, 5
            };
            j = 0;
            for (int i = 0; i < 12; i++)
            {
                M.AddEdge(Edges[j], Edges[j + 1], vvv);

                j += 2;
            }
        }
Exemplo n.º 12
0
        public void BuildNewSystem()
        {
            lookDir = new _3D_Point(0, 0, 0);
            basisa  = new _3D_Point(0, 0, 0);
            basisc  = new _3D_Point(0, 0, 0);

            lookDir.X = lookAt.X - cop.X;
            lookDir.Y = lookAt.Y - cop.Y;
            lookDir.Z = lookAt.Z - cop.Z;
            Matrix.Normalise(lookDir);

            basisa = Matrix.CrossProduct(up, lookDir);
            Matrix.Normalise(basisa);

            basisc = Matrix.CrossProduct(lookDir, basisa);
            Matrix.Normalise(basisc);
        }
Exemplo n.º 13
0
        public static void RotatX(List <_3D_Point> L_Pts, float theta)
        {
            float th = (float)(Math.PI * theta / 180);

            for (int i = 0; i < L_Pts.Count; i++)
            {
                _3D_Point p = L_Pts[i];

                float x_ = p.X;
                float y_ = (float)(p.Y * Math.Cos(th) - p.Z * Math.Sin(th));
                float z_ = (float)(p.Y * Math.Sin(th) + p.Z * Math.Cos(th));

                p.X = x_;
                p.Y = y_;
                p.Z = z_;
            }
        }
Exemplo n.º 14
0
        public PointF TransformToOrigin_And_Rotate_And_Project(_3D_Point w1)
        {
            _3D_Point e1 = new _3D_Point(0, 0, 0);

            TransformToOrigin_And_Rotate(w1, e1);


            _3D_Point n1 = new _3D_Point(0, 0, 0);

            n1.X = focal * e1.X / e1.Z;
            n1.Y = focal * e1.Y / e1.Z;
            n1.Z = focal;


            // view mapping
            n1.X = (int)(ceneterX + cxScreen * n1.X / 2);
            n1.Y = (int)(ceneterY - cyScreen * n1.Y / 2);

            return(new PointF(n1.X, n1.Y));
        }
Exemplo n.º 15
0
 public void AddPoint(_3D_Point pnn)
 {
     L_3D_Pts.Add(pnn);
 }
Exemplo n.º 16
0
 public Camera()
 {
     cop    = new _3D_Point(0, 0, -900);    // new Point3D(0, -50, 0);
     lookAt = new _3D_Point(0, 0, 50);      //new Point3D(0, 50, 0);
     up     = new _3D_Point(0, 1, 0);
 }
Exemplo n.º 17
0
        void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            //Camera Rotation
            //Rotate X
            if (e.KeyCode == Keys.X)
            {
                _3D_Point cpyOfCop = new _3D_Point(cam.cop);
                _3D_Model mdl      = new _3D_Model();
                mdl.AddPoint(cpyOfCop);
                _3D_Point vv1 = new _3D_Point(cam.lookAt);
                _3D_Point vv2 = new _3D_Point(cam.lookAt);
                vv2.X -= 10;

                Transformation.RotateArbitrary(mdl.L_3D_Pts, vv1, vv2, 10);
                cam.cop = new _3D_Point(cpyOfCop);
                cam.BuildNewSystem();
            }
            //Rotate Y
            else if (e.KeyCode == Keys.Y)
            {
                _3D_Point cpyOfCop = new _3D_Point(cam.cop);
                _3D_Model mdl      = new _3D_Model();
                mdl.AddPoint(cpyOfCop);
                _3D_Point vv1 = new _3D_Point(cam.lookAt);
                _3D_Point vv2 = new _3D_Point(cam.lookAt);
                vv2.Y -= 10;

                Transformation.RotateArbitrary(mdl.L_3D_Pts, vv1, vv2, 10);
                cam.cop = new _3D_Point(cpyOfCop);
                cam.BuildNewSystem();
            }
            //Rotate Z
            else if (e.KeyCode == Keys.Z)
            {
                _3D_Point cpyOfCop = new _3D_Point(cam.cop);
                _3D_Model mdl      = new _3D_Model();
                mdl.AddPoint(cpyOfCop);
                _3D_Point vv1 = new _3D_Point(cam.lookAt);
                _3D_Point vv2 = new _3D_Point(cam.lookAt);
                vv2.Z -= 10;

                Transformation.RotateArbitrary(mdl.L_3D_Pts, vv1, vv2, 10);
                cam.cop = new _3D_Point(cpyOfCop);
                cam.BuildNewSystem();
            }
            //===================================================================================================
            else if (e.KeyCode == Keys.H)
            {
                _3D_Point v1 = new _3D_Point(rotatingx.L_3D_Pts[2].X, rotatingx.L_3D_Pts[2].Y, rotatingx.L_3D_Pts[2].Z);
                _3D_Point v2 = new _3D_Point(rotatingx.L_3D_Pts[5].X, rotatingx.L_3D_Pts[5].Y, rotatingx.L_3D_Pts[5].Z);
                Transformation.RotateArbitrary(middlepart.L_3D_Pts, v1, v2, 5f);
                //ransformation.RotateArbitrary(middlepart2.L_3D_Pts, v1, v2, 5f);
            }
            else if (e.KeyCode == Keys.J)
            {
                _3D_Point v1 = new _3D_Point(rotatingy.L_3D_Pts[2].X, rotatingy.L_3D_Pts[2].Y, rotatingy.L_3D_Pts[2].Z);
                _3D_Point v2 = new _3D_Point(rotatingy.L_3D_Pts[5].X, rotatingy.L_3D_Pts[5].Y, rotatingy.L_3D_Pts[5].Z);
                Transformation.RotateArbitrary(middlepart.L_3D_Pts, v1, v2, 5f);
                //Transformation.RotateArbitrary(middlepart2.L_3D_Pts, v1, v2, 5f);
            }
            else if (e.KeyCode == Keys.K)
            {
                _3D_Point v1 = new _3D_Point(rotatingz.L_3D_Pts[0].X, rotatingz.L_3D_Pts[0].Y, rotatingz.L_3D_Pts[0].Z);
                _3D_Point v2 = new _3D_Point(rotatingz.L_3D_Pts[5].X, rotatingz.L_3D_Pts[5].Y, rotatingz.L_3D_Pts[5].Z);
                Transformation.RotateArbitrary(middlepart.L_3D_Pts, v1, v2, 5f);
                //Transformation.RotateArbitrary(middlepart2.L_3D_Pts, v1, v2, 5f);
            }
        }
Exemplo n.º 18
0
 public _3D_Point(_3D_Point p)
 {
     X = p.X;
     Y = p.Y;
     Z = p.Z;
 }
Exemplo n.º 19
0
        public void design_middle(float x, float y, float z)
        {
            int   Rad   = 10;
            int   N     = 60;
            float theta = 0;
            float theta_in_rid;
            float diff = 360 / N;
            int   ip = 0;
            float xs = x, ys = y, zs = z;
            float tempx = x, tempy = y, tempz = z;
            float ctempx = x, ctempy = y, ctempz = z;

            for (int q = 0; q < 2; q++)
            {
                if (q == 1)
                {
                    xs = x;
                    ys = y;
                    zs = z += 50;
                }
                for (int i = 0; i < 400; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    if (i > 50 && i <= 51)
                    {
                        ys += 2;
                    }
                    if (i > 70 && i <= 71)
                    {
                        ys -= 2;
                    }
                    if (i > 85 && i <= 86)
                    {
                        ys += 20;
                    }
                    if (i >= 92 && i < 93)
                    {
                        ys -= 20;
                    }
                    xs -= 2;
                }
                for (int i = 0; i < 45; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    if (i > 2 && i <= 3)
                    {
                        ys += 4;
                    }
                    if (i > 13 && i <= 14)
                    {
                        ys -= 4;
                    }
                    xs -= 2;
                }
                theta = 90;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(30 * Math.Cos(theta_in_rid));
                    float     yy  = (float)(30 * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + xx, ys - 30 + yy, zs);
                    AddPoint(pnn);
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                    theta += 95 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys - 30 + yy;
                }
                xs = tempx;
                ys = tempy;
                int t = ip;
                for (float x_th = xs; x_th > -580; x_th -= 10)
                {
                    //y = 100 * (float)(Math.Sin(x_th * Math.PI / 180));
                    float dist = (float)(Math.Sqrt((x_th - xs) * (x_th - xs) + (z - zs) * (z - zs)));
                    float yy   = -15 * (float)(Math.Sin(dist * Math.PI / 90));

                    AddPoint(new _3D_Point(x_th, yy + ys, zs));

                    if (ip > 0 && x_th != -580)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    tempy = yy + ys;
                    tempx = x_th;
                }
                ys = tempy;
                xs = -580;
                for (int i = 0; i < 52; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    ys--;
                    xs -= 7;
                }
                tempy = ys;
                tempx = xs;
                for (int n = 0; n < 3; n++)
                {
                    ys = tempy;
                    for (int i = 0; i < 9; i++)
                    {
                        _3D_Point pnn = new _3D_Point(xs, ys, zs);
                        AddPoint(pnn);
                        if (i > 0)
                        {
                            AddEdge(ip, ip - 1, Color.DarkMagenta);
                        }
                        ip++;
                        ys -= 25;
                    }
                    xs += 5;
                }
                xs  = tempx;
                ys += 25;
                for (int i = 0; i < 52; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    ys += 2;
                    xs += 7;
                }
                xs -= 7;
                ys -= 2;
                for (float x_th = xs; x_th < -440; x_th += 10)
                {
                    //y = 100 * (float)(Math.Sin(x_th * Math.PI / 180));
                    float dist = (float)(Math.Sqrt((x_th - xs) * (x_th - xs) + (z - zs) * (z - zs)));
                    float yy   = -25 * (float)(Math.Sin(dist * Math.PI / 90));

                    AddPoint(new _3D_Point(x_th, yy + ys, zs));

                    if (ip > 0 && x_th != -580)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    tempy = yy + ys;
                }
                ys = tempy;
                xs = -440;
                for (int i = 0; i < 55; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs += 2;
                }
                AddEdge(ip - 1, ip - 268, Color.DarkMagenta);
                _3D_Point pnn2 = new _3D_Point(xs + 25, ys, zs);
                AddPoint(pnn2);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                AddEdge(ip, ip - 280, Color.DarkMagenta);
                ip++;
                xs   += 25;
                tempx = xs;
                tempy = ys;
                for (int c = 0; c < 2; c++)
                {
                    xs = tempx;
                    for (int i = 0; i < 55; i++)
                    {
                        _3D_Point pnn = new _3D_Point(xs, ys, zs);
                        AddPoint(pnn);
                        if (i > 1)
                        {
                            AddEdge(ip, ip - 1, Color.DarkMagenta);
                        }
                        ip++;
                        xs += 5;
                    }
                    ys += 70;
                }
                pnn2 = new _3D_Point(xs - 5, ys - 140, zs);
                AddPoint(pnn2);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                ys -= 45;
                xs -= 5;
                for (int i = 0; i < 5; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs += 17;
                }
                xs = tempx + 15;
                for (int k = 0; k < 21; k++)
                {
                    ys = tempy;
                    for (int i = 0; i < 5; i++)
                    {
                        _3D_Point pnn = new _3D_Point(xs, ys, zs);
                        AddPoint(pnn);
                        if (i == 1 && k == 0)
                        {
                        }
                        else if (i > 1)
                        {
                            AddEdge(ip, ip - 1, Color.DarkMagenta);
                        }
                        ip++;
                        if (i == 1)
                        {
                            ys -= 60;
                        }
                        else if (i == 2)
                        {
                            xs += 10;
                        }
                        else
                        {
                            ys += 60;
                        }
                    }
                    xs += 2;
                }
                ys  = tempy;
                xs += 3;
                for (int i = 0; i < 15; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 1)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    if (i < 5)
                    {
                        ys -= 10;
                        xs += 6;
                    }
                    else if (i >= 5 && i < 10)
                    {
                        ys -= 10;
                    }
                    else
                    {
                        xs += 5;
                    }
                }
                theta  = 0;
                Rad    = 150;
                ys    += 45;
                xs    -= 2;
                ctempx = xs;
                ctempy = ys;
                ctempz = zs;
                //========================================================================================
                //Mag
                for (int k = 0; k < 3; k++)
                {
                    for (int i = 0; i < N; i++)
                    {
                        theta_in_rid = (float)(2 * Math.PI * theta / 360);

                        float yy = (float)(Rad * Math.Cos(theta_in_rid));
                        float zz = (float)(Rad * Math.Sin(theta_in_rid));

                        _3D_Point pnn = new _3D_Point(xs, yy + ys, zs + zz);
                        AddPoint(pnn);

                        if (ip > 0 && i > 0)
                        {
                            AddEdge(ip, ip - 1, Color.DarkMagenta);
                        }
                        if (k > 0 && i == N / 2)
                        {
                            AddEdge(ip, ip - N, Color.DarkMagenta);
                        }
                        if (k > 0 && i % 4 == 0)
                        {
                            AddEdge(ip, ip - N, Color.DarkMagenta);
                        }

                        ip++;
                        theta += diff;
                    }
                    if (k == 0)
                    {
                        xs += 125;
                    }
                    else if (k == 1)
                    {
                        xs += 25;
                    }
                }
                //==============================================================================
                ys   += 170;
                xs   -= 125;
                theta = 90;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(30 * Math.Cos(theta_in_rid));
                    float     yy  = (float)(30 * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + xx, ys - 30 + yy, zs);
                    AddPoint(pnn);
                    theta += 95 / 20;
                    if (i > 1)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    tempx = xs + xx;
                    tempy = ys - 30 + yy;
                }
                for (int i = 0; i < 21; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 1)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    if (i < 5)
                    {
                        xs += 35;
                    }
                    else if (i <= 7)
                    {
                        xs += 7;
                        ys -= 7;
                    }
                    else if (i < 10)
                    {
                        xs -= 7;
                        ys -= 7;
                    }
                    else if (i < 17)
                    {
                        ys -= 15;
                    }
                    else
                    {
                        xs -= 14;
                    }
                }
                xs += 28;
                ys += 15;
                for (int i = 0; i < 5; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 1)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs += 10;
                }
                xs   -= 20;
                ys   -= 3;
                tempx = xs;
                for (int i = 0; i < 5; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 1)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    ys += 5;
                    xs += 5;
                }
                tempy = xs;
                xs    = tempx;
                tempx = tempy;
                ys   += 70;
                for (int i = 0; i < 5; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 1)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    ys -= 5;
                    xs += 5;
                }
                ys -= 60;
                xs  = tempx - 25;
                AddEdge(ip - 1, ip - 6, Color.DarkMagenta);
                ip++;
                for (int k = 0; k < 3; k++)
                {
                    xs = tempx - 25;
                    for (int i = 0; i < 10; i++)
                    {
                        _3D_Point pnn = new _3D_Point(xs, ys, zs);
                        AddPoint(pnn);
                        if (i > 1)
                        {
                            AddEdge(ip, ip - 1, Color.DarkMagenta);
                        }
                        ip++;
                        xs += 15;
                    }
                    if (k == 0)
                    {
                        ys += 50;
                    }
                    else if (k == 1)
                    {
                        ys += 15;
                    }
                }
                tempy = ys;
                ys   += 80;
                xs   -= 15;
                pnn2  = new _3D_Point(xs, ys, zs);
                AddPoint(pnn2);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                ip++;
                xs  += 35;
                pnn2 = new _3D_Point(xs, ys, zs);
                AddPoint(pnn2);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                ip++;
                ys  -= 80;
                pnn2 = new _3D_Point(xs, ys, zs);
                AddPoint(pnn2);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                ip++;
                ys  -= 80;
                xs  -= 15;
                pnn2 = new _3D_Point(xs, ys, zs);
                AddPoint(pnn2);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                ip++;
                xs  -= 18;
                pnn2 = new _3D_Point(xs, ys, zs);
                AddPoint(pnn2);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                ip++;
                ys  += 65;
                pnn2 = new _3D_Point(xs, ys, zs);
                AddPoint(pnn2);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                ip++;
                ys  += 16;
                xs  += 100;
                pnn2 = new _3D_Point(xs, ys, zs);
                AddPoint(pnn2);
                AddEdge(ip, ip - 4, Color.DarkMagenta);
                ip++;
                AddEdge(ip - 1, 0, Color.DarkMagenta);
            }
            for (int i = 0; i < ip / 2; i++)
            {
                AddEdge(i, i + ip / 2, Color.DarkMagenta);
            }
            theta = 0;
            Rad   = 10;
            ys   += 35;
            xs   += 30;
            zs   -= 25;
            for (int j = 0; j < 1; j++)
            {
                for (int i = 0; i < N; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);

                    float yy = (float)(Rad * Math.Cos(theta_in_rid));
                    float zz = (float)(Rad * Math.Sin(theta_in_rid));

                    _3D_Point pnn = new _3D_Point(xs, yy + ys, zs + zz);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkCyan);
                    }

                    /*else if (j>0)
                     * {
                     *  AddEdge(ip, ip - 1, Color.DarkCyan);
                     * }
                     * if (j>0)
                     * {
                     *  AddEdge(ip, ip - N, Color.DarkCyan);
                     * }*/
                    ip++;
                    theta += diff;
                }
                xs -= 140;
                //designs
                for (int q = 0; q < 5; q++)
                {
                    if (q == 1 || q == 3 || q == 4)
                    {
                        xs -= 45;
                    }
                    else if (q == 2)
                    {
                        xs -= 350;
                    }
                    theta = 90;
                    for (int i = 0; i < N; i++)
                    {
                        theta_in_rid = (float)(2 * Math.PI * theta / 360);

                        float xx = (float)(Rad * Math.Cos(theta_in_rid));
                        float yy = (float)(Rad * Math.Sin(theta_in_rid));

                        _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                        AddPoint(pnn);
                        if (i > 0)
                        {
                            AddEdge(ip, ip - 1, Color.DarkMagenta);
                        }
                        ip++;
                        theta -= 180 / N;
                    }
                    xs -= 25;
                    for (int i = 0; i < N; i++)
                    {
                        theta_in_rid = (float)(2 * Math.PI * theta / 360);

                        float xx = (float)(Rad * Math.Cos(theta_in_rid));
                        float yy = (float)(Rad * Math.Sin(theta_in_rid));

                        _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                        AddPoint(pnn);
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                        if (i == N - 1)
                        {
                            AddEdge(ip, ip - 119, Color.DarkMagenta);
                        }
                        ip++;
                        theta -= 180 / N;
                    }
                }
                float theta2 = 0;
                int   Rad2   = 150;
                xs   += 380;
                tempx = xs;
                ys   -= 25;
                for (int k = 0; k < N; k++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta2 / 360);
                    float yyy = (float)(Rad2 * Math.Cos(theta_in_rid));
                    float zz  = (float)(Rad2 * Math.Sin(theta_in_rid));
                    theta2 += diff;

                    /*}
                     * for (int q = 0; q < 7; q++)
                     * {
                     *  if (q>0)
                     *  {
                     *      ys -= 40;
                     *  }*/
                    if (k == 0 || k == 5 || k == 10 || k == 15 || k == 20 || k == 25 || k == 30)//||k==35||k==40||k==45||k==50||k==55)
                    {
                        if (k > 0 && k <= 30)
                        {
                            ys -= 40;
                        }
                        else if (k > 30)
                        {
                            ys += 40;
                        }
                        xs    = tempx;
                        theta = 90;
                        for (int i = 0; i < N; i++)
                        {
                            theta_in_rid = (float)(2 * Math.PI * theta / 360);

                            float xx = (float)(Rad * Math.Cos(theta_in_rid));
                            float yy = (float)(Rad * Math.Sin(theta_in_rid));

                            _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs - zz);
                            AddPoint(pnn);
                            if (i > 0)
                            {
                                AddEdge(ip, ip - 1, Color.IndianRed);
                            }
                            ip++;
                            theta -= 180 / N;
                        }
                        xs -= 75;
                        for (int i = 0; i < N; i++)
                        {
                            theta_in_rid = (float)(2 * Math.PI * theta / 360);

                            float xx = (float)(Rad * Math.Cos(theta_in_rid));
                            float yy = (float)(Rad * Math.Sin(theta_in_rid));

                            _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs - zz);
                            AddPoint(pnn);
                            AddEdge(ip, ip - 1, Color.IndianRed);
                            if (i == N - 1)
                            {
                                AddEdge(ip, ip - 119, Color.IndianRed);
                            }
                            ip++;
                            theta -= 180 / N;
                        }
                    }
                }
            }
            int ttt = ip;

            ctempx = xs;
            ctempy = ys;
            ctempz = zs;
            for (int q = 0; q < 2; q++)
            {
                if (q > 0)
                {
                    zs = z + 50;
                }
                xs = -750;
                ys = -115;
                for (int i = 0; i < 5; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    ys -= 20;
                }
                ys   += 20;
                xs   += 30;
                theta = 180;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(30 * Math.Cos(theta_in_rid));
                    float     yy  = (float)(30 * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + xx, ys + yy, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    theta += 95 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys + yy;
                }
                xs = tempx;
                ys = tempy;
                for (int i = 0; i < 5; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs += 20;
                }
                xs   -= 20;
                ys   += 30;
                theta = 270;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(30 * Math.Cos(theta_in_rid));
                    float     yy  = (float)(30 * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + xx, ys + yy, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    theta += 95 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys + yy;
                }
                xs = tempx;
                ys = tempy;
                for (int i = 0; i < 7; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    ys += 20;
                }
                xs -= 80;
                ys -= 33;
                for (int i = 0; i < 4; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    ys -= 20;
                }
                theta = 180;
                xs   += 30;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(30 * Math.Cos(theta_in_rid));
                    float     yy  = (float)(30 * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + xx, ys + yy, zs);
                    AddPoint(pnn);
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                    theta += 95 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys + yy;
                }
                xs   += 0;
                theta = 160;
                ys   -= 8;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(20 * Math.Cos(theta_in_rid));
                    float     yy  = (float)(20 * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + xx, ys + yy, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    theta += 95 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys + yy;
                }
                xs = tempx - 8;
                ys = tempy + 20;
                for (int i = 0; i < 5; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    ys += 20;
                }
                xs = ctempx;
                ys = ctempy;
                zs = ctempz;
            }
            int r = (ip - ttt) / 2;

            for (int i = 0; i < r; i++)
            {
                AddEdge(ttt + i, ttt + (r + i), Color.DarkMagenta);
            }
        }
Exemplo n.º 20
0
        public void design_middle(float x, float y, float z)
        {
            float tempx = x, tempy = y, tempz = z;
            float btempx = x, btempy = y, btempz = z;
            float xs = x, ys = y, zs = z;
            int   Rad   = 60;
            int   theta = 0;
            int   ip    = 0;
            int   val   = 50;
            float theta_in_rid;

            for (int l = 0; l < 2; l++)
            {
                xs = x;
                ys = y;
                if (l == 1)
                {
                    zs += val;
                }
                for (int i = 0; i < 250; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (ip > 0 && i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs -= 5;
                }
                theta = 90;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(30 * Math.Cos(theta_in_rid));
                    float     yy  = (float)(30 * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + xx, ys - 30 + yy, zs);
                    AddPoint(pnn);
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                    theta += 120 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys - 30 + yy;
                }
                xs    = tempx - 35;
                ys    = tempy - 135;
                theta = 60;
                Rad   = 150;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(Rad * Math.Cos(theta_in_rid));
                    float     yy  = (float)(Rad * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + (0.5f * xx), ys + yy, zs);
                    AddPoint(pnn);
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                    theta -= 120 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys + yy;
                }
                xs    = tempx - 25;
                ys    = tempy - 9;
                theta = 160;
                Rad   = 20;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(Rad * Math.Cos(theta_in_rid));
                    float     yy  = (float)(Rad * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + xx, ys + yy, zs);
                    AddPoint(pnn);
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                    theta += 115 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys + yy;
                }
                xs = tempx + 50;
                ys = tempy;
                for (int i = 0; i < 10; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    ys += 36.2f;
                }
                ys = tempy + 30;
                for (int i = 0; i < 70; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    if (i < 5)
                    {
                        xs += 10;
                        ys -= 2;
                    }
                    else if (i < 30)
                    {
                        xs += 3;
                        ys += 7;
                    }
                    else if (i < 35)
                    {
                        xs += 25;
                    }
                    else if (i < 40)
                    {
                        ys   -= 7;
                        tempx = xs;
                        tempy = ys;
                    }
                    else if (i < 55)
                    {
                        xs += 10;
                        ys -= 3;
                    }
                    else if (i < 60)
                    {
                        xs += 1;
                        ys -= 5;
                    }
                    else
                    {
                        xs += 3;
                    }
                }
                xs = tempx + 80;
                ys = tempy - 158;
                if (l == 0)
                {
                    zs += 10;
                }
                else
                {
                    zs -= 10;
                }
                theta = 130;
                Rad   = 200;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(Rad * Math.Cos(theta_in_rid));
                    float     yy  = (float)(Rad * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + (0.5f * xx), ys + yy, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    theta += 115 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys + yy;
                }
                xs    = tempx + 260;
                ys    = tempy + 143;
                theta = 130;
                Rad   = 110;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(Rad * Math.Cos(theta_in_rid));
                    float     yy  = (float)(Rad * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + (0.5f * xx), ys + yy, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    theta += 100 / 20;
                    ip++;
                }
                xs = tempx + 70;
                ys = tempy;
                _3D_Point pp = new _3D_Point(xs, ys, zs);
                AddPoint(pp);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                ip++;
                if (l == 0)
                {
                    zs = 0;
                }
                else
                {
                    zs = z + val;
                }
                xs   += 275;
                ys   += 236;
                theta = 90;
                Rad   = 100;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(Rad * Math.Cos(theta_in_rid));
                    float     yy  = (float)(Rad * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + (xx), ys + yy, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    theta += 100 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys + yy;
                }
                xs = tempx + 100;
                ys = tempy + 108;
                for (int i = 0; i < 20; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs += 5;
                }
                for (float y_th = ys; y_th > -300; y_th -= 10)
                {
                    //y = 100 * (float)(Math.Sin(x_th * Math.PI / 180));
                    float dist = (float)(Math.Sqrt((y_th - ys) * (y_th - ys)));
                    float xx   = 40 * (float)(Math.Sin(dist * Math.PI / 160));

                    AddPoint(new _3D_Point(xx + xs, y_th, zs));

                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs   -= 5;
                    tempy = xx + xs;
                    tempy = y_th;
                }
                xs = tempx + 33;
                ys = tempy;
                for (int i = 0; i < 20; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                    ip++;
                    xs += 7;
                    ys -= 2;
                }
                for (float y_th = ys; y_th < -210; y_th += 10)
                {
                    //y = 100 * (float)(Math.Sin(x_th * Math.PI / 180));
                    float dist = (float)(Math.Sqrt((y_th - ys) * (y_th - ys)));
                    float xx   = -40 * (float)(Math.Sin(dist * Math.PI / 160));

                    AddPoint(new _3D_Point(xx + xs, y_th, zs));

                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs   += 5;
                    tempx = xx + xs;
                    tempy = y_th;
                }
                xs = tempx + 10;
                ys = tempy + 10;
                pp = new _3D_Point(xs, ys, zs);
                AddPoint(pp);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                ip++;
                for (float y_th = ys; y_th < -110; y_th += 10)
                {
                    //y = 100 * (float)(Math.Sin(x_th * Math.PI / 180));
                    float dist = (float)(Math.Sqrt((y_th - ys) * (y_th - ys)));
                    float xx   = -100 * (float)(Math.Sin(dist * Math.PI / 170));

                    AddPoint(new _3D_Point(xx + xs, y_th, zs));

                    if (ip > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs   += 20;
                    tempx = xx + xs;
                    tempy = y_th;
                }
                xs   -= 90;
                ys   += 127;
                theta = 120;
                Rad   = 50;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(Rad * Math.Cos(theta_in_rid));
                    float     yy  = (float)(Rad * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + (xx), ys + yy, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    theta += 120 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys + yy;
                }
                xs -= 135;
                ys  = -30;
                pp  = new _3D_Point(xs, ys, zs);
                AddPoint(pp);
                AddEdge(ip, ip - 20, Color.DarkMagenta);
                ip++;
                xs = tempx;
                ys = tempy;
                for (int i = 0; i < 20; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs += 7;
                }
                xs = tempx;
                ys = -30;
                for (int i = 0; i < 30; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    if (i < 20)
                    {
                        xs   += 7;
                        tempx = xs;
                    }
                    else if (i < 24)
                    {
                        xs += 7;
                        ys -= 9;
                    }
                    else
                    {
                        xs -= 7.2f;
                        ys -= 9.2f;
                    }
                }
                xs = tempx;
                ys = -30;
                for (int i = 0; i < 45; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    if (i < 20)
                    {
                        xs += 7;
                    }
                    else if (i < 24)
                    {
                        xs += 7;
                        ys -= 9;
                    }
                    else
                    {
                        xs += 8;
                        ys += 2;
                    }
                }
                xs -= 8;
                pp  = new _3D_Point(xs, ys, zs);
                AddPoint(pp);
                if (l == 0)
                {
                    AddEdge(ip, 0, Color.DarkMagenta);
                }
                ip++;
                btempx = xs;
                btempy = ys;
                btempz = zs;
                //======================================================================================
                //the upper design
                xs = x;
                ys = y + 50;
                pp = new _3D_Point(xs, ys, zs);
                AddPoint(pp);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                ip++;
                for (int i = 0; i < 190; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    if (i < 90)
                    {
                        xs -= 5;
                    }
                    else if (i < 100)
                    {
                        xs -= 3;
                        ys += 5;
                    }
                    else if (i < 110)
                    {
                        xs -= 5;
                    }
                    else if (i < 130)
                    {
                        xs -= 3;
                        ys -= 5;
                    }
                    else if (i < 135)
                    {
                        xs -= 5;
                    }
                    else if (i < 140)
                    {
                        xs += 3;
                        ys += 5;
                    }
                    else if (i < 150)
                    {
                        xs -= 5;
                        ys += 5;
                    }
                    else
                    {
                        xs -= 10;
                        ys -= 1;
                    }
                }
                theta = 90;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     xx  = (float)(30 * Math.Cos(theta_in_rid));
                    float     yy  = (float)(30 * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs + xx, ys - 30 + yy, zs);
                    AddPoint(pnn);
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                    theta += 100 / 20;
                    ip++;
                    tempx = xs + xx;
                    tempy = ys - 30 + yy;
                }
                xs = btempx - 50;
                ys = btempy + 180;
                for (int i = 0; i < 65; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    if (i == 2 || i == 4 || i == 6 || i == 8 || i == 10 || i == 12 || i == 14 || i == 16 || i == 18 || i == 20 || i == 22 || i == 24 || i == 26 || i == 28 || i == 30 ||
                        i == 32 || i == 34 || i == 36 || i == 38 || i == 40 || i == 42 || i == 44 || i == 46 || i == 48 || i == 50 || i == 52 || i == 54 || i == 56 || i == 58 || i == 60)
                    {
                        ys += 5;
                    }
                    if (i == 3 || i == 5 || i == 7 || i == 9 || i == 11 || i == 13 || i == 15 || i == 17 || i == 19 || i == 21 || i == 23 || i == 25 || i == 27 || i == 29 || i == 31 ||
                        i == 33 || i == 35 || i == 37 || i == 39 || i == 41 || i == 43 || i == 45 || i == 47 || i == 49 || i == 51 || i == 53 || i == 55 || i == 57 || i == 59)
                    {
                        ys -= 5;
                    }
                    xs -= 5;
                }
                xs = btempx;
                ys = btempy - 5;
                for (int i = 0; i < 240; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs -= 5;
                }
                for (int j = 0; j < 1; j++)
                {
                    if (j == 0)
                    {
                        xs = 100;
                    }
                    else
                    {
                        xs = 120;
                    }

                    theta = 80;
                    for (int i = 0; i < 20; i++)
                    {
                        theta_in_rid = (float)(2 * Math.PI * theta / 360);
                        float     xx  = (float)(30 * Math.Cos(theta_in_rid));
                        float     yy  = (float)(30 * Math.Sin(theta_in_rid));
                        _3D_Point pnn = new _3D_Point(xs + xx, ys - 30 + yy, zs);
                        AddPoint(pnn);
                        if (i > 0)
                        {
                            AddEdge(ip, ip - 1, Color.DarkMagenta);
                        }
                        if (j == 1)
                        {
                            AddEdge(ip, ip - 20, Color.DarkMagenta);
                        }
                        theta += 180 / 20;
                        ip++;
                        tempx = xs + xx;
                        tempy = ys - 30 + yy;
                    }
                }
                //======================================================================================
                //end of the doubling loop
            }
            for (int i = 0; i < ip / 2; i++)
            {
                AddEdge(i, (ip / 2) + i, Color.DarkMagenta);
            }
            xs    = btempx;
            ys    = btempy;
            zs    = btempz;
            tempx = xs;
            tempy = 30;
            tempz = val / 2;
            zs    = val / 2;
            ys    = 30;
            for (int j = 0; j < 100; j++)
            {
                if (j > 0)
                {
                    xs += 1;
                }
                theta = 0;
                if (j > 40)
                {
                    if (j == 41)
                    {
                        xs -= 1;
                    }
                    Rad = 15;
                }
                else
                {
                    Rad = 10;
                }
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     yy  = (float)(Rad * Math.Cos(theta_in_rid));
                    float     zz  = (float)(Rad * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs, ys + yy, zz + zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    if (j > 0)
                    {
                        AddEdge(ip, ip - 20 * j, Color.DarkMagenta);
                    }
                    theta += 360 / 20;
                    ip++;
                }
            }
            xs = tempx;
            ys = tempy + 25;
            zs = tempz;
            for (int j = 0; j < 40; j++)
            {
                theta = 0;
                Rad   = 7;
                xs++;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);
                    float     yy  = (float)(Rad * Math.Cos(theta_in_rid));
                    float     zz  = (float)(Rad * Math.Sin(theta_in_rid));
                    _3D_Point pnn = new _3D_Point(xs, ys + yy, zz + zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    if (j > 0)
                    {
                        AddEdge(ip, ip - 20 * j, Color.DarkMagenta);
                    }
                    theta += 360 / 20;
                    ip++;
                }
            }
            zs = 0;
            //designs
            xs = btempx;
            ys = 130;
            for (int q = 0; q < 6; q++)
            {
                if (q > 0)
                {
                    xs -= 50;
                }
                theta = 90;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);

                    float xx = (float)(Rad * Math.Cos(theta_in_rid));
                    float yy = (float)(Rad * Math.Sin(theta_in_rid));

                    _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    theta -= 180 / 20;
                }
                xs -= 25;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);

                    float xx = (float)(Rad * Math.Cos(theta_in_rid));
                    float yy = (float)(Rad * Math.Sin(theta_in_rid));

                    _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                    AddPoint(pnn);
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                    if (i == 19)
                    {
                        AddEdge(ip, ip - 39, Color.DarkMagenta);
                    }
                    ip++;
                    theta -= 180 / 20;
                }
            }
            xs -= 100;
            for (int q = 0; q < 2; q++)
            {
                if (q == 1)
                {
                    zs += val;
                }
                ys    = 170;
                theta = 0;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);

                    float xx = (float)(20 * Math.Cos(theta_in_rid));
                    float yy = (float)(20 * Math.Sin(theta_in_rid));

                    _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    theta += 360 / 20;
                }
                AddEdge(ip - 1, ip - 20, Color.DarkMagenta);
            }
            zs = z;
            xs = btempx;
            ys = 70;
            for (int q = 0; q < 6; q++)
            {
                if (q > 0)
                {
                    xs -= 50;
                }
                theta = 90;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);

                    float xx = (float)(Rad * Math.Cos(theta_in_rid));
                    float yy = (float)(Rad * Math.Sin(theta_in_rid));

                    _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    theta -= 180 / 20;
                }
                xs -= 25;
                for (int i = 0; i < 20; i++)
                {
                    theta_in_rid = (float)(2 * Math.PI * theta / 360);

                    float xx = (float)(Rad * Math.Cos(theta_in_rid));
                    float yy = (float)(Rad * Math.Sin(theta_in_rid));

                    _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                    AddPoint(pnn);
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                    if (i == 19)
                    {
                        AddEdge(ip, ip - 39, Color.DarkMagenta);
                    }
                    ip++;
                    theta -= 180 / 20;
                }
            }
            xs    = 0;
            ys    = 70;
            theta = 90;
            for (int i = 0; i < 20; i++)
            {
                theta_in_rid = (float)(2 * Math.PI * theta / 360);

                float xx = (float)(Rad * Math.Cos(theta_in_rid));
                float yy = (float)(Rad * Math.Sin(theta_in_rid));

                _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                AddPoint(pnn);
                if (i > 0)
                {
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                }
                ip++;
                theta -= 180 / 20;
            }
            xs -= 120;
            for (int i = 0; i < 20; i++)
            {
                theta_in_rid = (float)(2 * Math.PI * theta / 360);

                float xx = (float)(Rad * Math.Cos(theta_in_rid));
                float yy = (float)(Rad * Math.Sin(theta_in_rid));

                _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                AddPoint(pnn);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                if (i == 19)
                {
                    AddEdge(ip, ip - 39, Color.DarkMagenta);
                }
                ip++;
                theta -= 180 / 20;
            }
            xs    = -300;
            ys    = 70;
            theta = 90;
            for (int i = 0; i < 20; i++)
            {
                theta_in_rid = (float)(2 * Math.PI * theta / 360);

                float xx = (float)(Rad * Math.Cos(theta_in_rid));
                float yy = (float)(Rad * Math.Sin(theta_in_rid));

                _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                AddPoint(pnn);
                if (i > 0)
                {
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                }
                ip++;
                theta -= 180 / 20;
            }
            xs -= 120;
            for (int i = 0; i < 20; i++)
            {
                theta_in_rid = (float)(2 * Math.PI * theta / 360);

                float xx = (float)(Rad * Math.Cos(theta_in_rid));
                float yy = (float)(Rad * Math.Sin(theta_in_rid));

                _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                AddPoint(pnn);
                AddEdge(ip, ip - 1, Color.DarkMagenta);
                if (i == 19)
                {
                    AddEdge(ip, ip - 39, Color.DarkMagenta);
                }
                ip++;
                theta -= 180 / 20;
            }
            xs = 0;
            ys = 70;
            for (int k = 0; k < 2; k++)
            {
                if (k == 1)
                {
                    ys -= 10;
                    xs += 10;
                }
                for (int j = 0; j < 2; j++)
                {
                    if (j == 1)
                    {
                        xs -= 10;
                    }
                    zs = z;
                    for (int i = 0; i < 20; i++)
                    {
                        _3D_Point pnn = new _3D_Point(xs, ys, zs);
                        AddPoint(pnn);
                        if (i > 0)
                        {
                            AddEdge(ip, ip - 1, Color.DarkMagenta);
                        }
                        ip++;
                        zs -= 5;
                    }
                }
            }
            AddEdge(ip - 1, ip - 21, Color.DarkMagenta);
            AddEdge(ip - 41, ip - 61, Color.DarkMagenta);
            AddEdge(ip - 1, ip - 61, Color.DarkMagenta);
            AddEdge(ip - 41, ip - 21, Color.DarkMagenta);
            xs    = 50;
            ys    = 20;
            zs    = z;
            theta = 90;
            for (int i = 0; i < 20; i++)
            {
                theta_in_rid = (float)(2 * Math.PI * theta / 360);

                float xx = (float)(Rad * Math.Cos(theta_in_rid));
                float yy = (float)(Rad * Math.Sin(theta_in_rid));

                _3D_Point pnn = new _3D_Point(xs + xx, yy + ys, zs);
                AddPoint(pnn);
                if (i > 0)
                {
                    AddEdge(ip, ip - 1, Color.DarkMagenta);
                }
                ip++;
                theta += 180 / 20;
            }
            xs   += 1;
            tempx = xs;
            ys   += 7;
            for (int q = 0; q < 2; q++)
            {
                if (q == 1)
                {
                    ys -= 15;
                    xs  = tempx;
                }
                for (int i = 0; i < 50; i++)
                {
                    _3D_Point pnn = new _3D_Point(xs, ys, zs);
                    AddPoint(pnn);
                    if (i > 0)
                    {
                        AddEdge(ip, ip - 1, Color.DarkMagenta);
                    }
                    ip++;
                    xs += 5;
                }
            }
            AddEdge(ip - 1, ip - 51, Color.DarkMagenta);
            //end of the class
        }