in reply to Re: Plotting A Line
in thread Plotting A Line
+-+-+-+-+-+-+-+-+-+ | | | | | | |*|*|*| +-+-+-+-+-+-+-+-+-+ | | | |*|*|*| | | | +-+-+-+-+-+-+-+-+-+ |*|*|*| | | | | | | +-+-+-+-+-+-+-+-+-+
Now, if all your pixels are either black or white, this isn't too bad. But the human eye is very good in seeing the non-smoothness, the "staircase" sticks out like a sore thumb.
But if you have a grayscale (or full colour) device available, there are much better techniques. One technique revolves around the observation a line needs thickness to be seen. So, if you want to draw a line from say (0, 0) to (8, 2), assume you have a rectangle of width 1 and length 2 * sqrt (17), running from (0, 0) to (8, 2). This will cover some of the pixels partially. If a pixel is covered for say, 61%, the pixel should get a gray value that's 61% of pure black.
Now, this still isn't perfect, but it's a step better. There are lots of line drawing algorithms, each of them finding a different balance between simplicity, speed, good results and avoidance of artifacts.
Abigail
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Plotting A Line
by boo_radley (Parson) on Oct 28, 2003 at 13:44 UTC |