예제 #1
0
        public JumpPointParam(BaseGrid iGrid, bool iAllowEndNodeUnWalkable = true, bool iCrossCorner = true, bool iCrossAdjacentPoint = true, HeuristicMode iMode = HeuristicMode.EUCLIDEAN)
        {
            switch (iMode)
            {
            case HeuristicMode.MANHATTAN:
                m_heuristic = new HeuristicDelegate(Heuristic.Manhattan);
                break;

            case HeuristicMode.EUCLIDEAN:
                m_heuristic = new HeuristicDelegate(Heuristic.Euclidean);
                break;

            case HeuristicMode.CHEBYSHEV:
                m_heuristic = new HeuristicDelegate(Heuristic.Chebyshev);
                break;

            default:
                m_heuristic = new HeuristicDelegate(Heuristic.Euclidean);
                break;
            }
            m_allowEndNodeUnWalkable = iAllowEndNodeUnWalkable;
            m_crossAdjacentPoint     = iCrossAdjacentPoint;
            m_crossCorner            = iCrossCorner;

            openList = new List <Node>();

            m_searchGrid   = iGrid;
            m_startNode    = null;
            m_endNode      = null;
            m_useRecursive = false;
        }
예제 #2
0
        public JumpPointParam(BaseGrid iGrid, bool iAllowEndNodeUnWalkable = true, bool iCrossCorner = true, bool iCrossAdjacentPoint=true, HeuristicMode iMode = HeuristicMode.EUCLIDEAN)
        {
            switch (iMode)
            {
                case HeuristicMode.MANHATTAN:
                    m_heuristic = new HeuristicDelegate(Heuristic.Manhattan);
                    break;
                case HeuristicMode.EUCLIDEAN:
                    m_heuristic = new HeuristicDelegate(Heuristic.Euclidean);
                    break;
                case HeuristicMode.CHEBYSHEV:
                    m_heuristic = new HeuristicDelegate(Heuristic.Chebyshev);
                    break;
                default:
                    m_heuristic = new HeuristicDelegate(Heuristic.Euclidean);
                    break;
            }
            m_allowEndNodeUnWalkable = iAllowEndNodeUnWalkable;
            m_crossAdjacentPoint = iCrossAdjacentPoint;
            m_crossCorner = iCrossCorner;

            openList = new List<Node>();

            m_searchGrid = iGrid;
            m_startNode = null;
            m_endNode = null;
            m_useRecursive = false;
        }
예제 #3
0
        public JumpPointParam(BaseGrid grid, EndNodeUnWalkableTreatment allowEndNodeUnWalkable = EndNodeUnWalkableTreatment.Allow, DiagonalMovement diagonalMovement = DiagonalMovement.Always, HeuristicMode mode = HeuristicMode.Euclidean)
            : base(grid, diagonalMovement, mode)
        {
            CurEndNodeUnWalkableTreatment = allowEndNodeUnWalkable;

            OpenList         = new IntervalHeap <Node>();
            CurIterationType = IterationType.Loop;
        }
예제 #4
0
        public ParamBase(BaseGrid iGrid, HeuristicMode iMode)
        {
            SetHeuristic(iMode);

            m_searchGrid = iGrid;
            m_startNode  = null;
            m_endNode    = null;
        }
예제 #5
0
        public ParamBase(BaseGrid iGrid, DiagonalMovement iDiagonalMovement, HeuristicMode iMode)
        {
            SetHeuristic(iMode);

            m_searchGrid     = iGrid;
            DiagonalMovement = iDiagonalMovement;
            m_startNode      = null;
            m_endNode        = null;
        }
예제 #6
0
        public JumpPointParam(BaseGrid iGrid, bool iAllowEndNodeUnWalkable = true, bool iCrossCorner = true, bool iCrossAdjacentPoint = true, HeuristicMode iMode = HeuristicMode.EUCLIDEAN)
            : base(iGrid, iMode)
        {
            m_allowEndNodeUnWalkable = iAllowEndNodeUnWalkable;
            m_crossAdjacentPoint     = iCrossAdjacentPoint;
            m_crossCorner            = iCrossCorner;

            openList       = new IntervalHeap <Node>();
            m_useRecursive = false;
        }
예제 #7
0
 public ParamBase(BaseGrid iGrid, GridPos iStartPos, GridPos iEndPos, DiagonalMovement iDiagonalMovement, HeuristicMode iMode) : this(iGrid, iDiagonalMovement, iMode)
 {
     m_startNode = m_searchGrid.GetNodeAt(iStartPos.x, iStartPos.y);
     m_endNode   = m_searchGrid.GetNodeAt(iEndPos.x, iEndPos.y);
     if (m_startNode == null)
     {
         m_startNode = new Node(iStartPos.x, iStartPos.y, true);
     }
     if (m_endNode == null)
     {
         m_endNode = new Node(iEndPos.x, iEndPos.y, true);
     }
 }
예제 #8
0
        public SearchGridForm()
        {
            InitializeComponent();
            this.DoubleBuffered = true;

            m_resultBox      = new List <ResultBox>();
            this.Width       = (width + 1) * 20;
            this.Height      = (height + 1) * 20 + 100;
            this.MaximumSize = new Size(this.Width, this.Height);
            this.MaximizeBox = false;


            m_rectangles = new GridBox[width][];
            for (int widthTrav = 0; widthTrav < width; widthTrav++)
            {
                m_rectangles[widthTrav] = new GridBox[height];
                for (int heightTrav = 0; heightTrav < height; heightTrav++)
                {
                    if (widthTrav == (width / 3) && heightTrav == (height / 2))
                    {
                        m_rectangles[widthTrav][heightTrav] = new GridBox(widthTrav * 20, heightTrav * 20 + 50, BoxType.Start);
                    }
                    else if (widthTrav == 41 && heightTrav == (height / 2))
                    {
                        m_rectangles[widthTrav][heightTrav] = new GridBox(widthTrav * 20, heightTrav * 20 + 50, BoxType.End);
                    }
                    else
                    {
                        m_rectangles[widthTrav][heightTrav] = new GridBox(widthTrav * 20, heightTrav * 20 + 50, BoxType.Normal);
                    }
                }
            }

            m_resultLine = new List <GridLine>();

            searchGrid = new StaticGrid(width, height);
            // searchGrid = new DynamicGrid();
            //searchGrid = new DynamicGridWPool(SingletonHolder<NodePool>.Instance);
            jumpParam = new JumpPointParam(searchGrid, true, cbCrossCorners.Checked, cbCrossAdjacentPoint.Checked, HeuristicMode.EUCLIDEAN);//new JumpPointParam(searchGrid, startPos, endPos, cbCrossCorners.Checked, HeuristicMode.EUCLIDEANSQR);
            jumpParam.UseRecursive = cbUseRecursive.Checked;
        }
예제 #9
0
        public void Reset(GridPos iStartPos, GridPos iEndPos, BaseGrid iSearchGrid = null)
        {
            openList.Clear();
            m_startNode = null;
            m_endNode   = null;

            if (iSearchGrid != null)
            {
                m_searchGrid = iSearchGrid;
            }
            m_searchGrid.Reset();
            m_startNode = m_searchGrid.GetNodeAt(iStartPos.x, iStartPos.y);
            m_endNode   = m_searchGrid.GetNodeAt(iEndPos.x, iEndPos.y);
            if (m_startNode == null)
            {
                m_startNode = new Node(iStartPos.x, iStartPos.y, true);
            }
            if (m_endNode == null)
            {
                m_endNode = new Node(iEndPos.x, iEndPos.y, true);
            }
        }
예제 #10
0
        internal override void _reset(GridPos iStartPos, GridPos iEndPos, BaseGrid iSearchGrid = null)
        {

        }
예제 #11
0
 internal override void _reset(GridPos iStartPos, GridPos iEndPos, BaseGrid iSearchGrid = null)
 {
     openList = new IntervalHeap <Node>();
     //openList.Clear();
 }
예제 #12
0
 public AStarParam(BaseGrid iGrid, float iweight, DiagonalMovement iDiagonalMovement = DiagonalMovement.Always, HeuristicMode iMode = HeuristicMode.EUCLIDEAN)
     : base(iGrid, iDiagonalMovement, iMode)
 {
     Weight = iweight;
 }
예제 #13
0
 internal abstract void _reset(GridPos iStartPos, GridPos iEndPos, BaseGrid iSearchGrid = null);
