COMPUTER GRAPHICS

advertisement
EIILM UNIVERSITY, SIKKIM
TERM END EXAMINATIONS, FEBRUARY - 2012
B.SC IN COMPUTER SCIENCE, 3SEM-2YEAR
COMPUTER GRAPHICS
Time: 3 hours
Note: - Attempt any 5 questions.
M.Marks:60
All questions carry equal marks.
1.
a) Write fundamentals of vector graphics.
b) Write basics of transformations.
c) Write short notes on windowing.
d) What is polygon clipping.
e) Define projection.
2.
Describe simple DDA alg.
Ans.- 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 method can be implemented using floatingpoint or integer arithmetic. The native floating-point implementation requires one addition and
one rounding operation per interpolated value (e.g. coordinate x, y, depth, color component etc.)
and output result. This process is only efficient when anFPU with fast add and rounding
operation is available.
The fixed-point integer operation requires two additions per output cycle, and in case of
fractional part overflow, one additional increment and subtraction. The probability of fractional
part overflows is proportional to the ratio m of the interpolated start/end values.
DDAs are well suited for hardware implementation and can be pipelined for maximized
throughput.
where m represents the slope the line and c is the y intercept . this slope can be expressed in
DDA as
yend-ystart
m= ----------xend-xstart
in fact any two consecutive point(x,y) laying on this line segment should satisfy the equation
3.
Describe Bresenham’s circle generation alg.
Ans.- In computer graphics, the midpoint circle algorithm is an algorithm used to determine the
points needed for drawing a circle. The algorithm is a variant of Bresenham's line algorithm, and
is thus sometimes known as Bresenham's circle algorithm, although not actually invented
by Bresenham. The algorithm can be generalized to conic sections. The algorithm starts
accordingly with the circle equation x2 + y2 = r2. So, the center of the circle is located at (0,0).
We consider first only the first octant and draw a curve which starts at point (r,0) and proceeds
upwards and to the left, reaching the angle of 45°.The "fast" direction here is the y direction. The
algorithm always does a step in the positive y direction (upwards), and every now and then also
has to do a step in the "slow" direction, the negative xdirection.The frequent computations
of squares in the circle equation, trigonometric expressions or square rootscan again be avoided
by dissolving everything into single steps and recursive computation of the quadratic terms from
the preceding ones.
(From the circle equation we obtain the transformed equation x2 + y2 − r2 = 0, where r2 is
computed only a single time during initialization)
Let the points on the circle be a sequence of coordinates of the vector to the point (in the usual
basis). Let n denote which point to be looked at, starting at the one on the horizontal axis, on the
first quadrant.
Then for each point also holds:
Likewise for the next point:
That is:
Likewise for the next point:
In general, it is true that:
So we refashion our next-point-equation into a recursive one by
substituting
:
Because of the continuity of the circle and because it is a circle (i.e. maximum along both
axes is the same) we know we will not be skipping x points as we advance in the
sequence. Mostly we will either stay on the same x coordinate or advance by one.
Additionally we need to add the midpoint coordinates when setting a pixel. These
frequent integer additions do not limit the performance much, as we can spare those
square (root) computations in the inner loop in turn. Again the zero in the transformed
circle equation is replaced by the error term.
The initialization of the error term is derived from an offset of ½ pixel at the start. Until
the intersection with the perpendicular line, this leads to an accumulated value of r in the
error term, so that this value is used for initialization.
4.
Derive 2d-transformation matrices for scaling, rotation & translation.
Ans, Transformaions are a fundamental part of computer graphics. Transformations are used to
position objects, to shape objects, to change viewing positions, and even to change how
something is viewed Most common geometric transformations that keep the origin fixed are
linear, including rotation, scaling, shearing, reflection, and orthogonal projection; if an affine
transformation is not a pure translation it keeps some point fixed, and that point can be chosen as
origin to make the transformation linear. In two dimensions, linear transformations can be
represented using a 2×2 transformation matrix.
[edit]Rotation
For rotation by an angle θ counter clockwise about the origin, the functional form isx' = xcos θ
− ysin θ and y' = xsin θ + ycos θ. Written in matrix form, this becomes:
Similarly, for a rotation clockwise about the origin, the functional form is x' = xcos θ
+ ysin θ andy' = − xsin θ + ycos θ and the matrix form is:
[edit]Scaling
For scaling (that is, enlarging or shrinking), we have
matrix form is:
5.
and
. The
When
, then the matrix is a squeeze mapping and preserves areas in the
plane. Translations-Assume you are given a point at (x,y)=(2,1). Where will the
point be if you move it 3 units to the right and 1 unit up? Ans: (x',y') = (5,2). How
was this obtained? - (x',y') = (x+3,y+1). That is, to move a point by some amount dx
to the right and dy up, you must add dx to the x-coordinate and add dy to the ycoordinate.What was the required transformation to move the green triangle to the
red triangle? Here the green triangle is represented by 3 points
triangle = { p1=(1,0), p2=(2,0), p3=(1.5,2) }
Discuss about the clipping alg.
Ans.- Any procedure which identifies that portion of a picture which is either inside or outside a
picture is referred to as a clipping algorithm or clipping.The region against which an object is
to be clipped is called clipping window. in 2D graphics for example, if the user of an image
editing program is modifying an image and has "zoomed in" the view to display only the top half
of the image, there is no need for the program to spend any CPU time doing any of the
calculations or memory moves needed to display the bottom half. By clipping the bottom half of
the image and avoiding these calculations, the program runs faster. In 3D graphics, in a city
street scene the computer may have model, texture, and shader data in memory for every
building in the city; but since the camera viewing the scene only sees things within, say, a 90°
angle, or field of view, the computer does not need to transform, texture, and shade the buildings
that are behind the camera, nor those which are far enough to the side that they are off the screen.
The clipping algorithm lets the rendering code skip all consideration of those buildings, and the
program runs faster. Good clipping strategy is important in the development of video games in
order to maximize the game's frame rate and visual quality. Despite GPU chips that are faster
every year, it remains computationally expensive to transform, texture, and shade polygons,
especially with the multiple texture and shading passes common today. Hence, game
developers must live within a certain "budget" of polygons that can be drawn each video frame.
To maximize the game's visual quality, developers prefer to establish the highest possible
polygon budget; therefore, every optimization of the graphics pipeline benefits the polygon
budget and therefore the game. Several clipping algorithms have been devised.

