public override void Clear()
 {
     ShortcutSet = null;
     Source      = null;
     Targets     = new JHashSet <TPoint2D>();
     ShortcutSet = null;
 }
 public SPFInput(Trajectory2D Trajectory, IShortcutSet ShortcutSet, TPoint2D Source, JHashSet <TPoint2D> Targets, bool CreatePath = true)
 {
     this.Trajectory  = Trajectory;
     this.ShortcutSet = ShortcutSet;
     this.Source      = Source;
     this.Targets     = Targets;
     this.CreatePath  = CreatePath;
 }
예제 #3
0
        public Dictionary <TPoint2D, JHashSet <TPoint2D> > AsMap()
        {
            var map = new Dictionary <TPoint2D, JHashSet <TPoint2D> >();

            foreach (var point in Trajectory)
            {
                map[point] = new JHashSet <TPoint2D>();
            }

            foreach (var shortcut in Shortcuts.Keys)
            {
                map[shortcut.Start].Add(shortcut.End);
            }

            return(map);
        }
예제 #4
0
        //O(n^2)
        public Dictionary <TPoint2D, JHashSet <TPoint2D> > AsMap()
        {
            var map = new Dictionary <TPoint2D, JHashSet <TPoint2D> >();

            foreach (var pair in IntervalMap)
            {
                var point     = pair.Key;
                var intervals = pair.Value;
                var ends      = new JHashSet <TPoint2D>();

                foreach (var interval in intervals)
                {
                    for (var i = interval.Start.Index; i <= interval.End.Index; i++)
                    {
                        ends.Add(Trajectory[i]);
                    }
                }

                map[point] = ends;
            }

            return(map);
        }
예제 #5
0
 public abstract Dictionary <TPoint2D, ShortcutPath> FindShortestPaths(IShortcutSet set, TPoint2D source, JHashSet <TPoint2D> targets, bool createPaths = true);
예제 #6
0
        public override Dictionary <TPoint2D, ShortcutPath> FindShortestPaths(IShortcutSet set, TPoint2D source, JHashSet <TPoint2D> targets, bool createPaths = true)
        {
            var input = new SPFInput
            {
                Trajectory  = set.Trajectory,
                ShortcutSet = set,
                Source      = source,
                Targets     = targets,
                CreatePath  = createPaths
            };

            SPFOutput output;

            algorithm.Compute(input, out output);

            return(output.ShortcutPaths);
        }