Friday, July 3, 2015

Computer Graphics : "WAX" word


Now that's a word drawn using lines, using bresenham's algorithm. I passed the end points of the lines as parameters for drawing the lines.

And yes, you need to code for negative slope too, in bresenham's algorithm, where |m| < 1 and |m| > 1. As you see, the left most line in the drawing of the letter 'W' has negative slope with |m| > 1, so it requires a code which can draw lines with negative slope. And so do many other lines in the above drawing. So, find equations for negative slope too and try to code accordingly.

By the way, I haven't used standing lines, since my word didn't need it, but if you are using standing lines, like for the stem in the letter 'T' , then you have to be careful, you see, in standing lines, the slope is not defined as

m = (y2 - y1)/(x2 - x1)

And in standing lines, x2 - x1 = 0, so m is not defined. So code properly for this situation and then the other cases are |m| < 1 and |m| >= 1.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.