예제 #14
0
 internal override void ResetInternal(GridPos startPos, GridPos endPos, BaseGrid searchGrid = null)
 => OpenList = new IntervalHeap <Node>();               //openList.Clear();
예제 #15
0
        public void Reset(GridPos iStartPos, GridPos iEndPos, BaseGrid iSearchGrid = null)
        {
            openList.Clear();
            m_startNode = null;
            m_endNode = null;

            if (iSearchGrid != null)
                m_searchGrid = iSearchGrid;
            m_searchGrid.Reset();
            m_startNode = m_searchGrid.GetNodeAt(iStartPos.x, iStartPos.y);
            m_endNode = m_searchGrid.GetNodeAt(iEndPos.x, iEndPos.y);
            if (m_startNode == null)
                m_startNode = new Node(iStartPos.x, iStartPos.y, true);
            if (m_endNode == null)
                m_endNode = new Node(iEndPos.x, iEndPos.y, true);


        }
예제 #16
0
 public BaseGrid(BaseGrid b)
 {
     m_gridRect = new GridRect(b.m_gridRect);
     width      = b.width;
     height     = b.height;
 }
예제 #17
0
        public JumpPointParam(JumpPointParam b)
        {
            m_heuristic = b.m_heuristic;
            m_allowEndNodeUnWalkable = b.m_allowEndNodeUnWalkable;
            m_crossAdjacentPoint = b.m_crossAdjacentPoint;
            m_crossCorner = b.m_crossCorner;

            openList = new List<Node>(b.openList);

            m_searchGrid = b.m_searchGrid;
            m_startNode = b.m_startNode;
            m_endNode = b.m_endNode;
            m_useRecursive = b.m_useRecursive;
        }
예제 #18
0
 protected BaseGrid(BaseGrid b)
 {
     gridRect = new GridRect(b.gridRect);
     Width    = b.Width;
     Height   = b.Height;
 }
예제 #19
0
		public AStarParam(BaseGrid grid, GridPos startPos, GridPos endPos, float weight, DiagonalMovement diagonalMovement = DiagonalMovement.Always, HeuristicMode mode = HeuristicMode.Euclidean)
			: base(grid, startPos, endPos, diagonalMovement, mode)
			=> Weight = weight;
예제 #20
0
        public SearchGridForm()
        {



            InitializeComponent();
            this.DoubleBuffered = true;

            m_resultBox = new List<ResultBox>();
            this.Width = (width+1) * 20;
            this.Height = (height+1) * 20 +100;
            this.MaximumSize = new Size(this.Width, this.Height);
            this.MaximizeBox = false;


            m_rectangles = new GridBox[width][];
            for (int widthTrav = 0; widthTrav < width; widthTrav++)
            {
                m_rectangles[widthTrav] = new GridBox[height];
                for (int heightTrav = 0; heightTrav < height; heightTrav++)
                {
                    if(widthTrav==(width/3) && heightTrav==(height/2))
                        m_rectangles[widthTrav][heightTrav] = new GridBox(widthTrav * 20, heightTrav * 20 + 50, BoxType.Start);
                    else if (widthTrav == 41 && heightTrav == (height / 2))
                        m_rectangles[widthTrav][heightTrav] = new GridBox(widthTrav * 20 , heightTrav * 20 + 50, BoxType.End);
                    else
                        m_rectangles[widthTrav][heightTrav] = new GridBox(widthTrav * 20, heightTrav * 20 + 50, BoxType.Normal);


                }
            }

            m_resultLine = new List<GridLine>();

             searchGrid = new StaticGrid(width, height);
            // searchGrid = new DynamicGrid();
            //searchGrid = new DynamicGridWPool(SingletonHolder<NodePool>.Instance);
            jumpParam = new JumpPointParam(searchGrid, true, cbCrossCorners.Checked, cbCrossAdjacentPoint.Checked, HeuristicMode.EUCLIDEAN);//new JumpPointParam(searchGrid, startPos, endPos, cbCrossCorners.Checked, HeuristicMode.EUCLIDEANSQR);
            jumpParam.UseRecursive = cbUseRecursive.Checked;
            
        }
예제 #21
0
 public BaseGrid(BaseGrid b)
 {
     m_gridRect = new GridRect(b.m_gridRect);
     width = b.width;
     height = b.height;
 }