























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Geometry and Line Generation Line Drawing
Typology: Study notes
1 / 31
This page cannot be seen from the preview
Don't miss anything!
























Point plotting is done by converting a single coordinate position furnished by an application program into appropriate operations for the output device in use. Line drawing is done by calculating intermediate positions along the line path between two specified endpoint positions. The output device is then directed to fill in those positions between the end points with some color. Screen locations are referenced with integer values, so plotted positions may only approximate actual line positions between two specified endpoints.
We can define a straight line with the help of the following equation.
y= mx + a Where, (x, y) = axis of the line. m = Slope of the line. a = Interception point .
Bresenham's circle drawing algorithm For whole 360 degree the circle will be divided in 8-parts each octant of 45 degree. In order to that Bresenham’s Circle Algorithm is used for calculation of the locations of the pixels in the first octant of 45 degrees. It assumes that the circle is centered on the origin. To calculate for every pixel (x, y), we draw a pixel in each of the 8 octants of the circle.
If d > 0, then (x+1, y-1) is to be chosen as the next pixel as it will be closer to the arc. else (x+1, y) is to be chosen as next pixel. Cont... Now, we will see how to calculate the next pixel location from a previously known pixel location (x, y). In Bresenham’s algorithm at any point (x, y) we have two option either to choose the next pixel in the east i.e. (x+1, y) or in the south east i.e. (x+1, y-1). And this can be decided by using the decision parameter d as:
Set initial values of (xc, yc) and (x, y) Set decision parameter d to d = 3 – (2 * r). call drawCircle(int xc, int yc, int x, int y) function. Repeat steps 5 to 8 until x < = y Increment value of x. If d < 0, set d = d + (4*x) + 6 Else, set d = d + 4 * (x – y) + 10 and decrement y by 1. call drawCircle(int xc, int yc, int x, int y) function Now for each pixel, we will do the following operations:
Line Attributes Basic attributes of a straight line segment are its type, its dimension, and its color. In some graphics packages, lines can also be displayed using selected pen or brush option.
Implementation of line-width options depends on the capabilities of the output device. A heavy line on a video monitor could be displayed as adjacent parallel lines, while a pen plotter might require pen changes. The name itself suggests that it is defining color of line displayed on the screen. By default system produce line with current color but we can change this color. Line Width Line Color
In some graphics packages line is displayed with pen and brush selections. Options in this category include shape, size, and pattern. Some possible pen or brush are shown in below figure. Pen and Brush Options
These shapes can be stored in a pixel mask that identifies the array of pixel positions that are to be set along the line path. Lines generated with pen (or brush) shapes can be displayed in various widths by changing the size of the mask. Also, lines can be displayed with selected patterns by superimposing the pattern values onto the pen or brush mask.
The appearance of displayed characters is controlled by attributes such as font, size, color, and orientation. Attributes can be set for entire string or may be individually. In text we are having so many style and design like italic fonts, bold fonts etc. Character Attributes Text Attributes
Changing Position, shape, size, or orientation of an object on display is known as transformation. Basic transformation includes three transformations Translation, Rotation, and Scaling. These three transformations are known as basic transformation because with combination of these three transformations we can obtain any transformation. Transformation Basic Transformation