Closed chrisduerr closed 3 years ago
@chrisduerr I’m feeling that a clean reimplementation might be the right way to go. If andrews going to be drawing decorations it might as well do it’s job of reducing dependencies given line drawing is pretty simplistic. I’ll look into the algorithms used and try to come up with a reimplementation of it soon.
https://github.com/Matthias-Fauconneau/combustion/blob/master/src/plot.rs#L3-L40 might be of interest as a starting point for a reimplementation. Originally ported (via C++) from the algorithm in Wikipedia's "Xiaolin Wu's line algorithm" (which it is not). It is really just pixel stepping in one coordinate while tracking the other (a.k.a "Digital differential analyzer" 😱). Feel free to use this without any restrictions.
I could have used andrew/line_drawing but it doesn't handle the ends coverage correctly which I need to plot very dense polylines without any stippling errors.
https://github.com/Matthias-Fauconneau/combustion/blob/master/src/plot.rs#L3-L40 might be of interest as a starting point for a reimplementation.
I'd recommend just looking at the wikipedia article tbh. That avoids potential licensing issues and it's really simple either way. In fact by the formatting of that link creates enough of an overhead that I wouldn't bother with trying to immitate that.
@chrisduerr https://github.com/Smithay/andrew/commit/312c78b8542dae5cff86e9a7f49c54cc066a2ce2 this should solve this problem. The re-implementation seems to be working well enough, thanks wikipedia! Might consider finally donating. Since nothing was changed api wise I've released it as 3.1 to keep dependencies down.
Thanks for handling this so quickly, much appreciated!
I've recently sent a PR to the
line_drawing
crate (https://github.com/expenses/line_drawing/pull/17) about a week ago, which has made it pretty clear that the maintenance of it is insufficient. Since that introduces a fair bit of risk both now and in the future, which already shows up as duplicate dependencies in Alacritty, I'd propose to replace its use with a reimplementation in andrew.Since these algorithms are so trivial, I think a cleanroom reimplementation shouldn't be a problem, if we want to circumvent having to include licensing notes. Of course the MIT license would allow us to just copy/paste the code into andrew and vendor it, but with how trivial this code is I feel like losing licensing control is likely not worth it. It should be possible to just completely remove line_drawing and all its dependencies, since there's no reason why we would need num_traits here as far as I can tell.
I'm curious how you're feeling about this @trimental, are you open to the idea of vendoring this code and would you prefer reimplemenation?