Esempio n. 1
0
        public void Draw(string lable, Point3D center, DVector n, bool include1, Point3D a1p1, Point3D a1p2, double angle1Start, double angle1Finish, double angle1Step, bool include2, Point3D a2p1, Point3D a2p2, double angle2Start, double angle2Finish, double angle2Step, Color color)
        {
            bool           match             = false;
            List <Point3D> scannigPointsList = new List <Point3D>();
            int            numberAngle1      = Convert.ToInt32((angle1Finish - angle1Start) / angle1Step) + 1;
            int            numberAngle2      = Convert.ToInt32((angle2Finish - angle2Start) / angle2Step) + 1;


            for (int i = 0; i < numberAngle1; i++)
            {
                for (int j = 0; j < numberAngle2; j++)
                {
                    Point3D scPoint  = new Point3D(1 * n.X, 1 * n.Y, 1 * n.Z);
                    double  Angle1   = angle1Start + i * angle1Step;
                    double  Angle2   = angle2Start + j * angle2Step;
                    Point3D a2p1_rot = new Point3D(a2p1);
                    Point3D a2p2_rot = new Point3D(a2p2);
                    if (include1)
                    {
                        scPoint = Logic.Instance.RotateElement(scPoint, Angle1, a1p1.X, a1p1.Y, a1p1.Z, a1p2.X, a1p2.Y, a1p2.Z);
                    }
                    if (include2)
                    {
                        if (include1)
                        {
                            a2p1_rot = Logic.Instance.RotateElement(a2p1, Angle1, a1p1.X, a1p1.Y, a1p1.Z, a1p2.X, a1p2.Y, a1p2.Z);
                            a2p2_rot = Logic.Instance.RotateElement(a2p2, Angle1, a1p1.X, a1p1.Y, a1p1.Z, a1p2.X, a1p2.Y, a1p2.Z);
                        }

                        scPoint = Logic.Instance.RotateElement(scPoint, Angle2, a2p1_rot.X, a2p1_rot.Y, a2p1_rot.Z, a2p2_rot.X, a2p2_rot.Y, a2p2_rot.Z);
                    }
                    scannigPointsList.Add(scPoint);
                }
            }

            int count = ScanningPoints.Count;

            for (int i = 0; i < count; i++)
            {
                if (ScanningPoints[i].Title == lable)
                {
                    Scene.Instance.removeRenderObject(ScanningPoints[i]);
                    ScanningPoints[i] = new ScanRegionRender(Logic.Instance.RenderScale, lable, scannigPointsList, color);
                    Scene.Instance.addRenderObject(ScanningPoints[i]);
                    match = true;
                }
            }
            if (!match)
            {
                ScanRegionRender points = new ScanRegionRender(Logic.Instance.RenderScale, lable, scannigPointsList, color);
                ScanningPoints.Add(points);
                Scene.Instance.addRenderObject(points);
            }
        }
Esempio n. 2
0
        //Методы отрисовки объектов

        #region ScanRegion
        /// <summary>
        /// Отрисовка точек сканировния
        /// </summary>
        /// <param name="lable"></param>
        /// <param name="startTheta"></param>
        /// <param name="finishTheta"></param>
        /// <param name="stepTheta"></param>
        /// <param name="startPhi"></param>
        /// <param name="finishPhi"></param>
        /// <param name="stepPhi"></param>
        /// <param name="sys"></param>
        public void Draw(string lable, double startTheta, double finishTheta, double stepTheta, double startPhi, double finishPhi, double stepPhi, int sys, Color color)
        {
            List <Point3D> list = new List <Point3D>();

            if (stepPhi < 1)
            {
                stepPhi = 1;
            }

            int pointsThetaCount = Convert.ToInt32((finishTheta - startTheta) / stepTheta) + 1;
            int pointsPhiCount   = Convert.ToInt32((finishPhi - startPhi) / stepPhi) + 1;

            for (int iTheta = 0; iTheta < pointsThetaCount; iTheta++)
            {
                for (int iPhi = 0; iPhi < pointsPhiCount; iPhi++)
                {
                    double thetaLocal = startTheta + iTheta * stepTheta;
                    double phiLocal   = startPhi + iPhi * stepPhi;

                    double thetaG = Logic.GetThetaGlobal(phiLocal, thetaLocal, sys);
                    double phiG   = Logic.GetPhiGlobal(phiLocal, thetaLocal, sys);

                    double a = Math.Sin(thetaG * Math.PI / 180) * Math.Cos(phiG * Math.PI / 180);
                    double b = Math.Sin(thetaG * Math.PI / 180) * Math.Sin(phiG * Math.PI / 180);
                    double c = Math.Cos(thetaG * Math.PI / 180);

                    list.Add(new Point3D(a, b, c));
                }
            }

            int  count = ScanningPoints.Count;
            bool match = false;

            for (int i = 0; i < count; i++)
            {
                if (ScanningPoints[i].Title == lable)
                {
                    Scene.Instance.removeRenderObject(ScanningPoints[i]);
                    ScanningPoints[i] = new ScanRegionRender(Logic.Instance.RenderScale, lable, list, color);
                    Scene.Instance.addRenderObject(ScanningPoints[i]);
                    match = true;
                }
            }
            if (!match)
            {
                ScanRegionRender points = new ScanRegionRender(Logic.Instance.RenderScale, lable, list, color);
                ScanningPoints.Add(points);
                Scene.Instance.addRenderObject(points);
            }
        }