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

EnumeratePixels and EnumerateRows should implement DoubleEndedIterator #2298

Open
Pauan opened this issue Jul 30, 2024 · 3 comments · May be fixed by #2312
Open

EnumeratePixels and EnumerateRows should implement DoubleEndedIterator #2298

Pauan opened this issue Jul 30, 2024 · 3 comments · May be fixed by #2312
Labels
kind: API missing or awkward public APIs

Comments

@Pauan
Copy link

Pauan commented Jul 30, 2024

The EnumeratePixels and EnumerateRows iterators should implement DoubleEndedIterator.

This will make it possible to iterate in reverse order (for example right-to-left instead of left-to-right).

The Pixels and Rows iterators already implement DoubleEndedIterator.

@Shnatsel
Copy link
Contributor

Could you provide an example where this would be actually useful? What do you need this functionality for?

@Pauan
Copy link
Author

Pauan commented Jul 30, 2024

I'm creating a custom CAM program for CNC machines. The program loads an image, and then iterates over the pixels of the image to generate the GCode.

But it needs to iterate in a specific order to generate optimal GCode. The default order (left-to-right, top-to-bottom) creates suboptimal GCode, which slows down the CNC machine by ~50%.

With DoubleEndedIterator it can iterate in the perfect order.

@Shnatsel
Copy link
Contributor

I see! Yes, an implementation of DoubleEndedIterator would be nice to have, and shouldn't be difficult. A PR for it would be welcome.

@Shnatsel Shnatsel added the kind: API missing or awkward public APIs label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: API missing or awkward public APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants