Exemple #1
0
        //追踪一条封闭的等值线
        private void TracingOneClosedContour()
        {
            int rows    = _accessContour.GridInfo._rows;    //这里是网格点的行列数
            int columns = _accessContour.GridInfo._columns;

            int startI = _curIsoPoint._row;
            int startJ = _curIsoPoint._column;

            _isoPointListInfo = new IsoPointListInfo();
            List <IsoPoint> isoPointList = new List <IsoPoint>();

            _isoPointListInfo._aIsoPointList = isoPointList;
            _isoPointListInfo._value         = _curFollowingValue;

            CalcCoord(_curIsoPoint._row, _curIsoPoint._column, false);

            TracingNextPoint();

            _preIsoPoint = _curIsoPoint;
            _curIsoPoint = _nextIsoPoint;

            bool isClosed = false;

            while (!isClosed)
            {
                TracingNextPoint();

                _preIsoPoint = _curIsoPoint;
                _curIsoPoint = _nextIsoPoint;

                isClosed = (_curIsoPoint._row == startI) && (_curIsoPoint._column == startJ) && (false == _curIsoPoint._isHorizon);
            }

            _allIsoPointList.Add(_isoPointListInfo);
        }
Exemple #2
0
        private static List <IsoPoint> ListClone(List <IsoPoint> list)
        {
            IsoPoint[] isoPointArray = new IsoPoint[list.Count];
            list.CopyTo(isoPointArray);

            return(new List <IsoPoint>(isoPointArray));
        }
Exemple #3
0
        public bool  _isHorizon;    //等值点是否在X轴上(水平线上)   true--X   false--Y

        public IsoPoint(IsoPoint isoPoint)
        {
            _column = isoPoint._column;
            _row    = isoPoint._row;

            _x = isoPoint._x;
            _y = isoPoint._y;

            _isHorizon = isoPoint._isHorizon;
        }
Exemple #4
0
        //光滑开曲线
        private static List <PointF> SmoothingNonClosedContour(List <IsoPoint> aIsoPointList)
        {
            List <PointF> aSmoothedList = new List <PointF>();

            float    interX   = aIsoPointList[1]._x - aIsoPointList[0]._x;
            float    interY   = aIsoPointList[1]._y - aIsoPointList[0]._y;
            IsoPoint isoPoint = new IsoPoint();

            isoPoint._x = aIsoPointList[0]._x - interX;
            isoPoint._y = aIsoPointList[0]._y - interY;
            aIsoPointList.Insert(0, isoPoint);

            interX      = aIsoPointList[aIsoPointList.Count - 1]._x - aIsoPointList[aIsoPointList.Count - 2]._x;
            interY      = aIsoPointList[aIsoPointList.Count - 1]._y - aIsoPointList[aIsoPointList.Count - 2]._y;
            isoPoint    = new IsoPoint();
            isoPoint._x = interX + aIsoPointList[aIsoPointList.Count - 1]._x;
            isoPoint._y = interY + aIsoPointList[aIsoPointList.Count - 1]._y;
            aIsoPointList.Add(isoPoint);

            double t1, t2, t3, t, a, b, c, d, x, y;

            t = 0.6f / Clip;

            for (int i = 0; i < aIsoPointList.Count - 3; i++)
            {
                for (int j = 1; j < Clip; j++)
                {
                    t1 = j * t;
                    t2 = t1 * t1;
                    t3 = t2 * t1;
                    a  = 4.0 * t2 - t1 - 4.0 * t3;
                    b  = 1.0 - 10.0 * t2 + 12.0 * t3;
                    c  = t1 + 8.0 * t2 - 12.0 * t3;
                    d  = 4.0 * t3 - 2.0 * t2;
                    x  = a * aIsoPointList[i]._x + b * aIsoPointList[i + 1]._x + c * aIsoPointList[i + 2]._x + d * aIsoPointList[i + 3]._x;
                    y  = a * aIsoPointList[i]._y + b * aIsoPointList[i + 1]._y + c * aIsoPointList[i + 2]._y + d * aIsoPointList[i + 3]._y;

                    aSmoothedList.Add(new PointF((float)x, (float)y));
                }
            }
            aSmoothedList.Insert(0, new PointF(aIsoPointList[1]._x, aIsoPointList[1]._y));
            aSmoothedList[aSmoothedList.Count - 1] = new PointF(aIsoPointList[aIsoPointList.Count - 2]._x, aIsoPointList[aIsoPointList.Count - 2]._y);

            return(aSmoothedList);
        }
Exemple #5
0
        //追踪一条等值线
        //这个函数要完成一条等值线追踪的所有操作
        private void TracingOneNonClosedContour()
        {
            int rows    = _accessContour.GridInfo._rows;    //这里是网格点的行列数
            int columns = _accessContour.GridInfo._columns;

            _isoPointListInfo = new IsoPointListInfo();
            List <IsoPoint> isoPointList = new List <IsoPoint>();

            _isoPointListInfo._aIsoPointList = isoPointList;
            _isoPointListInfo._value         = _curFollowingValue;

            CalcCoord(_curIsoPoint._row, _curIsoPoint._column, _curIsoPoint._isHorizon);

            if (_curIsoPoint._isHorizon)
            {
                _xSide[_curIsoPoint._row, _curIsoPoint._column]._isIsoPoint = false;
            }
            else
            {
                _ySide[_curIsoPoint._row, _curIsoPoint._column]._isIsoPoint = false;
            }

            TracingNextPoint();

            _preIsoPoint = _curIsoPoint;
            _curIsoPoint = _nextIsoPoint;

            bool isFinish = (_curIsoPoint._row == 0 && _curIsoPoint._isHorizon) || (_curIsoPoint._column == 0 && !_curIsoPoint._isHorizon) ||
                            (_curIsoPoint._row == rows - 1) || (_curIsoPoint._column == columns - 1);

            while (!isFinish)
            {
                TracingNextPoint();

                _preIsoPoint = _curIsoPoint;
                _curIsoPoint = _nextIsoPoint;

                isFinish = (_curIsoPoint._row == 0 && _curIsoPoint._isHorizon) || (_curIsoPoint._column == 0 && !_curIsoPoint._isHorizon) ||
                           (_curIsoPoint._row == rows - 1) || (_curIsoPoint._column == columns - 1);
            }

            _allIsoPointList.Add(_isoPointListInfo);
        }
Exemple #6
0
        //计算当前等值点所在的坐标
        private void CalcCoord(int row, int column, bool isHorizon)
        {
            IsoPoint isoPoint = new IsoPoint();

            isoPoint._column    = column;
            isoPoint._row       = row;
            isoPoint._isHorizon = isHorizon;

            if (isHorizon)
            {
                isoPoint._x = _accessContour.GridInfo._xMin + (column + _xSide[row, column]._rate) * _deltX;
                isoPoint._y = _accessContour.GridInfo._yMin + row * _deltY;
            }
            else
            {
                isoPoint._x = _accessContour.GridInfo._xMin + column * _deltX;
                isoPoint._y = _accessContour.GridInfo._yMin + (row + _ySide[row, column]._rate) * _deltY;
            }

            float value = _curFollowingValue;

            _isoPointListInfo._aIsoPointList.Add(isoPoint);
        }