



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
answer an questions with summary
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Graphics programming packages provide function to describe a scene in terms of these basic geometric structures, referred to as output primitives.
The point is a most basic graphical element & is completely defined by a pair of user coordinates (x , y). Define Circle?
Circle is defined by its center xc, yc and its radius in user coordinate units. The equation of the circle is (x-xc ) + (y-y (^) c ) = r^2.
An ellipse can use the same parameters xc, yc ,r as a circle, in addition to the Eccentricity e. the eqn of an ellipse is:
(x-xc)^2 /a^2 + (y-yc)^2 /b^2 = 1
Transformation is the process of introducing changes in the shape size and orientation of the object using scaling rotation reflection shearing & translation etc.
In the active transformation the points x and x F 0 7 C represent different coordinates of the same coordinate system. Here all the points are acted upon by the same transformation and hence the shape of the object is not distorted. In a passive transformation the points x and x F 0 7 C represent same points in the space but in a different coordinate system. Here the change in the coordinates is merely due to the change in the type of the user coordinate system.
Translation is the process of changing the position of an object in a straight-line path from one coordinate location to another. Every point (x , y) in the object must undergo a displacement to (x F 0 7 C ,y F 0 7 C ). The transformation is:
x F 0 7 C^ = x + tx ; y F 0 7 C = y+ty
What is rotation? A 2-D rotation is done by repositioning the coordinates along a circular path, in the x-y
plane by making an angle with the axes. The transformation is given by: X
F 0 7 C = r cos (θ +
φ) and Y
F 0 7 C = r sin (θ + φ).
The scaling transformations changes the shape of an object and can be carried out by multiplying each vertex (x,y) by scaling factor Sx,Sy where Sx is the scaling factor of x and Sy is the scaling factor of y.
The shearing transformation actually slants the object along the X direction or the Y direction as required.ie; this transformation slants the shape of an object along a required plane.
The reflection is actually the transformation that produces a mirror image of an object. For this use some angles and lines of reflection.
The digital differential analyzer is a scan conversion algorithm based on calculation either y or x using the following equations
y = m x
x = y / m
Sample the line at unit intervals in one coordinate and determine corresponding integer
values nearest the line path for the coordinates
Sample at X intervals ( x = 1) and compute each successive Y value as Yk+
= Yk + m
P0 = 2 y – x
Step 4 : At each Xk along the line, starting at k = 0, perform the following test If Pk
< 0, the next point to plot is (Xk+1, Y (^) k) and Pk+1 = P (^) k+2 y Otherwise, the next point to plot is (Xk+1, Y (^) k+1) and
Pk+1 = P^ k+2^ y - 2^ x
Step 5: Repeat step 4 x times
Algorithm
Step 1:Input radius r and circle center(Xc, Yc)and obtain the first point on the circumference of a circle centered on the origin as (X0, Y0) = (0, r)
Step 2: Calculate the initial values of the decision parameter as
P0 = 5/4 – r
Step 3: At each position starting at k perform the following test:
If Pk < 0, the next point to plot is (Xk+1, Yk ) and P^ k+1 = P^ k+ Xk+1 + 1
Otherwise the next point is (Xk+1, Y (^) k+1) and P (^) k+1 = Pk +2 Xk+1 + 1- 2 Y (^) k-
Step 4: Determine symmetry points in the other seven octants
Step 5: Move each pixel position(X, Y) onto the circular path centred on (Xc, Yc) and plot the coordinate values as X = X + Xc Y = Y + Yc
Step 6: Repeat steps 3 through until X>=Y Pk + 1= Pk + 2 Y
Other wise, the next point is (Xk+1, Y^ k+1) and
Pk + 1= Pk + 2 Y - 2 X
Step 5: Repeat steps 4 X times
Algorithm?
Algorithm
Step 1:Input radius r (^) x , r (^) y and ellipse center(X (^) c , Yc )and obtain the first point on the circumference of a circle centered on the origin as
Step 3: At each position starting at Xk position in region 1,starting at k = 0, perform the following test:
If Pk < 0, the next point to plot is (Xk+1, Y^ k) and P1^ k+1 =
Otherwise the next point is (X (^) k+1, Y (^) k-1 ) and P1k+1 = P1k+2 r (^) y^2 X (^) k+
Step 5: At each position starting at Yk position in region 2,starting at k = 0, perform the following test: If Pk > 0, the next point to plot is (X^ k, Yk-1 ) and
Otherwise the next point is (Xk+1, Y (^) k-1) and
Step 4 : Starting with pixel position (xa, ya), determine the offset needed at each step to generate
the next pixel position along the line path. Step 5: loop the following process for steps number of times a. Use a unit of increment or decrement in the x and y direction
b. if xa is less than xb the values of increment in the x and y directions are 1 and m
c. if xa is greater than xb then the decrements -1 and – m are used.