Line clipping algorithms:

Cohen–Sutherland

Liang–Barsky

Fast-clipping

Cyrus–Beck

Nicholl–Lee–Nicholl

Fast culling for 2D side-scrolling games

Skala

6.
O(lg N) Algorith
Explain few B-splines which are useful for surface design.
7.
Discuss about design of graphic package
Ans.- Graphic design is a creative process - most often involving a client and a designer and
usually completed in conjunction with producers of form (i.e., printers, signmakers, etc.) –
undertaken in order to convey a specific message (or messages) to a targeted audience. The term
"graphic design" can also refer to a number of artistic and professional disciplines that focus on
visual communication and presentation. The field as a whole is also often referred to as Visual
Communication orCommunication Design. Various methods are used to create and combine
words, symbols, and images to create a visual representation of ideas and messages. A graphic
designer may use a combination of typography, visual artsand page layout techniques to produce
the final result. Graphic design often refers to both the process (designing) by which the
communication is created and the products (designs) which are generated. Common uses of
graphic design include identity (logos and branding), publications (magazines, newspapers, and
books), advertisements and product packaging. For example, a product package might include a
logo or other artwork, organized text and pure design elements such as shapes and color which
unify the piece. Composition is one of the most important features of graphic design, especially
when using pre-existing materials or diverse elements. If you are looking for a elegant brand
experience that is not your average corporate treatment, you have come to the right place. In the
world of boutiques, spas and beauty businesses, stunning graphics have always been an essential
part of the package. We know your industry and will create a exclusive brand that will get you
recognized! We know you are in an image conscious industry, and our talent lies in attention to
detail. Every aspect of your design package is tended to with great care. We create design
packages with one goal - to get you noticed!
Download