0% found this document useful (0 votes)
416 views10 pages

Unit I Output Primitives SUBJECT: Graphics and Multimedia Subject Code: CS1354 Year & Sem: III&VI Part A (2 Marks)

1) Output primitives are the basic building blocks used in graphics programming to describe a scene. They include functions for plotting pixels and lines. 2) The Digital Differential Analyzer (DDA) and Bresenham's line algorithms are commonly used to draw lines on a digital display. DDA uses incremental calculations while Bresenham's uses integer rounding to minimize errors. 3) Circle drawing algorithms like midpoint and ellipse drawing algorithms approximate curved shapes on a raster display. They use decision parameters and symmetry to iteratively calculate pixel positions along the curve.

Uploaded by

gayathiridevir
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
416 views10 pages

Unit I Output Primitives SUBJECT: Graphics and Multimedia Subject Code: CS1354 Year & Sem: III&VI Part A (2 Marks)

1) Output primitives are the basic building blocks used in graphics programming to describe a scene. They include functions for plotting pixels and lines. 2) The Digital Differential Analyzer (DDA) and Bresenham's line algorithms are commonly used to draw lines on a digital display. DDA uses incremental calculations while Bresenham's uses integer rounding to minimize errors. 3) Circle drawing algorithms like midpoint and ellipse drawing algorithms approximate curved shapes on a raster display. They use decision parameters and symmetry to iteratively calculate pixel positions along the curve.

Uploaded by

gayathiridevir
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 10

UNIT I

Output Primitives

SUBJECT: Graphics and Multimedia Subject code: CS1354


Year & Sem : III&VI

Part A (2 marks):

1. Define Output Primitives.


The Graphics programming Package Provides functions to describes a scene in terms
of these basic output primitives. The output specified with input coordinated data and
other information about the way that the object is to be displayed.

2. What are the methods used to plot a pixel and get the value in particular pixel
position.
To load a specified color into the buffer at a position corresponding to column x along
scan line y, we will assume we have available a low level procedure of the form
setPixel (x , y)
we able to retrieve the current frame buffer intensity setting for a specified location. We
accomplish this with the low level function.
getPixel (x , y)

3. Give the Cartesian Slope Intercept equation for line.


Y=mx+b
Where, m=slope of the line
B as the y intercept
And m=y2-y1/x2-x1

4. Define DDA.
The digital differential analyzer (DDA) is a scan conversion line algorithm based on
calculating either Δy = mΔx or Δx=Δy/m.

We sample the line at unit intervals in one coordinate and determine corresponding
integer values nearest the line path for the other coordinate.

05. Limitations of DDA.


a. The accumulation of round off error in successive addition of the floating point
increment , however can cause the calculated pixel position to drift away from the true
line path for long line segments.

b. Furthermore the rounding operation and floating point arithmetic in procedure line
DDA are still consuming.
06.Explain the Symmetry of Circle with neat diagram.

07. Give the various Circle coordinates points calculations in Mid point Circle
drawing algorithm when r = 15 and center is at origin.

Radius:15
If (Xk+1,yk) Then Pk<0
Pk+1=Pk+1+2Xk+1+1
If(Xk+1,Yk+1)then pk>0
Pk+1=Pk+1+2Xk+1+1+2yk+1
P0=5/4-r
=5/4 -15
=-13.8
=-14
08.What are the various Line attributes?

a. Line width
b. Line type
c. Line color
Line type :
setLineType(lt)
1. solid ________
2. dash ------------
3. dotted …………
4. dashed-dot .-.-.-.-.-.-.-.-
Line width:
SetLinewidth scale factor(lw)
Line color
Set polyLine color index(lc)

09.What are the Area Fill attribute?


Fill Style
Pattern fill
Soft fill
Fill style:
a. Hollow with color border
b. Filled with solid color
c. Filled with specified pattern
setInteriorStyle (fb)
fs=parallel line or crossed line
Pattern fill:
SetInteriorStyleIndex (p) where p-table position
SetPatternRepresentation (ws , pi , nx , ny ,cp)
Where, ws-work station ,pi-index, nx-row , ny-column , cp-pattern
Setpatternsize (dx,dy)
Setpatternreferncepoint (position)

10. What are the various Character attributes?

Test Attributes
 The choice of font, which is a set of characters with a particular design style such
as new York, courier, Helvetica, times new roman and various special symbols.

 The characters in a selected font can be displayed with assorted underlying styles
(solid, dotted, double) in bold face, in italics and in outline or shadow styles. It
can be done through a function

setTextFont (tf);
 Color settings for text are stored in the system attributes list and used by the
procedures. The text color in set by the following function,

setTextcolorIndex (tc);

11 .What are the Basic and other 2D transformations?


a. Translation
b. Rotation
c. Scaling
Other transformations are
 Reflection
 Shearing

12.Give 3X3 Composite Transformation Matrix for Translation and Scaling.


 Translation
The composite transformation matrix for the sequence of translation is
1 0 tx2 1 0 tx1 1 0 tx1+tx2
0 1 ty2 0 1 ty1 = 0 1 ty1+ty2
0 0 1 0 0 1 0 0 1

Or
T(tx2,ty2).T(tx1,ty1)=T(tx1+tx2,ty1+ty2)
Which demonstrate that two successive translation are additive
 Scaling
The composite matrix resulting from the product of these three
transformation is

Page number=214(5-35)
13.Explain general Pivot-Point Rotation with neat diagram.

To generate a rotation, we specify a rotation angle and the position P when the pivot point
in at the coordinate origin. In figure r in the constant distance of the point from the origin,
angle φ in the original angular position of the point from the horizontal and θ in the
rotation angle. Using standard trigonometric identifies, we can express the transformed
coordinates in terms of angles θ and φ as

