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

Typo in AddSteiner port #1

Open
Retera opened this issue Sep 14, 2023 · 2 comments
Open

Typo in AddSteiner port #1

Retera opened this issue Sep 14, 2023 · 2 comments

Comments

@Retera
Copy link

Retera commented Sep 14, 2023

Hi. I was investigating the possibility of porting your C# code here to Java, but after I tried typing in the 1:1 equivalent in Java of each line of code corresponding to what you had, and then porting the 2D visualizer from the original JavaScript repo that you had copied from, I noticed that there were no Steiner points in the resulting graph.

I am not well-versed in the understanding of how the L1 path finder actually works and am simply seeking to use it to potentially solve a problem. However, based on the absence of Steiner points in my 2D visualizer I tinkered with the code and became convinced that there is a typo in your solution versus the original JavaScript. I believe the typo to be on the following line in the AddSteiner function:

if (verts.ContainsKey(pair))

The original JavaScript, by comparison, was checking if (!thing.containsKey(...)) as opposed to if (thing.containsKey(...)) here:
https://github.com/mikolalysenko/l1-path-finder/blob/4aa05fd85eb58cf332ec416079948d9860b1eefc/lib/planner.js#L318

I have not submitted a pull request to your code to fix it directly because as I mentioned above I was using it for the purpose of creating a Java port. Feel free to fix it and not credit me at all if you are still using this code; I am simply noting this here for posterity and to improve the lives of those who have improved my own.

@Retera
Copy link
Author

Retera commented Sep 14, 2023

It appears there may be a second typo here:

if (v2 != null && !geom.StabBox(v.x, v.y, x, y))

https://github.com/mikolalysenko/l1-path-finder/blob/4aa05fd85eb58cf332ec416079948d9860b1eefc/lib/planner.js#L109

You (reasonably so) use the variable name "v2" instead of "v" to avoid variable name shadowing, however we then see a typo doing a StabBox call in "v.x" and "v.y" when this should have been "v2.x" and "v2.y".

@fr0
Copy link
Owner

fr0 commented Sep 15, 2023

Thanks for the report. I'm not currently doing much with this repository, but if I use it in the future, I'll look into 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