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

non-recursive simplifyPolyline #68

Open
kakila opened this issue Mar 16, 2019 · 5 comments
Open

non-recursive simplifyPolyline #68

kakila opened this issue Mar 16, 2019 · 5 comments

Comments

@kakila
Copy link
Contributor

kakila commented Mar 16, 2019

Hi,
The geometry package in GNU Octave had since long a simplifyPolyline function implementing non-recursive
Here is the code
https://sourceforge.net/p/octave/geometry/ci/release-3.0.0/tree/inst/polygons2d/simplifyPolyline.m

Now that geometry is trying to mirror matgeom we found out that matGeom now has its own implementation (but recursive).

Would you accept defining a upper level simplifyPolyline which accepts 'method' as an optional argument which allows the user to select recursive or non-recursive algorithm?
In this way we could have both implementations. This allows for long time checks of performance (time , memory) and borderline cases.
Otherwise one could just bechmark the two implementations (spoiler, non-recursive is faster) and decide for one.

The need to have the Octave implementation is not to get a penalty in runtime due to the implementation in matGeom, but let matGeom use the algorithm they like.

@dlegland
Copy link
Member

Hi,

yes, it would be good to have both implementation, and let the user choose the most appropriate one depending on the needs.

Adding a "method" optional argument is fine for me. Not sure about the possible values ("recursive" vs "non-recursive" ?).

By the way, it seems to me that (Ramer-)Douglas-Peucker algorihtm is recursive by defintion... So what do you mean by non recursive? The use of bounding indices instead of creating subpolylines?

Also it's good to have a faster version! I can integrate it into the matlab version to benefit from the improvement as well, and to ensure better compatibility between matlab-octave.

@kakila
Copy link
Contributor Author

kakila commented Mar 22, 2019

Hi,

Ok, I will work on it.
The (Ramer-)Douglas-Peucker algorihtm is recursive by definition, but it is quite easy to re-write it as non-recursive (that's should be what I did here). The class of recursive and non-recursive functions is equivalent.

@dlegland
Copy link
Member

Hi,
and thanks a lot for the links! I had a very quick look, and I agree it would be interesting to include the algorithm. I think I can work on this during this summer.

@kakila
Copy link
Contributor Author

kakila commented May 27, 2021

Let me know if I can offer support on the conversion, but be aware that I do not have access to matlab.

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