IT-602 - ITM Universe

advertisement
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
EXPERIMENT NO.1
Pixel Drawing
Date of conduction:- 23/01/2014
Date of submission:- 23/01/2014
Submitted by other members:- All the Students.
Group no:- NA
Signature
Name of faculty incharge: Mr. Praveen Mudgal
Name of Technical Assistant: Mr. Deepak Sharma
Page 1 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Experiment no:
Name of experiment:
Objective: - Write a program to draw a pixel.
Appratus:- Computer system / Turbo C++ IDE (TurboC3)
Theory: -
In digital imaging, a pixel, pel or picture element is a physical point in a
raster image, or the smallest addressable element in an all points addressable display
device; so it is the smallest controllable element of a picture represented on the screen.
The address of a pixel corresponds to its physical coordinates. LCD pixels are
manufactured in a two-dimensional grid, and are often represented using dots or
squares, but CRT pixels correspond to their timing mechanisms and sweep rates.
Each pixel is a sample of an original image; more samples typically provide more
accurate representations of the original. The intensity of each pixel is variable. In color
image systems, a color is typically represented by three or four component intensities
such as red, green, and blue, or cyan, magenta, yellow, and black.
Procedure: #include<conio.h>
#include<iostream.h>
#include<graphics.h>
void main()
{
clrscr();
int gdriver=DETECT,gmode,X,Y;
int x,y;
initgraph(&gdriver,&gmode,"C:\\tc\\bgi");
cout<<"enter the value of x and y";
cin>>x>>y;
putpixel(x,y,4);
getch();
}
Observation Table:- NA
Page 2 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Calculation:- NA
Results: -
.
Conclusion:- NA
Precautions:- NA
Suggestions:-
NA
Lab Quiz :1. Video games represent the first major use in the home of ___________.
A. computer programs.
B. computer graphics.
C. computer components.
D. computer metrics.
Page 3 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
2. In _________ computer graphics, the observer has no control over the
image.
A. interactive
B. non interactive.
C. visible.
D. invisible.
3. The non-interactive computer graphics are also known as _______.
A. active.
B. interactive
C. passive
D. video games
4. _________ computer graphics involves two-way communication
between computer and user.
A. active
B. interactive
C. passive
D. video games
5. Video game is an example of _________ computer graphics
A. interactive
B. non interactive.
C. visible
D. invisible
6. In ________ the first computer-driven display attached to MIT Whirlwind
I computer was used to generate simple pictures.
A. 1942.
B. 1945.
C. 1948.
D. 1950.
7. The display which introduced on 1950 uses ________ which is similar to
the one used in television sets.
A. Cathode Ray Tube.
B. Computer Related Tube.
C. Component Related Tools.
D. Common Reflection Tube.
8. The single event that did most to promote interactive computer graphics
was happened by the publication in the year _____.
A. 1960.
Page 4 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
B. 1962.
C. 1964.
D. 1966.
9. Modern graphics display consists of ________ components.
A. 1.
B. 2.
C. 3.
D. 4.
10. In …….the displayed image is stored as a matrix of intensity values for
modern graphics display.
A. clustered frame.
B. clustered memory.
C. frame buffer.
D. frame section.
Further reading resources:
Book: Lab experiment related theory available in following books:
Book No
Book Name
1.
Let Us C
2.
3.
4.
5.
Web resources:
Author
Yashwant kanetkar
1. www.w3professors.com
2. www.cglabprograms.com
3. www.graphics.cornell.edu
4. www.mycplus.com
5. www.computergraphicsprojectsusingc.com
Page 5 of 66
Page No.
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
EXPERIMENT NO.2
Line Function
Date of conduction:- 30/01/2014
Date of submission:- 30/01/2014
Submitted by other members:- All the Students.
Group no:- NA
Signature
Name of faculty in charge: Mr. PRAVEEN MUDGAL
Name of Technical Assistant: Mr. Deepak Sharma
Page 6 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Objective: - Write a program to draw a line using line using
function?
Appratus:- Computer system / Turbo C++ IDE (TurboC3)
Theory: - Line function is used to draw a line from a point(x1,y1) to
point(x2,y2) i.e. (x1,y1) and (x2,y2) are end points of the line.The code
given below draws a line.
Declaration :- void line(int x1, int y1, int x2, int y2);
A line drawing algorithm is a graphical algorithm for approximating a line
segment on discrete graphical media. On discrete media, such as pixelbased displays and printers, line drawing requires such an approximation
(in nontrivial cases).
On continuous media, by contrast, no algorithm is necessary to draw a line.
For example, oscilloscopes use natural phenomena to draw lines and
curves.
The Cartesian slope-intercept equation for a straight line is Y= mx+b With
m representing the slope of the line and b as the y intercept. Given that the
two endpoints of the line segment are specified at positions (x1,y1) and
(x2,y2). we can determine values for the slope m and y intercept b with the
following calculations,
m=(y2-y1)/(x2-x1)
so, b=y1-m.x1
Procedure: #include<conio.h>
#include<iostream.h>
#include<graphics.h>
Page 7 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
void main()
{
clrscr();
int gdriver=DETECT,gmode,X,Y;
int x1,y1,x2,y2;
initgraph(&gdriver,&gmode,"C:\\tc\\bgi");
setcolor(3);
cout<<"enter the value of x and y";
cin>>x1>>y1>>x2>>y2;
line(x1,y1,x2,y2);
getch();
}
Observation Table:- NA
Calculation:- NA
Results: -
Page 8 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Conclusion:- NA
Precautions:- NA
Suggestions:- NA
Lab Quiz :1. A digital memory also called as _______.
A. clustered frame.
B. display controller.
C. frame buffer.
D. frame section.
2. A simple interface in a modern graphics display is ________.
A. clustered frame.
B. display controller.
C. frame buffer.
D. frame section.
3. _______ passes the contents of the frame buffer to the monitor.
A. clustered frame.
B. display controller.
C. frame buffer.
D. frame section.
4. The image must be passed repeatedly to the monitor, ________ or more
times a second, in order to maintain a steady picture on the screen.
A. 10.
B. 15.
C. 25.
D. 30.
5. The rectangular array of picture elements is called as _______.
A. cell.
B. image.
C. pixel.
D. array.
Page 9 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
6. For storing black and white images, black pixels represent as __ in the
frame buffer.
A. 0.
B. 1.
C. 2.
D. 3.
7. For storing black and white images, white pixels represent as __ in the
frame buffer.
A. 0.
B. 1.
C. 2.
D. 3.
8. To store 16X16 array of black and white pixels, the binary representation
values stored in the ____ 8-bit byes.
A. 24.
B. 28.
C. 30.
D. 32.
9. The problem of quantization effects in the picture is solved by ________
display.
A. picture.
B. image.
C. line drawing.
D. circle drawing.
10. ______ plots continuous line and curves rather than separate pixels.
A. picture.
B. image.
C. line drawing.
D. circle drawing.
Further reading resources:
Book: Lab experiment related theory available in following books:
Book No
1.
2.
Book Name
Let Us C
Author
Yashwant kanetkar
Page 10 of 66
Page No.
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
3.
4.
5.
Web resources:
1. www.w3professors.com
2. www.cglabprograms.com
3. www.graphics.cornell.edu
4. www.mycplus.com
5. www.computergraphicsprojectsusingc.com
Page 11 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
EXPERIMENT NO.3
Line DDA Algorithm
Date of conduction:- 04/01/2014
Date of submission:- 04/01/2014
Submitted by other members:- All the Students.
Group no:- NA
Signature
Name of faculty incharge: Mr. PRAVEEN MUDGAL
Name of Technical Assistant: Mr. Deepak Sharma
Page 12 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Objective: - Write a program to draw a Line using DDA algorithm.
Appratus:- Computer system / Turbo C++ IDE (TurboC3)
Theory: In computer graphics, a hardware or software implementation of a digital differential
analyzer (DDA) is used for linear interpolation of variables over an interval between start
and end point. DDAs are used for rasterization of lines, triangles and polygons. In its
simplest implementation the DDA algorithm interpolates values in interval [(xstart, ystart),
(xend, yend)] by computing for each xi the equations xi = xi−1+1/m, yi = yi−1 + m, where Δx
= xend − xstart and Δy = yend − ystart and m = Δy/Δx
The DDA starts by calculating the smaller of dy or dx for a unit increment of the other. A
line is then sampled at unit intervals in one coordinate and corresponding integer values
nearest the line path are determined for the other coordinate.
Considering a line with positive slope, if the slope is less than or equal to 1, we sample
at unit x intervals (dx=1) and compute successive y values as
y_{k+1} = y_k + m
Subscript k takes integer values starting from 0, for the 1st point and increases by 1
until endpoint is reached. y value is rounded off to nearest integer to correspond to a
screen pixel.
For lines with slope greater than 1, we reverse the role of x and y i.e. we sample at dy=1
and calculate consecutive x values as
x_{k+1} = x_k + \frac{1}{m}
Similar calculations are carried out to determine pixel positions along a line with
negative slope. Thus, if the absolute value of the slope is less than 1, we set dx=1 if
x_{start}<x_{end} i.e. the starting extreme point is at the left.
Procedure: # include<conio.h>
# include<stdio.h>
# include<graphics.h>
Page 13 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
# include<math.h>
void main()
{clrscr();
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
int xa,ya,xb,yb;
printf("enter the values of coordinate");
scanf("%d%d%d%d",&xa,&ya,&xb,&yb);
int dx=xb-xa,dy=yb-ya,steps;
float xinc,yinc,x=xa,y=ya;
if (abs(dx)>abs(dy))
steps=abs(dx);
else
steps=abs(dy);
xinc=dx/(float)steps ;
yinc=dy/(float)steps;
putpixel(x,y,-1);
for(int k=0;k<=steps;k++)
{ x=x+xinc;
y=y+yinc;
putpixel(x,y,4);
}
getch();
}
Observation Table:- NA
Calculation:- NA
Results: -
Page 14 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Conclusion:- NA
Precautions:- NA
Suggestions:- NA
Lab Quiz :1. The operation of most video monitors is based on the standard
_________.
A. Cathode Ray Tube.
B. Computer Related Tube.
C. Component Related Tools.
D. Common Reflection Tube.
2. Expansion of CRT is ___________.
A. Cathode Ray Tube
B. Computer Related Tube.
C. Component Related Tools.
D. Common Reflection Tube.
Page 15 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
3. The operations of most _________________ is based on the Standard
Cathode ray tubes.
A. scanners.
B. video monitors.
C. printers.
D. card readers.
4. The type of display to keep the phosphor glowing by redrawing the
picture repeatedly is called ________.
A. video CRT.
B. refresh CRT.
C. refresh buffer.
D. common CRT.
5. A beam of electrons emitted by an electron gun is also called as
______________.
A. electric rays.
B. magnetic rays.
C. cathode rays.
D. infra-red rays.
6. The primary component of an electron gun in a CRT is the heated metal
cathode and a ________.
A. electric grid.
B. control grid.
C. cathode grid.
D. common grid.
7. _______ is inside the cylindrical cathode structure for supplying heat to
the cathode.
A. field.
B. filament.
C. electrons.
D. pixel.
8. The maximum number of points that can be displayed without overlap on
a CRT is referred as _______.
A. persistence.
B. filament.
C. resolution.
D. collision.
Page 16 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
9. The emission of light sustained in phosphor after the CRT beam is
removed is called _______.
A. persistence
B. filament
C. resolution
D. collision
10. High resolution systems are often referred as ______ system.
A. horizontal retrace.
B. high definition.
C. high persistence.
D. high filament.
Further reading resources:
Book: Lab experiment related theory available in following books:
Book No
Book Name
1.
Let Us C
2.
3.
4.
5.
Web resources:
Author
Yashwant kanetkar
1. www.w3professors.com
2. www.cglabprograms.com
3. www.graphics.cornell.edu
4. www.mycplus.com
5. www.computergraphicsprojectsusingc.com
Page 17 of 66
Page No.
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
EXPERIMENT NO.4
Bresenhem’s Line drawing Algorithm
Date of conduction:- 06/02/2014
Date of submission:- 06/02/2014
Submitted by other members:- All the Students.
Group no:- NA
Signature
Name of faculty incharge: Mr. PRAVEEN MUDGAL
Name of Technical Assistant: Mr. Deepak Sharma
Page 18 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Objective: - Write a program to draw a line using bresenham’s
algorithm.
Appratus:- Computer system / Turbo C++ IDE (TurboC3)
Theory: - The Bresenham line algorithm is an algorithm which
determines which points in an n-dimensional raster should be
plotted in order to form a close approximation to a straight line
between two given points. It is commonly used to draw lines on a
computer screen, as it uses only integer addition, subtraction and
bit shifting, all of which are very cheap operations in standard
computer architectures. It is one of the earliest algorithms
developed in the field of computer graphics. A minor extension to
the original algorithm also deals with drawing circles.
plotLine(x0,y0, x1,y1)
dx=x1-x0
dy=y1-y0
D = 2*dy - dx
plot(x0,y0)
y=y0
for x from x0+1 to x1
if D > 0
y = y+1
plot(x,y)
D = D + (2*dy-2*dx)
else
plot(x,y)
D = D + (2*dy)
Page 19 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Procedure: # include <stdio.h>
# include <conio.h>
# include <graphics.h>
void main()
{
int dx,dy,x,y,p,x1,y1,x2,y2;
int gd,gm;
clrscr();
printf("\n\n\tEnter the co-ordinates of first point : ");
scanf("%d %d",&x1,&y1);
printf("\n\n\tEnter the co-ordinates of second point : ");
scanf("%d %d",&x2,&y2);
dx = (x2 - x1);
dy = (y2 - y1);
p = 2 * (dy) - (dx);
x = x1;
y = y1;
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"c:\\tc\\bgi");
putpixel(x,y,WHITE);
while(x <= x2)
{
if(p < 0)
{
x=x+1;
y=y;
p = p + 2 * (dy);
}
else
{
Page 20 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
x=x+1;
y=y+1;
p = p + 2 * (dy - dx);
}
putpixel(x,y,WHITE);
}
getch();
closegraph();
}
Observation Table:- NA
Calculation:- NA
Results: -
Conclusion:- NA
Precautions:- NA
Page 21 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Suggestions:- NA
Lab Quiz :1. _____ gives the ratio of vertical points to horizontal points necessary to
produce equal-length lines in both directions on the screen.
A. persistence.
B. resolution.
C. aspect ratio.
D. calligraphic ratio.
2. The refresh buffer also called a _______________ buffer.
A. frame.
B. element.
C. resolution.
D. bitmap.
3. _______ display is based on television technology.
A. raster-scan.
B. random-scan.
C. CRT.
D. electron.
4. In ______, the stored intensity values are retrieved from the refresh
buffer and painted on the screen one row at a time.
A. raster-scan.
B. random-scan.
C. CRT.
D. electron.
5. On a black and white system with one bit per pixel, the frame buffer is
commonly called as ______________.
A. pixmap.
B. pelmap
C. bitsmap
D. bitmap
6. For systems with multiple bits per pixel, the frame buffer is commonly
called as ______________.
A. pixmap.
Page 22 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
B. pelmap.
C. bitsmap.
D. bitmap.
7. After refreshing each scan line in raster scan displays is called
__________.
A. vertical retrace.
B. horizontal retrace.
C. interlace.
D. buffer line.
8. The raster-scan a system, each frame is displayed in two passes using
an____________ procedure.
A. interlaced refresh.
B. refresh.
C. providing.
D. vector displays.
9. Stroke-writing also called as _________.
A. calligraphic displays.
B. random displays.
C. raster displays.
D. bitmap displays.
10. Random scan monitors draw a picture one line at a time is called
_________ display.
A. shape.
B. vector.
C. scalar.
D. proportions.
Further reading resources:
Book: Lab experiment related theory available in following books:
Book No
1.
2.
3.
Book Name
Let Us C
Author
Yashwant kanetkar
Page 23 of 66
Page No.
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
4.
5.
Web resources:
1. www.w3professors.com
2. www.cglabprograms.com
3. www.graphics.cornell.edu
4. www.mycplus.com
5. www.computergraphicsprojectsusingc.com
Page 24 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
EXPERIMENT NO.5
Bresenhem’s Circle Algorithm
Date of conduction:- 13/02/2014
Date of submission:- 13/02/2014
Submitted by other members:- All the Students.
Group no: - NA
Signature
Name of faculty incharge: Mr. PRAVEEN MUDGAL
Name of Technical Assistant: Mr. Deepak Sharma
Page 25 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Objective: -Write a program for bresenham’s circle drawing
algorithm.
Appratus:- Computer system / Turbo C++ IDE (TurboC3)
Theory: Jack E. Bresenham invented this algorithm in 1962. The objective
was to optimize the graphic algorithms for basic objects, in a time
when computers were not as powerful as they are today.
This algorithm is called incremental, because the position of the
next pixel is calculated on the basis of the last plotted one,
instead of just calculating the pixels from a global formula. Such
logic is faster for computers to work on and allows plotting circles
without trigonometry. The algorithm use only integers, and that's
where the strength is: floating point calculations slow down the
processors.
All in all, incremental algorithms are 30% faster than the classical
ones,
based
on
floating
points
and
trigonometry.
Concept
Circles have the property of being highly symmetrical, which is
handy when it comes to drawing them on a display screen.We
know that there are 360 degrees in a circle. First we see that a
circle is symmetrical about the x axis, so only the first 180
degrees need to be calculated. Next, we see that it's also
symmetrical about the y axis, so now we only need to calculate
the first 90 degrees. Finally, we see that the circle is also
symmetrical about the 45 degree diagonal axis, so we only need
to calculate the first 45 degrees.
Page 26 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Bresenham's circle algorithm calculates the locations of the pixels
in the first 45 degrees. It assumes that the circle is centered on
the
origin
shifting
the
original
center
coordinates
(centerx,centery). So for every pixel (x,y) it calculates, we draw a
pixel in each of the 8 octants of the circle :
putpixel(centerx + x, center y + y)
putpixel(centerx + x, center y - y)
putpixel(centerx - x, center y + y)
putpixel(centerx - x, center y - y)
putpixel(centerx + y, center y + x)
putpixel(centerx + y, center y - x)
putpixel(centerx - y, center y + x)
putpixel(centerx - y, center y - x)
Now, consider a very small continuous arc of the circle interpolated below,
passing by the discrete pixels as shown.
As can be easily intercepted, the continuous arc of the circle can not be
plotted on a raster display device, but has to be approximated by choosing
the pixels to be highlighted. At any point (x,y), we have two choices – to
choose the pixel on east of it, i.e. N(x+1,y) or the south-east pixel S(x+1,y1). To choose the pixel, we determine the errors involved with both N & S
which are f(N) and f(S) respectively and whichever gives the lesser error,
we choose that pixel.
Let di = f(N) + f(S), where d can be called as "decision parameter", so that
Page 27 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
if di<=0,
then, N(x+1,y) is to be chosen as next pixel i.e. xi+1 = xi+1 and yi+1 = yi,
and if di>0,
then, S(x+1,y-1) is to be chosen as next pixel i.e. xi+1 = xi+1 and yi+1 = yi1.
Derivation
We know that for a circle,
x2 + y2 = r2, where r represents the radius of the circle, an input to the
algorithm.
Errors can be represented as
f(N) = (xi + 1)2 + yi2 - r2,
-(1)
f(S) = (xi + 1)2 + (yi - 1)2 - r2
-(2)
As di = f(N) + f(S),
_di = 2(xi+1)2 + yi2 + (yi-1)2 – 2r2
-(3)
Calculating next decision parameter,
_di+1 = 2(xi+2)2 + yi+12 + (yi+1-1)2 – 2r2 -(4)
from (4)- (3), we get,
di+1 – di = 2((xi+2)2-(xi+1)2) + (yi+12 – yi2) + ((yi+1-1)2 + (yi-1)2)
_di+1 = di + 2((xi+2+xi+1)(xi+2-xi-1)) + ((yi+1+yi)(yi+1-yi)) + ((yi+1-1+yi1)(yi+1-1-yi+1))
_di+1 = di + 2(2xi+3) + ((yi+1+yi)(yi+1-yi)) + ((yi+1-1+yi-1)(yi+1-1-yi+1))
Now, if (di<=0),
xi+1=xi+1 and yi+1=yi
so that di+1 = di + 2(2xi + 3) + ((yi+1+yi)( yi-yi)) + ((yi-1+yi-1)(yi-1-yi+1))
_
di+1 = di + 2(2xi + 3) +
((yi+1+yi)(0)) + ((yi-1+yi-1)(0))
_
di+1 = di + 4xi + 6
else
di+1 = di + 2(2xi+3) + ((yi-1+yi)(yi-1-yi)) + ((yi-2+yi-1)(yi-2-yi+1))
_ di+1 = di + 4xi+6 + ((2yi-1)(-1)) + ((2yi-3)(-1))
Page 28 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
_ di+1 = di + 4xi+6 - 2yi - 2yi + 1 + 3
_ di+1 = di + 4(xi - yi) + 10
To know di+1, we have to know di first. The initial value of di
can be obtained by replacing x=0 and y=r in (3). Thus, we get,
do = 2 + r2 + (r - 1)2 -2r2
_do = 2 + r2 + r2 + 1 -2r – 2r2
_ do = 3 – 2r
Bresenham Circle ( Xc, Yc, R):
Description: Here Xc and Yc denote the x – coordinate and y –
coordinate of the center of the
circle. R is the radius.
1. Set X = 0 and Y = R
2. Set D = 3 – 2R
3. Repeat While (X < Y)
4. Call Draw Circle(Xc, Yc, X, Y)
5. Set X = X + 1
6. If (D < 0) Then
7. D = D + 4X + 6
8. Else
9. Set Y = Y – 1
10. D = D + 4(X – Y) + 10
[End of If]
11. Call Draw Circle(Xc, Yc, X, Y)
[End of While]
12. Exit
Draw Circle (Xc, Yc, X, Y):
1. Call PutPixel(Xc + X, Yc, + Y)
2. Call PutPixel(Xc - X, Yc, + Y)
3. Call PutPixel(Xc + X, Yc, - Y)
4. Call PutPixel(Xc - X, Yc, - Y)
5. Call PutPixel(Xc + Y, Yc, + X)
6. Call PutPixel(Xc - Y, Yc, + X)
Page 29 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
7. Call PutPixel(Xc + Y, Yc, - X)
8. Call PutPixel(Xc - Y, Yc, - X)
9. Exit
Procedure: #include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
clrscr();
int h,k,r,x,y;
cout<<"enter the coordinates of circle";
cin>>h>>k;
cout<<"enter the radius";
cin>>r;
int p=3-(2*r);
x=0;
y=r;
while(x<y)
{
putpixel(x+h,y+k,10);
putpixel(-x+h,y+k,10);
putpixel(-x+h,-y+k,10);
putpixel(x+h,-y+k,10);
putpixel(y+k,x+h,10);
putpixel(-y+k,x+h,10);
putpixel(-y+k,-x+h,10);
putpixel(y+k,-x+h,10);
Page 30 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
}
if(p<0)
{
p=p+(4+x)+6;
x=x+1;
y=y;
}
else
{
p=p+(4*(x-y))+10;
x=x+1;
y=y-1;
}
getch();
}
Observation Table:- NA
Calculation:- NA
Results: -
Page 31 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Conclusion:- NA
Precautions:- NA
Suggestions:- NA
Lab Quiz :1. Picture definition stored as a set of line-drawing commands in an area of
memory for random scan called_________ file.
A. refresh display.
B. raster display.
C. random display.
D. scalar display.
2. Display list in random scan display is also called as ________.
A. refresh display.
B. raster display.
C. random display.
D. scalar display.
3. Random scan displays are designed to draw all component lines at of a
picture ______________ times each second.
Page 32 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
A. 20 to 40.
B. 30 to 60.
C. 40 to 70.
D. 20 to 50.
4. In beam penetration method, ________________ layers of phosphor are
usually used.
A. 1.
B. 2.
C. 3.
D. 4.
5. In beam penetration method, ________ and ___________ layers of
phosphor are usually used.
A. red and green.
B. blue and green.
C. yellow and green.
D. orange and green.
6. ______ in graphics systems are designed as RGB monitors.
A. Color CRT.
B. CMYK.
C. HSB.
D. YIK.
7. In flat panel display the emissive displays are devices that convert
electric energy into_____________.
A. obscurity
B. stimulating energy.
C. light energy.
D. non emitting energy.
8. In liquid crystal display the flat panel device is referred to as a
_____________LCD.
A. matrix.
B. passive.
C. active.
D. submissive.
9. Sterio scopic viewing is also a part in ________________.
A. virtual reality system.
B. essential system.
C. Actual reality system.
Page 33 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
D. Implicit system.
10. Shadow mask methods are commonly used in raster scan system
including _____.
A. monitor.
B. beam penetration method.
C. random scan system.
D. color tv.
Further reading resources:
Book: Lab experiment related theory available in following books:
Book No
Book Name
1.
Let Us C
2.
3.
4.
5.
Web resources:
Author
Yashwant kanetkar
1. www.w3professors.com
2. www.cglabprograms.com
3. www.graphics.cornell.edu
4. www.mycplus.com
5. www.computergraphicsprojectsusingc.com
Page 34 of 66
Page No.
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
EXPERIMENT NO.6
Mid Point Circle Algorithm.
Date of conduction:- 20/02/2014
Date of submission:- 20/02/2014
Submitted by other members:- All the Students.
Group no:- NA
Signature
Name of faculty incharge: Mr. PRAVEEN MUDGAL
Name of Technical Assistant: Mr. Deepak Sharma
Objective: - Write a program for midpoint circle algorithm.
Page 35 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Appratus:- Computer system / Turbo C++ IDE (TurboC3)
Theory: - In computer graphics, the midpoint circle algorithm is an
algorithm used to determine the points needed for drawing a circle.
A circle is defined as a set of points that are all at a given distance r from a
center positioned at. (xc,yc).
This is represented mathematically by the equation
Using equation (1) we can calculate the value of y for each given value of x
as
Thus one could calculate different pairs by giving step increments to x and
calculating the corresponding value of y. But this approach involves
considerable computation at each step and also the resulting circle has its
pixels sparsely plotted for areas with higher values of the slope of the
curve.
Midpoint Circle Algorithm uses an alternative approach, wherein the pixel
positions along the circle are determined on the basis of incremental
calculations of a decision parameter.
Let
Thus f(x,y)=0 represents the equation of a circle.
Further, we know from coordinate geometry, that for any point , the
following
holds:
Page 36 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
In Midpoint Circle Algorithm, the decision parameter at the kth step is the
circle function evaluated using the coordinates of the midpoint of the two
pixel centres which are the next possible pixel position to be plotted.
Let us assume that we are giving unit increments to x in the plotting
process and determining the y position using this algorithm. Assuming we
have
just
plotted
the
kth
pixel at ( Xk,Yk), we next need to determine whether the pixel at the position
( Xk+1,Yk ) or the one at ( Xk+1 , Yk-1) is closer to the circle.
Our decision parameter pk at the kth step is the circle function evaluated at
the midpoint of these two pixels.
The coordinates of the midpoint of these two pixels are ( Xk+1, Yk-1/2).
Thus pk
Successive
decision
parameters are obtained using incremental calculations, thus avoiding a lot
Page 37 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
of computation at each step. We obtain a recursive expression for the next
decision parameter i.e. at the k+1th step, in the following manner.
Using Equ. (4), at the k+1th step, we have:
Now if Pk <=0, then the midpoint of the two possible pixels lies within the
circle, thus north pixel is nearer to the theoretical circle. Hence, Yk+1= Yk .
Substituting this value of in Equ. (6), we have
If pk > 0 then the midpoint of the two possible pixels lies outside the circle,
thus south pixel is nearer to the theoretical circle. Hence, Yk+1= Yk-1.
Substituting this value of in Equ. (6), we have
For the boundary condition, we have x=0, y=r. Substituting these values in (4), we have
Page 38 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
For integer values of pixel coordinates, we can approximate P0=1-r,
Thus we have:
Drawing the circle:
We can reduce our calculation drastically (8th fraction ) by making use of the fact that a
circle has 8 way symmetry. Thus after calculating a pixel position (x,y) to be plotted, we
get 7 other points on the circle corresponding to it. These are:
(x,y); (x,-y); (-x,y); (-x,-y); (y,x); (y,-x); (-y,x); (-y,-x)
Procedure: #include<iostream.h>
#include<conio.h>
Page 39 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
#include<graphics.h>
void main()
{
clrscr();
int gdriver=DETECT,gmode,x=0,y,r,h,k,p;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
cout<<"enter the values of h and k";
cin>>h>>k;
cout<<"enter the radius";
cin>>r;
y=r;
p=(5/4-r);
while(x<y)
{
putpixel(x+h,y+k,10);
putpixel(-x+h,y+k,10);
putpixel(-x+h,-y+k,10);
putpixel(+x+h,-y+k,10);
putpixel(y+k,x+h,10);
putpixel(-y+k,x+h,10);
putpixel(-y+k,-x+h,10);
putpixel(+y+k,-x+h,10);
if(p<0)
{
p=p+(2*x)+1;
x=x++;
y=y;
}
else
{
p=p+(2*x)-(2*y)+1;
Page 40 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
x=x++;
y=y--;
}
}
getch();
}
Observation Table:- NA
Calculation:- NA
Results: -
Conclusion:- NA
Precautions:- NA
Suggestions:- NA
Page 41 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Lab Quiz :1. DVST stands for ________________.
A. Device View Storage Tube.
B. Direct View Space Tube.
C. Direct View Storage Tube.
D. Device View Space Tube.
2. The plasma is also called as ____________ displays.
A. image.
B. glass.
C. gas-discharge.
D. glass-discharge.
3. A shadow-mask CRT has______________ phosphor color dots at each
pixel position.
A. five.
B. four.
C. three.
D. two.
4. The______________ shadow-mask method is commonly used in color
CRT systems.
A. delta-delta.
B. beta-beta.
C. delta-beta.
D. alpha-alpha.
5. LED stands for_______________.
A. Light Emitted Display.
B. Light Emitting Display.
C. Light Emitting Diode.
D. Light Emit Diode.
6. The graphic programming package provides functions to describe a
scene in terms of basic geometric structures called as ________.
A. display structure.
B. picture display.
C. output primitives.
D. input primitives.
7. __________ plotting is accomplished by converting a single coordinate
position into appropriate operations for the output device in use.
Page 42 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
A. point.
B. line.
C. text.
D. polygon.
8. A ________ system stores point-plotting instructions in the display list.
A. raster-scan.
B. random-scan.
C. CRT.
D. electron.
9. _______ drawing is accomplished by calculating intermediate positions
along the line path between two specified end point positions.
A. point.
B. line.
C. text.
D. polygon.
10. Expansion of DDA is ________________.
A. Device Display Analyzer.
B. Digital Differential Analyzer.
C. Digital Device Analyzer.
D. Digital Display Analyzer.
Further reading resources:
Book: Lab experiment related theory available in following books:
Book No
Book Name
1.
Let Us C
2.
3.
4.
5.
Web resources:
Author
Yashwant kanetkar
1. www.w3professors.com
2. www.cglabprograms.com
Page 43 of 66
Page No.
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
3. www.graphics.cornell.edu
4. www.mycplus.com
5. www.computergraphicsprojectsusingc.com
EXPERIMENT NO.7
Page 44 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Translate A Triangle
Date of conduction:- 27/02/2014
Date of submission:- 27/02/2014
Submitted by other members:- All the Students.
Group no:- NA
Signature
Name of faculty incharge: Mr. PRAVEEN MUDGAL
Name of Technical Assistant: Mr. Deepak Sharma
Objective: - Write a program to translate a triangle.
Page 45 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Appratus:- Computer system / Turbo C++ IDE (TurboC3)
Theory: -
Procedure: #include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gdriver=DETECT,gmode,x1,y1,x2,y2,x3,y3,tx,ty;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
cout<<"enter the vertices\t"<<"enter the translation value";
cin>>x1>>y1>>x2>>y2>>x3>>y3;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
cin>>tx>>ty;
line(x1+tx,y1+ty,x2+tx,y2+ty);
line(x2+tx,y2+ty,x3+tx,y3+ty);
line(x3+tx,y3+ty,x1+tx,y1+ty);
getch();
}
Observation Table:- NA
Calculation:- NA
Results: -
Page 46 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Conclusion:- NA
Precautions:- NA
Suggestions:- NA
Lab Quiz :1. BSP Stands for________________.
A. Bit Space-Partitioning.
B. Binary Space- Partitioning.
C. Bit Space- positioning.
D. Binary Space- Positioning.
2. The simplest model for a light emitter is _______________.
A. light source.
B. open source.
C. data source.
D. point source.
Page 47 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
3. The __________ algorithm is a faster method for calculating pixel
positions than the direct use of the Cartesian slope intercept equation for a
straight line.
A. DDA.
B. DDM.
C. ADD.
D. DDAM.
4. _______________algorithm is broadly classified according to whether
they deal with object definitions directly or with their projected images.
A. Line clipping.
B. Midpoint algorithm
C. Visible surface detection.
D. Simple DDA.
5. ________________is applied in an object by pre positioning along a
straight line.
A. Translation.
B. Rotation.
C. Scaling.
D. Shearing.
6. A beam of very fast electrons penetrates through the red layer and
excites the inner_________ layer.
A. blue.
B. green.
C. white.
D. red.
7. VDU is a ________ device.
A. processing.
B. input.
C. peripheral.
D. hardware.
8. The operation of the most video monitors is based on the____________
CRT.
A. static.
B. dynamic.
C. standard.
D. pervasive.
9. In cathode ray tube, a beam of electrons is emitted ________________.
Page 48 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
A. from the base.
B. by a focusing system.
C. by an electron gun.
D. by deflection plates.
10. The negatively charged electrons inside the CRT are then accelerated
towards the__________.
A. phosphor coating.
B. electron gun.
C. Base.
D. Electron beam object.
Further reading resources:
Book: Lab experiment related theory available in following books:
Book No
Book Name
1.
Let Us C
2.
3.
4.
5.
Web resources:
Author
Yashwant kanetkar
1. www.w3professors.com
2. www.cglabprograms.com
3. www.graphics.cornell.edu
4. www.mycplus.com
5. www.computergraphicsprojectsusingc.com
Page 49 of 66
Page No.
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
EXPERIMENT NO.8
Scaling A Triangle
Date of conduction:- 13 /02/2014
Date of submission:- 13/02/2014
Submitted by other members:- All the Students.
Group no:- NA
Signature
Name of faculty incharge: Mr. PRAVEEN MUDGAL
Name of Technical Assistant: Mr. Deepak Sharma
Page 50 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Objective: - Write a program to scaling a triangle.
Appratus:- Computer system / Turbo C++ IDE (TurboC3)
Theory: Procedure: #include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gdriver=DETECT,gmode,x1,y1,x2,y2,x3,y3,a,b,c,d,e,f,sx,sy;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
cout<<"enter the vertices of triangle"<<"enter the value of sx and sy";
cin>>x1>>y1>>x2>>y2>>x3>>y3;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
cin>>sx>>sy;
a=x1*sx;
b=y1*sy;
c=x2*sx;
d=y2*sy;
e=x3*sx;
f=y3*sy;
line(a,b,c,d);
line(c,d,e,f);
line(e,f,a,b);
getch();
}
Observation Table:- NA
Calculation:- NA
Page 51 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Results: -
Conclusion:- NA
Precautions:- NA
Suggestions:- NA
Lab Quiz :1. The _______ field produced by each pair of coils results in transverse
deflection force.
A. transverse.
B. magnetic.
C. slopping.
D. repulsive.
Page 52 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
2. A major difference between phosphors is their _________________.
A. permanent state.
B. persistence.
C. feebleness.
D. magnetic deflection.
3. The diagonal screen dimension of a personal computer system is given
as the sizes varying from about
____inches or more.
A. 12 to 21.
B. 27 to 12.
C. 0 to 27.
D. 4 to 12.
4. Picture definition is stored in ___________ buffer area in memory.
A. frame.
B. outer.
C. refresh.
D. restore.
5. The rate at which the picture is redrawn on the screen is called
___________ rate.
A. buffer.
B. refresh.
C. drawn.
D. delete.
6. A system with 24 bites per pixel & a screen resolution of 1024 by 1024
requires_____ mega
byte of storage for frame buffer.
A. 9.
B. 7.
C. 3.
D. 2.
7. In a black and white system ________ per pixel is needed to control the
intensity of screen positions.
A. 0 bit.
B. 1 bit.
C. 2 bits.
D. 3 bits.
Page 53 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
8. In a high quality system ________________ bits per pixel is needed to
control the intensity of screen positions.
A. 8.
B. 12.
C. 16.
D. 24.
9. Refresh rate near to ___________ frames per second is an effective
technique for avoiding flicker.
A. 60.
B. 45.
C. 30.
D. 15.
10. Random scan monitors draw a picture ______________ at a time.
A. one pixel.
B. two pixel.
C. one line.
D. two line.
Further reading resources:
Book: Lab experiment related theory available in following books:
Book No
Book Name
1.
Let Us C
2.
3.
4.
5.
Web resources:
Author
Yashwant kanetkar
1. www.w3professors.com
2. www.cglabprograms.com
3. www.graphics.cornell.edu
4. www.mycplus.com
5. www.computergraphicsprojectsusingc.com
Page 54 of 66
Page No.
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
EXPERIMENT NO.9
Reflection of A Triangle
Date of conduction:- 20 /02/2014
Date of submission:- 20/02/2014
Submitted by other members:- All the Students.
Group no:- NA
Signature
Name of faculty incharge: Mr. PRAVEEN MUDGAL
Name of Technical Assistant: Mr. Deepak Sharma
Objective: - Write a program to show reflection of a triangle.
Page 55 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Appratus:- Computer system / Turbo C++ IDE (TurboC3)
Theory: • If the mirror passes through the origin, and is aligned with a
coordinate axis, then just negate appropriate coordinate
• For example, if a reflection plane has a normal n=(0,1,0) and passes
the origin, the reflected vertices can be obtained by scaling matrix
S(1,-1,1)
If the reflection plane passes a point p and has a normal
vector n, you translate and rotate the coordinate system,
negate, and move back to the original coordinate system
T (p) R(n) S (1,1,1) R(n) 1T (p)
Procedure: #include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void main()
{
clrscr();
int gdriver=DETECT,gmode,x1,y1,x2,y2,x3,y3;
char a;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
cout<<"enter the co-ordinate of triangle";//<<"enter the value of sx and sy";
cin>>x1>>y1>>x2>>y2>>x3>>y3;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
line(320,0,320,430);
line(0,240,640,240);
cout<<"enter the axis of reflection";
cin>>a;
Page 56 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
if(a=='x'||a=='x')
{
x1=x1;
x2=x2;
x3=x3;
y1=y1+240;
y2=y2+240;
y3=y3+240;
}
else
if(a=='y'||a=='y') {
y1=y1;
y1=y1;
y3=y3;
x1=x1+320;
x2=x2+320;
x3=x3+320;
}
cout<<"triangle after reflection";
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
getch();
}
Observation Table:- NA
Calculation:- NA
Results: -
Page 57 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Conclusion:- NA
Precautions:- NA
Suggestions:- NA
Lab Quiz :1. In raster scan system the ____________beam is swept across screen.
A. electron.
B. magnetic.
C. electro
D. electrothermal.
2. In raster scan system the electron beam is swept across screen from
_____________
A. right to left.
B. top to bottom.
C. bottom to top.
D. side to side.
Page 58 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
3. A CRT monitor displays color picture by using a combination of phosphor
that emits light of ___color.
A. same.
B. different.
C. many.
D. Only one.
4. Each screen point is referred to as a _______________.
A. point.
B. pixel
C. position.
D. element.
5. Refreshing on raster-scan displays is carried out at the rate of 60 to 80
________ per second.
A. points.
B. pixels.
C. positions.
D. frames.
6. The magnetic field produced by each pair of coils results in a
_______________.
A. transverse deflection force.
B. generic field.
C. electron beam.
D. horizontal deflection.
7. A property of video monitors is_________________.
A. length.
B. centimeter.
C. direction.
D. aspect ratio.
8. Intensity of the electron beam is controlled by setting voltage levels on
the________.A. control panel.
B. electron gun.
C. connector pins.
D. control grid.
9. The__________________ emits a small spot of light at each position
contacted by the electron beam.
A. electron gun.
B. control grid.
Page 59 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
C. phosphor.
D. cathode.
10. The three dimensions are extended from ________ methods by
including the z coordinates.
A. one dimension
B. two dimension.
C. four dimension.
D. none of the above.
Further reading resources:
Book: Lab experiment related theory available in following books:
Book No
Book Name
1.
Let Us C
2.
3.
4.
5.
Web resources:
Author
Yashwant kanetkar
1. www.w3professors.com
2. www.cglabprograms.com
3. www.graphics.cornell.edu
4. www.mycplus.com
5. www.computergraphicsprojectsusingc.com
Page 60 of 66
Page No.
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
EXPERIMENT NO.10
Rotate A Triangle
Date of conduction:- 27 /02/2014
Date of submission:- 27/02/2014
Submitted by other members:- All the Students.
Group no:- NA
Signature
Name of faculty incharge: Mr. PRAVEEN MUDGAL
Name of Technical Assistant: Mr. Deepak Sharma
Objective: - Write a program to rotate a triangle.
Appratus:- Computer system / Turbo C++ IDE (TurboC3)
Page 61 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Theory: Procedure: #include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void main()
{
int gdriver=DETECT,gmode,x1,y1,x2,y2,x3,y3;
int a,b,c,d,e,f,g;
float p,q;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
clrscr();
cout<<"enter the vertices";
cin>>x1>>y1>>x2>>y2>>x3>>y3;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
cout<<"enter the rotation angle ";
cin>>a;
p=cos((a*3.14)/180);
cout<<p<<endl;
b=((x1,p)-(y1*q));
c=((x1*q)+(y1*p));
d=((x2*p)-(y2*q));
e=((y2*q)+(y2*p));
Page 62 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
f=((x3*p)-(y3*p));
g=((y3*q)+(y3*p));
line(b,c,d,e);
line(d,e,f,g);
line(f,g,b,c);
getch();
}
Observation Table:- NA
Calculation:- NA
Results: -
Conclusion:- NA
Precautions:- NA
Suggestions:- NA
Page 63 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
Lab Quiz :1. The primary output devices in a graphics system are a
______________.
A. video monitor.
B. video display devices.
C. cathode ray tube.
D. deflection CRT.
2. The focusing system in a CRT is needed to force the electron beam to
converge into a _____________ as it strikes the phosphor.
A. large spot.
B. small spot.
C. double spot.
D. spot.
3. Color CRTs in graphics systems are designed as____________.
A. CRT monitors.
B. RGB monitors.
C. DVST monitors.
D. color monitors.
4. The emissive displays are device that convert electrical energy
into_____________.
A. light.
B. image.
C. pixel.
D. colors.
5. A beam of slow electrons excites only the outer____________ layer.
A. blue.
B. green.
C. white.
D. red.
6. A________ is a transformation that produces a mirror image of an
object.
A. reflection.
B. shear.
C. translation.
D. rotation.
Page 64 of 66
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
7. ____________ generally refers to any time sequence of visual changes
in a scene.
A. Computer animation.
B. Graphics.
C. Visualization.
D. Frame work.
8. A world coordinate area selected for display is called as_____________.
A. window.
B. Viewport.
C. window-to-viewport.
D. Viewing transformation.
9. One of the oldest and most popular line clipping procedure
is___________.
A. Liang-Barsky Line Clipping.
B. Nicholl-Lee-Nicholl Line Clipping.
C. Cohen-Sutherland Line Clipping.
D. Line Clipping using Nonrectangular Clip window.
10. A commonly used image space approach to detect visible surface
is___________.
A. buffer depth method.
B. surface rendering method.
C. polygon surface method.
D. depth buffer method.
Further reading resources:
Book: Lab experiment related theory available in following books:
Book No
Book Name
1.
Let Us C
2.
3.
4.
5.
Web resources:
Author
Yashwant kanetkar
Page 65 of 66
Page No.
NAME OF LABORATORY:
VSB LAB 5
LAB SUBJECT CODE: IT 602
NAME OF DEPARTMENT: CS/IT
1. www.w3professors.com
2. www.cglabprograms.com
3. www.graphics.cornell.edu
4. www.mycplus.com
5. www.computergraphicsprojectsusingc.com
Page 66 of 66
Download