Ejemplo n.º 1
0
        public RegionMoves Transform(Transform transform)
        {
            RegionMoves newRegionMoves = new RegionMoves();

            if (ForwardIn1stD.Count > 0)
            {
                newRegionMoves.Add(transform(ForwardIn1stD.GetMove()), ForwardIn1stD.Count);
            }

            if (ReverseIn1stD.Count > 0)
            {
                newRegionMoves.Add(transform(ReverseIn1stD.GetMove()), ReverseIn1stD.Count);
            }

            if (ForwardIn2ndD.Count > 0)
            {
                newRegionMoves.Add(transform(ForwardIn2ndD.GetMove()), ForwardIn2ndD.Count);
            }

            if (ReverseIn2ndD.Count > 0)
            {
                newRegionMoves.Add(transform(ReverseIn2ndD.GetMove()), ReverseIn2ndD.Count);
            }

            return(newRegionMoves);
        }
Ejemplo n.º 2
0
        public static RegionMoves Combine(RegionMoves first, RegionMoves second)
        {
            RegionMoves newRegionMoves = new RegionMoves();

            newRegionMoves.SetDirectionSegmentCount(first.ForwardIn1stD.Count + second.ForwardIn1stD.Count,
                                                    first.ReverseIn1stD.Count + second.ReverseIn1stD.Count,
                                                    first.ForwardIn2ndD.Count + second.ForwardIn2ndD.Count,
                                                    first.ReverseIn2ndD.Count + second.ReverseIn2ndD.Count);

            newRegionMoves.SetDistanceSegmentCount(first.JumpIn1stD.Count + second.JumpIn1stD.Count,
                                                   first.ContiguityIn1stD.Count + second.ContiguityIn1stD.Count,
                                                   first.JumpIn2ndD.Count + second.JumpIn2ndD.Count,
                                                   first.ContiguityIn2ndD.Count + second.ContiguityIn2ndD.Count);

            return(newRegionMoves);
        }
Ejemplo n.º 3
0
        public static RegionMoves Measure(SpaceFillingCurve sFC, int level, firstToOtherSubregionTransforms firstToOtherSubregions)
        {
            RegionMoves totalRegionMoves = new RegionMoves();

            RegionMoves regionMoves = new RegionMoves();

            if (level == 0)
            {
                regionMoves.Add(sFC);

                return(regionMoves);
            }
            else
            {
                regionMoves = Measure(sFC.CalculateSubregionBMFs(0), level - 1, firstToOtherSubregions);

                totalRegionMoves = RegionMoves.Combine(regionMoves, totalRegionMoves);

                List <Transform> transforms = firstToOtherSubregions(sFC.CalculateSubregionBMFs(0).GetMoves());

                int subRegionSize = (int)Math.Pow(sFC.BaseSize, level);

                for (int i = 0; i < sFC.NumberOfSteps - 1; i++)
                {
                    RegionMoves otherRegionMoves = regionMoves.Transform(transforms[i]);

                    totalRegionMoves = RegionMoves.Combine(otherRegionMoves, totalRegionMoves);

                    Point tempPoint01 = sFC.CalculateSubregionBMFs(i).TraverseTheBasePath(new Point(0, 0), subRegionSize - 1).Last();

                    Point tempPoint02 = sFC.MoveToNextRegion(i, new Point(0, 0), subRegionSize);

                    totalRegionMoves.Add(new Move((p, s) => new Point(p.X + tempPoint02.X - tempPoint01.X, p.Y + tempPoint02.Y - tempPoint01.Y)));
                }

                return(totalRegionMoves);
            }
        }