Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limit steps in Jump? #5

Open
lionel84 opened this issue Dec 4, 2019 · 2 comments
Open

limit steps in Jump? #5

lionel84 opened this issue Dec 4, 2019 · 2 comments

Comments

@lionel84
Copy link

lionel84 commented Dec 4, 2019

thank you very much. This is the best implementation I have seen.

When the scene has few obstacles (and cannot be reached directly), the execution efficiency will become worse.
I found that when I limit steps in Jump, performance will get better.
Can this be done?

@fgenesis
Copy link
Owner

fgenesis commented Dec 4, 2019

I found that when I limit steps in Jump, performance will get better.

Got some code to demonstrate? Because right now i don't quite understand what you did and some more detail would be helpful.
Also, if you have map data to share that exhibit this problem, please do. Having a test suite to characterize performance for different use cases would be great.

@lionel84
Copy link
Author

lionel84 commented Dec 5, 2019

`struct GRID
{
bool bCanWalk;
};

struct GRID_DATA
{
GRID_DATA(){
w = 320;
h = 320;
for(int i = 0; i< 320; i++){
for(int j = 0; j<320; j++){
_data[i][j].bCanWalk = true;
}
}
for(int i = 150; i< 200; i++){
for(int j = 150; j<200; j++){
_data[i][j].bCanWalk = false;
}
}
}
inline bool operator()(uint32_t x, uint32_t y) const
{
if(x<w && y<h){
return _data[x][y].bCanWalk;
}else{
return false;
}

}
GRID _data[320][320];
uint32_t w, h;

};

...
BOOL findPath(PV& path, Position start, Position end, uint32_t step, uint32_t nJumpStep = 0)
{
m_nJumpStep = nJumpStep;
...
}
...
Position Searcher::jumpD
{
...
while(true)
{
...
if(m_nJumpStep && steps > m_nJumpStep)
break;
}
...
}

int begin = 100;
int end = 250;
GRID_DATA grid_data;
JPS::PathVector path;
JPS::Searcher<GRID_DATA> search(grid_data);
search.findPath(path, JPS::Pos(begin, begin), JPS::Pos(end, end), 0, 8); //

this is my test code.`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants