示例#1
0
 public _4Points(MathDescription.Points _point_1, MathDescription.Points _point_2, MathDescription.Points _point_3, MathDescription.Points _point_4)
 {
     point_1 = _point_1;
     point_2 = _point_2;
     point_3 = _point_3;
     point_4 = _point_4;
 }
示例#2
0
文件: DrawTor.cs 项目: Mexahoid/CSF
        public Bitmap DrawingTor(int _width, int _height, int d, int type)
        {
            Bitmap bmp = new Bitmap(_width, _height);
            Graphics graph = Graphics.FromImage(bmp);

            graph.SmoothingMode = SmoothingMode.AntiAlias;

            MathDescription.Points[,] points = new MathDescription.Points[N, n];

            Array.Copy(viewP, points, viewP.Length);
            points = MathDescription.RotateX(points, Speed);
            points = MathDescription.RotateY(points, Speed);
               // points = MathDescription.RotateZ(points, Speed);
            points = MathDescription.Perspective(points);
            DrawingPoint(points, d);

            Point[] p = new Point[4];
            List<_4Points> coordList = new List<_4Points>();
            for (int i = 0; i < N - 1; i++)
                for (int j = 0; j < n - 1; j++)
                    coordList.Add(new _4Points(points[i, j], points[i, j + 1], points[i + 1, j], points[i + 1, j + 1]));

            double cur = 0;
            arr = new double[coordList.Count, 2];
            for (int i = 0; i < coordList.Count(); i++)
            {
                cur = 0;
                cur = (coordList[i].point_1.z + coordList[i].point_2.z + coordList[i].point_3.z + coordList[i].point_4.z) / 4;
                arr[i, 0] = cur;
                arr[i, 1] = i;
            }

            double[] NormAngle = new double[coordList.Count];
            for (int m = 0; m < coordList.Count; m++)
            {
                NormAngle[m] = CosNormal(coordList[m]);
            }

            QSort(arr, 0, coordList.Count - 1);
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                p[0].X = (int)coordList[(int)arr[i, 1]].point_1.x + d;
                p[0].Y = (int)coordList[(int)arr[i, 1]].point_1.y + d;

                p[1].X = (int)coordList[(int)arr[i, 1]].point_2.x + d;
                p[1].Y = (int)coordList[(int)arr[i, 1]].point_2.y + d;

                p[2].X = (int)coordList[(int)arr[i, 1]].point_4.x + d;
                p[2].Y = (int)coordList[(int)arr[i, 1]].point_4.y + d;

                p[3].X = (int)coordList[(int)arr[i, 1]].point_3.x + d;
                p[3].Y = (int)coordList[(int)arr[i, 1]].point_3.y + d;

                if (type == 1)
                {

                    int _alpha = Math.Abs((int)(255 * (NormAngle[(int)arr[i, 1]])));
                    Color clr = Color.FromArgb(_alpha, 25, 100, 120);
                    SolidBrush dr = new SolidBrush(clr);
                    graph.FillPolygon(Brushes.Black, p);
                    graph.FillPolygon(dr, p);
                }
                else
                    graph.DrawPolygon(pen, p);
            }

            return bmp;
        }
示例#3
0
 public _3Points(MathDescription.Points _point_1, MathDescription.Points _point_2, MathDescription.Points _point_3)
 {
     point_1 = _point_1;
     point_2 = _point_2;
     point_3 = _point_3;
 }
示例#4
0
文件: DrawTor.cs 项目: Mexahoid/CSF
 public MathDescription.Points Expansion(double _R, double _r, double _r1, double A, double B)
 {
     MathDescription.Points point = new MathDescription.Points();
     point.x = (_R + _r * Math.Cos(A * Math.PI / 180)) * Math.Cos(B * Math.PI / 180);
     point.y = (_R + _r *  Math.Cos(A * Math.PI / 180)) * Math.Sin(B * Math.PI / 180);
     point.z = _r1 * Math.Sin(A * Math.PI / 180);
     return point;
 }