optimization - Optimising Bresenham by drawing many horizontal and vertical lines instead of pixels -
I have a set of very efficient horizontal and vertical line drawing functions, which for several pixels per cycle (for horizontal one , ~ 4 pixels / cycles, and vertical one ~ 0.25 pixels / cycles.) I'm bracing to attract arbitrary lines using line drawing algorithms. However, it involves calling the single draw pixel routine, which is relatively slow (~ 0.03 pixels / cycles.)
I noticed that the lines drawn by Bresenham's algorithms have a horizontal and vertical strips Are the best with the distance between them Does anyone know if it is possible to call these private calls to Drapixel for drawing and drawing drawing routing? Anyone have a code example? I have already tried, but I have limited success, mostly due to broken output - I suspect that I am delivering it wrongly.
Thank you very much
Bresenham algorithm normally forms four sets of special cases , Which is based on the signal and magnitude of the slope of the line (highly positive, excessive negative, shallow, positive, shallow negative.) In vertical cases, you can use the vertical line segments that are moved by a horizontal pixel. Pull a bunch; For shallow people, these are horizontal lines.
When you calculate the coordinates of the line, then you are one step ahead of fast (for steep cases, x for shallow people) and you calculate cumulative error. Other coordination; When you convert it to the next value for cumulative error 1. So what if you run a normal Bresenheim algorithm, then compiling all the pixels, but instead of painting each pixel, you draw the line for the given "sharp" coordinates from the beginning to the end of the "slow" coordination - If you know what I mean rather than drawing on each circle, in other words, you just drag when slow co-ordination changed, before you can Take a break in the neck.
Yes, I'm sure this will work, whether it's fast, I have no idea, but it will definitely work.
Comments
Post a Comment