예제 #1
0
        private void RedrawPoint()
        {
            ChangePictureBoxPicture(_bgWithLines);
            var gr = Graphics.FromImage(pictureBox.Image);
            var p1 = _line1[_currentStep];

            RG.FillPoint(X, Y, _xpxsz, _ypxsz, _sz, Config.Black, p1, gr, CProjection.UpC0C1);
            var p2 = _line2[_currentStep];

            RG.FillPoint(X, Y, _xpxsz, _ypxsz, _sz, Config.White, p2, gr, CProjection.UpC0C1);
        }
예제 #2
0
        private void RedrawWithLines()
        {
            if (_bgWithLines != null)
            {
                _bgWithLines.Dispose();
            }
            _bgWithLines = _bg.Clone() as Bitmap;
            _rline1      = RGPoint.ParabolaReversed(_a, _b, _rmin, _rmax, _rstep).ToList();
            _line1       = _rline1.Select(rg => rg.CReversed).ToList();

            _rline2 = new List <RGPoint>();
            foreach (var rp1 in _rline1)
            {
                var r   = rp1.R;
                var r1  = RgSettings.Lambda * ((_a - _b + (RgSettings.N - 1) * Math.Pow(RgSettings.Lambda, -1)) / (1 - RgSettings.N)) * ((r - _a1) / (r - _b1));
                var g1  = (r1 - _a11) / (r1 - _b11) * Math.Pow(r1 + 1, 2);
                var rp2 = new RGPoint {
                    R = r1, G = g1
                };
                _rline2.Add(rp2);
            }
            _line2 = _rline2.Select(rg => rg.CReversed).ToList();

            var nearestToB = _rline1.OrderBy(rp => Math.Abs(rp.R - _b)).FirstOrDefault();
            var nearestToL = _rline1.OrderBy(rp => Math.Abs(rp.R - -Math.Pow(RgSettings.Lambda, -1))).FirstOrDefault();

            var cNearestToB = nearestToB != null ? nearestToB.CReversed : null;
            var cNearesToL  = nearestToL != null ? nearestToL.CReversed : null;

            if (_bgWithLines != null)
            {
                var gr = Graphics.FromImage(_bgWithLines);

                var pen1 = new Pen(Config.Black);
                for (var i = 0; i < _line1.Count - 1; i++)
                {
                    var c1 = _line1[i];
                    var c2 = _line1[i + 1];
                    RG.DrawLine(X, Y, _xpxsz, _ypxsz, _sz, pen1, c1, c2, gr, CProjection.UpC0C1);
                }

                var pen2 = new Pen(Config.White);
                for (var i = 0; i < _line2.Count - 1; i++)
                {
                    var c1 = _line2[i];
                    var c2 = _line2[i + 1];
                    RG.DrawLine(X, Y, _xpxsz, _ypxsz, _sz, pen2, c1, c2, gr, CProjection.UpC0C1);
                }

                if (cNearestToB != null)
                {
                    RG.FillPoint(X, Y, _xpxsz, _ypxsz, _sz, Config.Red, cNearestToB, gr, CProjection.UpC0C1);
                }
                if (cNearesToL != null)
                {
                    RG.FillPoint(X, Y, _xpxsz, _ypxsz, _sz, Config.Yellow, cNearesToL, gr, CProjection.UpC0C1);
                }
                gr.Save();
            }
            ChangePictureBoxPicture(_bgWithLines);
            pictureBox.Update();
        }