Exemplo n.º 1
0
        public override void Draw(LabParameters labParameters)
        {
            if (!(labParameters is FourthLabParameters parameters))
            {
                throw new ArgumentException($"{nameof(labParameters)} has wrong type: {labParameters.GetType().Name}");
            }

            DrawLab(parameters.WindowPoints, parameters.FigurePoints);
        }
Exemplo n.º 2
0
        public override void Draw(LabParameters labParameters)
        {
            if (!(labParameters is FirstLabParameters parameters))
                throw new ArgumentException($"{nameof(labParameters)} has wrong type: {labParameters.GetType().Name}");

            Drawer.DrawCircle(Source, parameters.FirstCenter, parameters.FirstRadius);
            Drawer.DrawCircle(Source, parameters.SecondCenter, parameters.SecondRadius);

            DrawTangents(parameters.FirstCenter, parameters.FirstRadius,
                parameters.SecondCenter, parameters.SecondRadius);
        }
Exemplo n.º 3
0
        //private void Preset1()
        //{
        //    BackGroundColor = new ColorRGB(0, 0, 0);
        //    //Light Sources
        //    LightSources = new LightSource[3];
        //    DoublePoint3D point;
        //    float intensity;
        //    string type;

        //    intensity = 0.2f;
        //    LightSources[0] = new LightSource(intensity);

        //    point = new DoublePoint3D(2, 1, 0);
        //    intensity = 0.6f;
        //    type = "Point";
        //    LightSources[1] = new LightSource(point, intensity, type);

        //    point = new DoublePoint3D(1, 4, 4);
        //    intensity = 0.2f;
        //    type = "Directional";
        //    LightSources[2] = new LightSource(point, intensity, type);

        //    //Spheres
        //    Spheres = new Sphere[4];
        //    DoublePoint3D center;
        //    double radius;
        //    ColorRGB color;
        //    int specular;
        //    float reflection;
        //    float transparency;

        //    center = new DoublePoint3D(0, -1, 3);
        //    radius = 1;
        //    color = new ColorRGB(255, 0, 0); //Red
        //    specular = 500;
        //    reflection = 0.2f;
        //    transparency = 0f;
        //    Spheres[0] = new Sphere(center, radius, color, specular, reflection, transparency);

        //    center = new DoublePoint3D(2, 0, 4);
        //    radius = 1;
        //    color = new ColorRGB(0, 0, 255); //Blue
        //    specular = 500;
        //    reflection = 0.3f;
        //    transparency = 0f;
        //    Spheres[1] = new Sphere(center, radius, color, specular, reflection, transparency);

        //    center = new DoublePoint3D(-2, 0, 4);
        //    radius = 1;
        //    color = new ColorRGB(0, 255, 0); //Green
        //    specular = 10;
        //    reflection = 0.4f;
        //    transparency = 0f;
        //    Spheres[2] = new Sphere(center, radius, color, specular, reflection, transparency);

        //    center = new DoublePoint3D(0, -5001, 0);
        //    radius = 5000;
        //    color = new ColorRGB(255, 255, 0); //Yellow
        //    specular = 1000;
        //    reflection = 0.5f;
        //    transparency = 0f;
        //    Spheres[3] = new Sphere(center, radius, color, specular, reflection, transparency);
        //}
        #endregion

        public override void Draw(LabParameters labParameters)
        {
            if (!(labParameters is SixthLabParameters parameters))
            {
                throw new ArgumentException($"{nameof(labParameters)} has wrong type: {labParameters.GetType().Name}");
            }

            //Preset1();

            GraphicalObjects = parameters.GraphicalObjects;
            LightSources     = parameters.LightSources;

            RenderScene(parameters.CameraPosition, parameters.CameraRotation);
        }
Exemplo n.º 4
0
        public override void Draw(LabParameters labParameters)
        {
            if (!(labParameters is ThirdLabParameters parameters))
            {
                throw new ArgumentException($"{nameof(labParameters)} has wrong type: {labParameters.GetType().Name}");
            }

            var areaPoints = new DoublePoint3D[parameters.AreaPointsXY.Length];

            for (var i = 0; i < parameters.AreaPointsXY.Length; i++)
            {
                areaPoints[i] = new DoublePoint3D(parameters.AreaPointsXY[i], parameters.AreaPointZ[i]);
            }

            DrawLab(areaPoints, parameters.XRotateDegree, parameters.YRotateDegree);
        }
Exemplo n.º 5
0
        public override void Draw(LabParameters labParameters)
        {
            if (!(labParameters is SecondLabParameters parameters))
            {
                throw new ArgumentException($"{nameof(labParameters)} has wrong type: {labParameters.GetType().Name}");
            }

            for (int i = 0; i < parameters.SplainPoints.Length; i++)
            {
                //Drawer.DrawDot(Source, parameters.SplainPoints[i], Color.DarkRed);
                Drawer.DrawCircle(Source, new Point(parameters.SplainPoints[i].X, parameters.SplainPoints[i].Y), 3, Color.DarkRed);
            }
            //Draw_spline(parameters.SplainPoints);
            //DetailedRecreatedBSplainOnSecretDocuments(parameters.SplainPoints, parameters.SplainPow);
            calculatePath(parameters.SplainPoints, parameters.SplainPow);
        }
Exemplo n.º 6
0
        private void ParseParameters()
        {
            if (_formatErrors.Count > 0)
            {
                MessageBox.Show(
                    $"Исправьте ошибки в полях: {string.Join(", ", _formatErrors.Select(x => x.Name))}");
                return;
            }

            switch (_currentLab)
            {
            case 1:
                _labParameters = ParseFirstLabParameters();
                break;

            case 2:
                _labParameters = ParseSecondLabParameters();
                break;

            case 3:
                _labParameters = ParseThirdLabParameters();
                break;

            case 4:
                _labParameters = ParseFourthLabParameters();
                break;

            case 5:
                //todo: парсинг параметров для 5 лабы
                break;

            case 6:
                _labParameters = ParseSixthLabParameters();
                break;

            default:
                throw new ArgumentOutOfRangeException($"{nameof(_currentLab)} hasn't been in 1-5 interval");
            }
        }
Exemplo n.º 7
0
        private void SetDefaultsForSixthLab()
        {
            _labBase = new SixthLab(_image);

            var elements = new IAddable[7];

            elements[0] = new AmbientLight(0.2f);

            elements[1] = new PointLight(
                new DoublePoint3D(2, 1, 0),
                0.6f
                );

            elements[2] = new DirectLight(
                new DoublePoint3D(1, 4, 4),
                0.2f
                );

            elements[3] = new Sphere(
                new DoublePoint3D(0, -1, 3),
                1,
                new ColorRGB(255, 0, 0),
                500,
                0.2f,
                0f);

            elements[4] = new Sphere(
                new DoublePoint3D(2, 0, 4),
                1,
                new ColorRGB(0, 0, 255),
                500,
                0.3f,
                0f);

            elements[5] = new Sphere(
                new DoublePoint3D(-2, 0, 4),
                1,
                new ColorRGB(0, 255, 0),
                10,
                0.4f,
                0f);

            elements[6] = new Sphere(
                new DoublePoint3D(0, -5001, 0),
                5000,
                new ColorRGB(255, 255, 0),
                1000,
                0.5f,
                0f);

            /*elements[6] = new Hexahedron(
             *  new DoublePoint3D[] {
             *  new DoublePoint3D(-1, -1, 4),
             *  new DoublePoint3D(-1, 1, 4),
             *  new DoublePoint3D(1, 1, 4),
             *  new DoublePoint3D(1, -1, 4),
             *  new DoublePoint3D(0, 0, 0),
             *  new DoublePoint3D(0, 0, 0),
             *  new DoublePoint3D(0, 0, 0),
             *  new DoublePoint3D(0, 0, 0)
             *  },
             *  new DoublePoint2D(0, 0),
             *  new ColorRGB(255,0,0),
             *  1000,
             *  0f,
             *  0f
             *  );*/

            ElementsLB.Items.AddRange(elements);

            CameraX.Text = "0";
            CameraY.Text = "0";
            CameraZ.Text = "0";

            CameraXAngleTB.Value = 0;
            CameraYAngleTB.Value = 0;

            _labParameters = ParseSixthLabParameters();
            (_labParameters as SixthLabParameters).Initial = true;
        }
Exemplo n.º 8
0
 private void SetDefaultsForFourthLab()
 {
     _labBase       = new FourthLab(_image);
     _labParameters = ParseFourthLabParameters();
     FirstPresetFourthLab();
 }
Exemplo n.º 9
0
 private void SetDefaultsForThirdLab()
 {
     FirstPresetThirdLab();
     _labBase       = new ThirdLab(_image);
     _labParameters = ParseThirdLabParameters();
 }
Exemplo n.º 10
0
 private void SetDefaultsForSecondLab()
 {
     _labBase       = new SecondLab(_image);
     _labParameters = ParseSecondLabParameters();
 }
Exemplo n.º 11
0
 private void SetDefaultsForFirstLab()
 {
     _labBase       = new FirstLab(_image);
     _labParameters = ParseFirstLabParameters();
 }
Exemplo n.º 12
0
 public abstract void Draw(LabParameters parameters);