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

Grid matrix setup on browser pixels #183

Open
YaswanthAkula opened this issue May 5, 2020 · 4 comments
Open

Grid matrix setup on browser pixels #183

YaswanthAkula opened this issue May 5, 2020 · 4 comments

Comments

@YaswanthAkula
Copy link

Hi,
I am using this library to draw path on HTML canvas.

I am facing performance issue when I create grid matrix with pixel number.
Any idea how I can create grid matrix to overcome this performance hit?

@brean
Copy link

brean commented May 5, 2020

That's the limitation of the a* algorithm, its fast but if you throw a lot of nodes at it it can become slow. I suggest instead of using pixel you define areas or zones and feed that as nodes into the algorithm. For example something like this:
https://youtu.be/CattLrDZt3o?t=594 (start at 9:54)
you need a weighted pre-calculated graph for that, which this lib does not do but someone already implemented in a fork (see #151 )

@YaswanthAkula
Copy link
Author

@brean can u pls help me how to divide a 1000 x1000 pixels into zones/areas?

@brean
Copy link

brean commented May 6, 2020

@YaswanthAkula that highly depends on your scenario and what exactly you want to do. For a general solution you could do something like every 100th pixel and create 10x10 zones or you can create something based on an existing road network (like the guy in the youtube video i posted did).

@YaswanthAkula
Copy link
Author

YaswanthAkula commented May 6, 2020

Exactly there I got stuck @brean
Can you please help me with a piece of code how to create a zone each with 100 pixels and feed it as a node to grid.
I checked that video but I didn't get how he created those zones for the grid.

Kindly help me with this.

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