This code does not use any for loops and takes advantage of Matlabs internally optimized routines to produce a fast, optimized version of Bresenham's line drawing algorithm
Aaron Wetzler (2021). Bresenham optimized for Matlab (https://www.mathworks.com/matlabcentral/fileexchange/28190-bresenham-optimized-for-matlab), MATLAB Central File Exchange. Retrieved .
Inspired: Connect Pixels, Multi wall (COST231) Signal Propagation Models + Python Code, 3D Ray Tracing For Indoor Radio Propagation, Chord Length Distribution from Binary 2D Images
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
Readability is not so good! But I appreciate your work. Thanks.
Missing a couple of terminating ';', but I don't care _because it works_ .
Excellent, especially because he will work with negative values!
I believe cumsum(q) is equivalent to round(0:(dy/dx):dy), anyway, I posted some code at: stackoverflow.com/a/43726466/2093077 that uses same logic but is about 20% faster.
q=[0;diff(mod([floor(dx/2):-dy:-dy*dx+floor(dx/2)]',dx))>=0]
What does this equation mean?
Very efficient, and well made. Code comments messy, and lines not terminated with ;.
compact and elegant implementation