Figure 1.7
14.Explain general Fixed-Point Scaling with neat diagram.

We can control the location of a scaled object by choosing a position, called the fixed
point.that is to remain unchanged after the scaling transformation. Co-ordinate for the
fixed point(Xf,Yf) can be chosen as one of the vertices,the object centroid, or any other
position.
15. What are the various Reflections possible and explain it diagrammatically.
I.reflection of an object about the X axis

II.reflection of an object about Y axis

16.What are the various Shearing possible and explain it diagrammatically.

d. I X shearing with respect to X axis


e. II Y shearing with respect to Y axis

I X shearing with respect to X axis

II Y shearing with respect to Y axis


17.Define window and Viewport.

A world coordinate area selected for display is called a window.


An window defines what is to displayed
An area on the display device to which a window is mapped is called a viewport.
An view port defines where is to be displayed

18.Explain Two-Dimensional viewing Pipeline with a neat diagram.

Two Dimensional Viewing the Viewing Pipeline


 A world coordinate area selected for display is called a window.

 An area on a display device to which a window is mapped is called a viewport.

 The window defines what is to be viewed; the viewport defines where it is to be


displayed.

 The mapping of a part of a world-coordinate scene to device coordinates is


reffered to as a viewing transformation. The figure 1.11 shows the mapping of a
picture that falls within a rectangular window onto a designated rectangular
viewport.
19.Define Clipping and clip window.
Any procedure that identifies those portions of a picture that are either inside or outside of
a specified region of space is referred to as a clipping algorithm or clipping. The region
against which an object is to clipped is called as a clip window.

20.Explain how point is clipped.

Assuming that the clip window is a rectangle in standard position, we save a point p= (x,
y) for display if the following inequalities are satisfied.

Where the edges of the clip window (xw min, xwmax, ywmin, ywmax) Cn be either the
world-coordinate window boundaries or viewpoint boundaries. If any of these four
inequalities is not satisfied; the point is clipped.

16 MARKS

01. Explain DDA Line Drawing Algorithm.

I line drawing algorithm


II DDA algorithm

02. Explain Bresenham’s Line Drawing Algorithm.

I Line drawing algorithm


II bresenham line algorithm
IIIBresenhams line algorithmfor |m|<1

03. Explain Midpoint Circle Drawing Algorithm.


Midpoint circle algorithm
Midpoint circle algorithm in steps

04. Explain Midpoint Ellipse Drawing Algorithm.

Midpoint ellipse algorithm

Midpoint Ellipse Algorithm in steps

Step 1: Input rx , ry and ellipse center (xc, yc) and obtain the first point on an ellipse
centered on the origin as,
(x0, y0) = (0, ry)
Step 2: Calculate the initial value of the decision parameter inregion 1 as,
P0 = r2- r2xry+ ¼ r2x
Step 3: At each xk position in region 1, starting at k=0, perform the following text:
If pk<0, the next point along the ellipse centered on (0, 0) is (xk+1, yk) and
Pk+1= pk + 2r2yxk+1+r2y
Otherwise, the next point along the circle is (xk+1, yk-1) and
Pk+1 = pk + 2r2yxk+1- 2r2xyk+1+ r2y
With,
2r2yxk+1 = 2r2xyk - 2r2y
2 2
2r2xyk+1 = 2r xyk - 2r x
And continue until 2r2yx > 2r2xy.
Step 4: Calculate the initial value of the decision parameter in region 2 using the last point
(x0, y0) calculate in region 1 as,
p20 = r2y ( x0 + ½ )2 + r2x ( y0 -1)2 – r2xr2y
Step 5: At each yk position in region 2, starting at k=0, perform the following list:
If p2k>0, the next point along the ellipse centered on (0, 0) is (xk, yk-1) and
P2k+1 = p2k – 2r2xyk+1+r2x
Otherwise, the point along the circle is (xk+1, yk-1) and
P2k+1 = p2k+ 2r2yxk+1- 2r2xyk+1 + r2x
Using the same incremental calculations for x and y as in region 1.
Step 6: Determine symmetry points in the other three quadrants.
Step 7: Move each calculated pixel position (x, y) onto the elliptical path centered on (xc,
yc) and plot the coordinate values:
x = x+ xc, y = y + yc
Step 8: Repeat the steps for region 1 until
2r2yx > 2r2xy

5. Explain Basic Transformations.


1.6.1 Basic Transformations
Two aspects of the formulation of transformations,
 A transformation is a single mathematical entity and such can be denoted by a
single name or symbol;

 Two transformations can be combined, or concatenated, to yield a single


transformation with the same effect as the sequential application of the original
two.

 Translation

 Rotation

 Scaling

Other Transformations
 Reflection

 Shearing
06. Detail about Reflection and shearing.

REFLECTION
 Define reflection
 Explain various types of relection with diagrams

SHAERING
 Define Shaering
 Explain various types of shearing with diagrams

07.Give various attributes of Line, Curve and Character Attributes.

Line Attributes
Line Type
Line width
Line Color
Character Attributes
Test Attributes
Marker attributes
Curve attributes

08.Explain the 2D Viewing Transformation.

Explain window to view port transformation


Explain with diagram

09.Define Clipping and explain any one line-clipping algorithm.


Any procedure that identifies those portions of a picture that are either inside or outside of
a specified region of space is referred to as a clipping algorithm or clipping. The region
against which an object is to clipped is called as a clip window.
Types of clipping
 Point Clipping

 Line Clipping

 Area Clipping

 Curve Clipping

 Text Clipping

LINE CLIPPINGS (explain any one of the line clipping)

 Cohen-sutherland line clipping


 Liang – barsky line clipping
 Nicholl-lee-nicholl line clipping
 Line clipping using Non-rectangular clip windows

You might also like