public static Figure get_Rotation(List <Point3D> pnts, Point3D axis1, Point3D axis2, int divs)
        {
            Figure res     = new Figure();
            Figure edge    = new Figure();
            int    cnt_pnt = pnts.Count;

            edge.points = pnts.Select(x => new Point3D(x)).ToList();
            res.points  = pnts.Select(x => new Point3D(x)).ToList();
            int   cur_ind = res.points.Count;
            float ang     = (float)360 / divs;

            for (int i = 0; i < divs; i++)
            {
                edge.line_rotate(ang, axis1, axis2);
                cur_ind = res.points.Count;
                for (int j = 0; j < cnt_pnt; j++)
                {
                    res.points.Add(new Point3D(edge.points[j]));
                }

                for (int j = cur_ind; j < res.points.Count - 1; j++)
                {
                    Side s = new Side(res);
                    s.points.AddRange(new int[] { j, j + 1, j + 1 - cnt_pnt, j - cnt_pnt });
                    res.sides.Add(s);
                }
            }



            res.set_pen(new Pen(Color.Magenta));
            return(res);
        }
        static public Figure get_Torus(float sz, int d = 100)
        {
            sz /= 2;
            List <Point3D> crcl = new List <Point3D>();
            float          ang  = 0;
            float          a    = (float)(2 * Math.PI / d);

            for (int i = 0; i <= d; ++i)
            {
                crcl.Add(new Point3D((float)Math.Cos(ang) * sz, 0, (float)Math.Sin(ang) * sz));
                ang += a;
            }

            Figure res = get_Rotation(crcl, new Point3D(-(float)(sz * 2.5), 0, 0), new Point3D(-(float)(sz * 2.5), 0, 1), d);

            res.offset((float)(sz * 2.5), 0, 0);
            res.set_pen(new Pen(Color.Tomato));
            return(res);
        }
        ///
        /// --------------------SAVE/LOAD METHODS------------------------------------------
        ///

        public static Figure parse_figure(string filename)
        {
            Figure        res   = new Figure();
            List <string> lines = System.IO.File.ReadLines(filename).ToList();
            var           st    = lines[0].Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);

            if (st[0] == "rotation")
            {
                return(parse_rotation(lines));
            }
            else
            {
                int count_points = Int32.Parse(st[0]);
                Dictionary <string, int> pnts = new Dictionary <string, int>();

                for (int i = 0; i < count_points; ++i)
                {
                    string[] str = lines[i + 1].Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    res.points.Add(new Point3D(float.Parse(str[1]), float.Parse(str[2]), float.Parse(str[3])));
                    pnts.Add(str[0], i);
                }

                int count_sides = Int32.Parse(lines[count_points + 1]);
                for (int i = count_points + 2; i < lines.Count(); ++i)
                {
                    Side          s   = new Side(res);
                    List <string> str = lines[i].Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                    foreach (var id in str)
                    {
                        s.points.Add(pnts[id]);
                    }
                    res.sides.Add(s);
                }

                res.set_pen(new Pen(Color.Red));
                return(res);
            }
        }