Beispiel #1
0
        public Point GetStartPointRelativeLocation(int subregionSize)
        {
            List <Point> relativePoints = new List <Point>();

            relativePoints.Add(GetStartPointRelativeLocation());

            SpaceFillingCurve temp = this;

            while (subregionSize > this.baseSize)
            {
                subregionSize = subregionSize / this.baseSize;

                temp = temp.CalculateSubregionBMFs(0);

                relativePoints.Add(temp.GetStartPointRelativeLocation());
            }

            Point result = new Point(0, 0);

            for (int i = 0; i < relativePoints.Count; i++)
            {
                result.X = result.X + relativePoints[i].X * Math.Pow(this.baseSize, relativePoints.Count - 1 - i);

                result.Y = result.Y + relativePoints[i].Y * Math.Pow(this.baseSize, relativePoints.Count - 1 - i);
            }

            return(result);
        }
Beispiel #2
0
        public static List <double> Project2DDataTo1D(double[,] values, SpaceFillingCurve sFC)
        {
            int width = values.GetLength(0);

            int height = values.GetLength(1);

            Point startPoint = sFC.GetStartPointRelativeLocation(width);

            return(Project2DDataTo1D(startPoint, height, width, values, sFC));
        }
Beispiel #3
0
        public static Point TransformIndexToPoint(SpaceFillingCurve sFC, int index, int size)
        {
            List <int> baseRepresentation = new List <int>();

            int baseValue = sFC.NumberOfSteps;

            int outputLength = (int)Math.Log(size, sFC.BaseSize);

            int temp = index;

            do
            {
                baseRepresentation.Add(temp % baseValue);

                temp = temp / baseValue;
            } while (temp >= 1 || baseRepresentation.Count < outputLength);

            baseRepresentation.Reverse();

            Point startPoint = sFC.GetStartPointRelativeLocation();

            startPoint = new Point(startPoint.X * (size - 1) / (sFC.BaseSize - 1), startPoint.Y * (size - 1) / (sFC.BaseSize - 1));

            for (int i = 0; i < baseRepresentation.Count; i++)
            {
                size = size / sFC.BaseSize;

                if (size == 1)
                {
                    for (int j = 0; j < baseRepresentation[i]; j++)
                    {
                        startPoint = sFC[j](startPoint, 1);
                    }
                }
                else
                {
                    for (int j = 0; j < baseRepresentation[i]; j++)
                    {
                        startPoint = sFC.MoveToNextRegion(j, startPoint, size);
                    }
                }

                sFC = sFC.CalculateSubregionBMFs(baseRepresentation[i]);
            }

            return(startPoint);
        }
Beispiel #4
0
        public static List <Point> ConstructRasterSFC(int height, int width, SpaceFillingCurve sFC)
        {
            Point startPoint = sFC.GetStartPointRelativeLocation(width);

            return(ConstructRasterSFC(startPoint, height, width, sFC));
        }