Esempio n. 1
0
        private static List <Point> ConstructRasterSFC(Point startPoint, int height, int width, SpaceFillingCurve sFC)
        {
            List <Point> result = new List <Point>();

            if (height * width == sFC.NumberOfSteps)
            {
                return(sFC.TraverseTheBasePath(startPoint));
            }

            int newHeight = height / sFC.BaseSize;

            int newWidth = width / sFC.BaseSize;

            Point tempPoint = startPoint;

            for (int i = 0; i < sFC.NumberOfSteps; i++)
            {
                SpaceFillingCurve temp = sFC.CalculateSubregionBMFs(i);

                result.AddRange(ConstructRasterSFC(tempPoint, newHeight, newWidth, temp));

                if (i == sFC.NumberOfSteps - 1)
                {
                    continue;
                }

                tempPoint = sFC.MoveToNextRegion(i, tempPoint, newWidth);
            }

            return(result);
        }
Esempio n. 2
0
        private static List <double> Project2DDataTo1D(Point startPoint, int height, int width, double[,] values, SpaceFillingCurve sFC)
        {
            List <double> result = new List <double>();

            if (height * width == sFC.NumberOfSteps)
            {
                List <Point> temp = sFC.TraverseTheBasePath(startPoint);

                List <double> tempResult = new List <double>();

                foreach (Point item in temp)
                {
                    tempResult.Add(values[(int)item.X, (int)item.Y]);
                }

                return(tempResult);
            }

            int newHeight = height / sFC.BaseSize;

            int newWidth = width / sFC.BaseSize;

            Point tempPoint = startPoint;

            for (int i = 0; i < sFC.NumberOfSteps; i++)
            {
                SpaceFillingCurve temp = sFC.CalculateSubregionBMFs(i);

                result.AddRange(Project2DDataTo1D(tempPoint, newHeight, newWidth, values, temp));

                if (i == sFC.NumberOfSteps - 1)
                {
                    continue;
                }

                tempPoint = sFC.MoveToNextRegion(i, tempPoint, newWidth);
            }

            return(result);
        }