Docsity

computer graphics notes, Summaries of Computer science

Toggle sidebar
bg1
Working of CRT
The working of CRT depends on the movement of electron s beams. The
electron guns generate sharply focused electrons which are accelerated at
high voltage. This high-velocity electron beam when strikes on the
fluorescent screen creates luminous spot.
After exiting from the electron gun, the beam passes through the pairs of
electrostatic deflection plate. These plates deflected the beams when the
voltage applie d across it. The one pair of plate moves the beam upward
and the second pair of plate moves the beam from one side to another.
The horizontal and vertical movement of the electron are independent of
each other, and hence the electron beam positioned anywhere on the
screen.
The working parts of a CRT are enclosed in a vacuum glass envelope so
that the emitted electron can easily move freely from one end of the tube
to the other.
Random Scan Display Raster Scan Display
It has high resolution. Its resolution is low.
It is more expensive. It is less expensive.
Modification is easy. Modification is touch.
Refresh rate depends on
resolution.
Refresh rate d oes n ot depend on
resolution.
Only screen view on an area is
displayed.
Whole screen is scanned.
Beam penetration technology
comes under it.
Shadow mark technology comes
under it.
It does not use interlacing
method.
It was interlacing.
Computer Graphics:
Computer graphics is the discipline of generating images with the aid of
computers.
Computer graphics is an art of drawing pictures, lines, charts, etc. usin g
computers with the help of programming.
1.2. Applications of Computer Graphics:
Some of the application of computer graphics is explained below:
1. Computer Art: Computer graphics are used in the field of commercial
arts which include animation packages, paint packages. It is used to
generate television and advertising commercial. Cartoon drawing,
paintings, logo design can also be done.
2. Computer Aided Drawing: Design of build ings, automobile, aircraft
is done with the help of computer aided drawing, this helps in providing
minute details to the drawing and producing more accurate and sharp
drawings with better specifications.
3. Presentation Graphics: Example of presentation graph ics are bar
graphs, pie charts, time charts showing the relationship between multiple
parameters. Presentation graphics is commonly used to summarize
financial, statistical, mathematical, scientific, managerial and oth er types
of reports.
4. Entertainment: Computer graphics are now commonly used in
making motion pictures, music videos and television shows. It is also
used in making games.
5. Education: Using computer graphics, many educational models can be
created through which more interest can be generated among the students
regarding the subject.
6. Training: Specialized systems for trainin g like simulators can be used
for training the candidates in a way that can be grasped in a short period
of time with better understanding. Creation of training modules using
computer graphics is simple and very useful.
7. Visualization: It is used for visualization of scientists, engineers,
medical personnel, business analyst for the study of a large amount of
information.
8. Image Processing: P rocessing of existing images into refined ones for
better interpretation is one of th e many applications of computer
graphics.
9. Printing Technology: Computer graphics is u sed for printing
technology and textile design.
10. Educational software: Computer graphics is used in the development
of educational software for making computer-aided instruction.
4. Flat-Panel Displays:
A flat-panel display is a television, monitor or oth er display appliance
that uses a thin panel design instead o f a tr aditional cathode ray tube
(CRT) design. They are much lighter, thinner, less power consumption
and portable than CRT. They also h ave high resolution th an older
models. Eg. Small T.V. monitor, calculator, pocket video games, laptop
computer, etc.
Types of Flat panel display:
i. Emissive Display
The emissive displays are devices that convert electrical energy into light.
Eg. Plasma panel, thin film electroluminescent display and led.
ii. Non-Emissive display
The non-emissive d isplay uses optical effects to convert sunlight or light
form some other source into graphics patterns. Eg. Lcd, led.
● Plasma Panel Display: Plasma panels are also called Gas Discharge
Display. It consists of an array of small lights. Lights are fluorescent in
nature.
A plasma display is a type of flat panel d isplay that uses plasma, an
electrically charged ionized gas, to illuminate each pixel in order to
produce a display output.
Components of Plasma-Panel Display are:
i. Cathode ii. Anode iii. Florescent cell iv. Gas plates
●Light Emitting Diode (LED):
A LED display is a flat p anel display that uses a panel (array) of LEDs as
the light source or pixels for a video display. Modern electronic devices
such as mobile phones, TVs, tablets, computer monitors, laptop screen,
etc use a LED display to display their output.
●Liquid Crystal Display (LCD):
A liquid crystal display is a flat panel display that makes use o f liquid
crystals that open or close when stimulated by electronic current.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download computer graphics notes and more Summaries Computer science in PDF only on Docsity!

Working of CRT

The working of CRT depends on the movement of electrons beams. The

electron guns generate sharply focused electrons which are accelerated at

high voltage. This high-velocity electron beam when strikes on the

fluorescent screen creates luminous spot.

After exiting from the electron gun, the beam passes through the pairs of

electrostatic deflection plate. These plates deflected the beams when the

voltage applied across it. The one pair of plate moves the beam upward

and the second pair of plate moves the beam from one side to another.

The horizontal and vertical movement of the electron are independent of

each other, and hence the electron beam positioned anywhere on the

screen.

The working parts of a CRT are enclosed in a vacuum glass envelope so

that the emitted electron can easily move freely from one end of the tube

to the other.

Random Scan Display Raster Scan Display

It has high resolution. Its resolution is low.

It is more expensive. It is less expensive.

Modification is easy. Modification is touch.

Refresh rate depends on

resolution.

Refresh rate does not depend on

resolution.

Only screen view on an area is

displayed.

Whole screen is scanned.

Beam penetration technology

comes under it.

Shadow mark technology comes

under it.

It does not use interlacing

method.

It was interlacing.

Computer Graphics:

Computer graphics is the discipline of generating images with the aid of

computers.

Computer graphics is an art of drawing pictures, lines, charts, etc. using

computers with the help of programming.

1.2. Applications of Computer Graphics:

Some of the application of computer graphics is explained below:

  1. Computer Art: Computer graphics are used in the field of commercial

arts which include animation packages, paint packages. It is used to

generate television and advertising commercial. Cartoon drawing,

paintings, logo design can also be done.

  1. Computer Aided Drawing: Design of buildings, automobile, aircraft

is done with the help of computer aided drawing, this helps in providing

minute details to the drawing and producing more accurate and sharp

drawings with better specifications.

  1. Presentation Graphics: Example of presentation graphics are bar

graphs, pie charts, time charts showing the relationship between multiple

parameters. Presentation graphics is commonly used to summarize

financial, statistical, mathematical, scientific, managerial and other types

of reports.

  1. Entertainment: Computer graphics are now commonly used in

making motion pictures, music videos and television shows. It is also

used in making games.

  1. Education: Using computer graphics, many educational models can be

created through which more interest can be generated among the students

regarding the subject.

  1. Training: Specialized systems for training like simulators can be used

for training the candidates in a way that can be grasped in a short period

of time with better understanding. Creation of training modules using

computer graphics is simple and very useful.

  1. Visualization: It is used for visualization of scientists, engineers,

medical personnel, business analyst for the study of a large amount of

information.

  1. Image Processing: Processing of existing images into refined ones for

better interpretation is one of the many applications of computer

graphics.

  1. Printing Technology: Computer graphics is used for printing

technology and textile design.

  1. Educational software: Computer graphics is used in the development

of educational software for making computer-aided instruction.

  1. Flat-Panel Displays:

A flat-panel display is a television, monitor or other display appliance

that uses a thin panel design instead of a traditional cathode ray tube

(CRT) design. They are much lighter, thinner, less power consumption

and portable than CRT. They also have high resolution than older

models. Eg. Small T.V. monitor, calculator, pocket video games, laptop

computer, etc.

Types of Flat panel display:

i. Emissive Display

The emissive displays are devices that convert electrical energy into light.

Eg. Plasma panel, thin film electroluminescent display and led.

ii. Non-Emissive display

The non-emissive display uses optical effects to convert sunlight or light

form some other source into graphics patterns. Eg. Lcd, led.

● Plasma Panel Display: Plasma panels are also called Gas Discharge

Display. It consists of an array of small lights. Lights are fluorescent in

nature.

A plasma display is a type of flat panel display that uses plasma, an

electrically charged ionized gas, to illuminate each pixel in order to

produce a display output.

Components of Plasma-Panel Display are:

i. Cathode ii. Anode iii. Florescent cell iv. Gas plates

●Light Emitting Diode (LED):

A LED display is a flat panel display that uses a panel (array) of LEDs as

the light source or pixels for a video display. Modern electronic devices

such as mobile phones, TVs, tablets, computer monitors, laptop screen,

etc use a LED display to display their output.

●Liquid Crystal Display (LCD):

A liquid crystal display is a flat panel display that makes use of liquid

crystals that open or close when stimulated by electronic current.

DDA Algorithm(Digital Differential Analyzer):

DDA stands for Digital Differential Analyzer. It is an incremental

method of scan conversion of line. In this method, calculation is

performed at each step but by using result of previous steps. It is a line

algorithm based on calculating either ∆y or ∆x using above equation:

∆y=m. ∆x

There are two cases:

DDA with Positive slope and DDA with Negative slope

  1. DDA with Positive slope:

Consider a line with positive slope

∆୷

∆୶

௬

ೖశభ

ି ௬

ೖ

௫ ೖశభ

ି ௫ ೖ

For 𝑚 ≤ 1

Sample line at unit interval in x coordinate

Take ∆𝑥 = 1 and compute successive y by

௞ାଵ

௞ା௠

௞ାଵ

௞

Here, k takes the value form starting point and increases by 1 unit final

end point. ‘m’ can be any real value between 0 and 1.

  1. DDA with Negative slope:

For 𝑚 > 1 (|∆𝑦| > |∆𝑥|),

Sample line at unit interval in y coordinate

Take ∆𝑦 = 1 and compute successive x by

௞ାଵ

௞

ଵ

௠

௞ାଵ

௞

These above equations are under the assumptions that the line is

processed form left to right end points.

In case, if the line is processed form right end to left end point, then

௞ାଵ

௞

௞ାଵ

௞

And

௞ାଵ

௞

௞ାଵ

௞

DDA Line Algorithm Steps

Step 1: Start Algorithm

Step 2: Read the input of the 2 end points of the line as (x 1

, y 1

) and (x 2

,y 2

such that x 1

!=x 2

and y 1

!=y

Step 3: Declare x 1

, y 1

, x 2

, y 2

, dx, dy, x, y as integer variables. (here

∆x=dx and ∆y=dy)

Step 4: Calculate dx=x 2

-x

1

and dy=y

2

-y

1

Step 5: If (abs (dx)>=abs(dy))

Step = abs (dx)

Else

Step = abs (dy)

Step 6: x inc

=dx/step and

y

inc

=dy/step

Assign y=y 1

Step 7: Set Pixel (x, y)

Step 8: x=x+ x inc

y=y+ y

inc

Set pixel (Round(x) and Round(y))

Step 9: Repeat step 8 until x=x 2

Step 10: End algorithm.

Example:

  1. Calculate the points between the starting point (5, 6) and ending point

Soln= Given

P(5, 6)=(x

1

, y

1

And Q (8, 12)= (x

2

,y

2

Calculating dx, dy and m.

dx=x

2

-x

1

dy=y 2

-y 1

m=dy/dx=6/3=

Calculating number of steps

As, abs (dx)<abs(dy)=3<6, xo number of steps = dy=

As m>1, so x k+

= round off (x k

+1/m)

yk+

= round off (y

k

Now,

x k

y k

x k+

y k+

Round off x

k+

& y

k+

Advantages of DDA Algorithm:

i. It is the simplest algorithm and it does not require special skills for

implementation.

ii. It is faster method for calculating pixel position than the direct use of

line equation, y=mx+b.

iii. It allows us to detect the chance in the value of x and y, so plotting of

same point twice is not possible.

iv. This method gives overflow indication when a point is repositioned.

v. It is very easy method because it involves just two additions.

Disadvantages

i. Rounding operations and floating-point arithmetic are still time

consuming.

ii. The algorithm is orientation dependent. So end point accuracy is poor.

iii. The points generated by this algorithm are not accurate.

Circle:

Circle is an eight way symmetric figure. The shape of circle is same in all

quadrants. If the calculation of the point of one octant is done, then the

other seven points can be calculated easily by using the concept of eight

way symmetry.

For drawing, circle

considers it at the origin. If

a point is P 1

(x, y), then

other seven points will be:

P2(y, x)

P3(-y, x)

P4(-x, y)

P5(-x, -y)

P6(-y, -x)

P7(y, -x)

P8(x, -y)

So, we will calculate only 45

o

arc, from which the whole circle can be

determined easily.

If we want to display the circle on the screen then the put pixel function

is used for eight points as shown below:

Putpixel(x, y, color)

Putpixel (x, -y, color)

Putpixel (-x, y, color)

Putpixel (-x, -y, color)

Putpixel(y, x, color)

Putpixel (y, -x, color)

Putpixel(-y, x, color)

Putpixel (-y, -x, color)

Properties of circle:

i. A circle is the set of points that are all at the same distance ‘r’ form a

center point (x c

, y c

ii. The equation for a circle is expressed by Pythagorean equation in

Cartesian coordinate as: (x-x c

2

+(y-y c

2

=r

2

iii. Any given circle can be drawn on the origin (0, 0) and then moved to

its actual position by:

  • Each calculated ‘x’ on the circumference moved to x+x c
  • Each calculated ‘y’ on the circumference moved to y+y c

Midpoint Circle Drawing Algorithm:

The mid-point circle algorithm is an algorithm used to determine the

points needed for rasterizing a circle. Given the centre and radius of

circle. Drawing Algorithm attempts to generate the points on one octant.

The points for other octants are generated using the eight symmetry

property.

In this algorithm decision parameter is based on a circle equation. As we

know that the equation of circle is x

2

+y

2

=r

2

i. If f circle

<0, then (x, y) is inside the circle

ii. If f circle

=0, then (x, y) is on the circle

iii. If f circle

0, then (x, y) is outside the circle

Algorithm:

Given,

Centre point of circle = (x

0

,y

0

Radius = R

The point generation using mid-point circle involves the following steps:

Step 1: Assign the starting point of the coordinates (x

0

, y

0

) as,

x

0

y

0

=r

⸫(x 0

, y 0

)=(0, r)

Step 2: Calculate the value of initial decision parameter P 0

as:

P

0

=1-r (or 5/4-r)

Step 3: Suppose the current point is (x k

, y k

) and the next point is

(x

k+

, y

k+

Find the next point of the first octant depending on the value of

division parameter P

k

i. if P

k

x

k+

= x

k

+1, y

k+

=y

k

(x

k+

, y

k

P

k+

=P

k

+2(x

k+

ii. if P k

x k+

= x k

+1, y k+

=y k

-1 (x k+

, y k

P

k+

=P

k

+2(x k+

)+1-2(x k+

Step 4: Determine the symmetry points in other seven octants.

Step 5: Move at each point by the given centre (x c

, y c

) and plot the

coordinate values:

x=x+x

c

y=y+ y

c

Step 6: Repeat step 3 to 5 until the condition x>=y.

Advantages of Mid-Point Circle Drawing Algorithm:

i. It is powerful and efficient algorithm.

ii. The entire algorithm is based on the simple equation of circle

x

2

+y

2

=r

2

iii. It is easy to implement from the programmer’s prespective.

Disadvantages:

i. Accuracy of the generating point is an issue in this algorithm.

ii. The circle generated by this algorithm is not smooth.

iii. This algorithm is time consuming.

Bresenham’s Circle Drawing Algorithm:

Bresenham’s circle drawing algorithm is a circle drawing algorithm that

selects the nearest pixel position to complete the arc. The unique part of

this algorithm is that is uses only integer arithmetic which makes its

significantly faster than other algorithm’s using floating point arithmetic

in classical processors.

Given the centre point and radius of circle, Bresenham’s circle drawing

algorithm attempts to generate the points of one octant. The points for

other octants are generated using the eight symmetry property.

Algorithm:

Given, centre point of circle (x c

, y c

), and radius = r

Step 1: get the radius of circle r and coordinates of centre of circle

(x c

, y c

Step 2: x and y are going to be plotted points

Set x=0 and y=r, ⸫(x, y)=(0, r)

Step 3: calculate the initial decision parameter d=3-2r

Step 4: plot the circle (x c

, y

c

, x, y)

Step 5:

if d<0 then, d=d+4x+

x=x+

y=y

Else, d=d+4(x-y)+

x=x+

y=y-

Step 6: check, if x<=y, Go to step 7

Else, Go to step 4

Step 7: stop/end.

Advantages of Bresenham’s circle drawing algorithm:

i. The entire algorithm is based on the simple equation of circle

x

2

+y

2

=r

2

ii. It is easy to implement.

Disadvantage:

i. Accuracy is an issue.

ii. Difficult to generate complex and high graphical images.

Attributes: Line attributes, curve attributes and character

Attributes

The way a primitive is to be displayed is referred as an attribute

parameter. Some attribute parameters include color, size,etc.

Some types of attributes are explained belos:

  1. Line Attributes:

Basic attributes of a straight line segment are its type, its width and its

color. In some graphics packages, lines can also be displayed using

selected pen or brush options.

i. Line type:

Possible selection of line type attributes includes:

 Solid lines

 Dashed lines

 Dotted lines

 Dash dotted lines

To set line type attributes in PHIGS application program, a user invokes

the function setlinetype (lt).

Lt can be – 1, 2, 3, 4

ii. line width:

Implementation of line width option depends on the capabilities of the

output device to the line width attributes.

SetlinewidthScale Factor (lw)

Line width parameter lw is assigned to a positive number to indicate the

relative width of line to be displayed.

Lw value = 1, standard line.

Lw value = 0.5, half of standard line.

Lw value>1, thicker than standard line.

Line end caps

iii. line color:

A polyline routine displays a line in the current color by setting this color

value in the frame buffer at pixel locations along the line path using the

set pixel procedure.

SetPolylineColorIndex (LC)

A line drawn with background colour is invisible.

iv. Pen and Brush Options

with some packages, line can be displayed with pen or brush selections.

Options in this category includes

shape, size, pattern.

  1. Curve Attributes:

Parameters for curve attributes are same as those for line segments.

Curves displayed with varying colors, widths, dot-dash patterns and

available pen or brush options.

  1. Character Attributes:

The appearance of displayed character is controlled by attributes such as

font, size, color and orientation. Attributes can be set for both entire

character strings (text) and for individual characters defined as marker

symbols.

i. Text Attributes:

SetTextfont (tf)

SetTextColourIndex(tc)

SetCharacterHeight(ch)

SetCharacterExpansionFactor(cw)

SetCharacterSpacing(cs)

SetCharactwerUpVector(upvect)

SetTextPath(tp)

SetTextAlignment(hiv)

SetTextPrecision(tpr)

  1. Translation:

Two successive translations are additive. If two successive translation

vectors (tx 1

, ty 1

) and (tx 2

, ty 2

) are applied to a coordinate position P, the

final translation location P’ is calculated as:

P’=(tx 2

, ty

2

).{T(tx

1

, ty

1

).P}

={T(tx 2

, ty

2

).T(tx

1

, ty

1

)}.P

Where P and P are represented as homogenous coordinate column

vectors. We can verify this by calculating the matrix product for the two

associative grouping.

Also, the composite transformation matrix for this sequence of translation

is:

ଶ

ଶ

൩ × ൥

ଵ

ଵ

ଵ

ଶ

ଵ

ଶ

Or, Translation ቈ

ଶ

ଶ

ଵ

ଵ

  1. Rotation:

Two successive rotation operations are additive.

Let R(ɵ 1

) and R(ɵ 2

)be two successive rotations applied to a coordinate

position P produce the transformed position.

P’=R(ɵ 2

).{R(ɵ

1

).P)

P’= R(ɵ 1

).{R(ɵ

2

).P)

Here, the composite transformation matrix for this sequence of rotation

is:

R(ɵ 2

).R(ɵ

2

ୡ୭ୱ ఏ మ

ୱ୧୬ ఏ మ

ିୱ୧୬ ఏ మ

ୡ୭ୱ ఏ మ

ቃ × ቂ

ୡ୭ୱ ఏ భ

ୱ୧୬ ఏ భ

ିୱ୧ భ

ୡ୭ୱ ఏ భ

cos 𝜃

ଶ

. cos 𝜃

ଵ

− sin 𝜃

ଶ

. sin 𝜃

ଵ

cos 𝜃

ଶ

. sin 𝜃

ଵ

− sin 𝜃

ଶ

. cos 𝜃

ଵ

sin 𝜃

ଶ

. cos 𝜃

ଵ

  • cos 𝜃

ଶ

. sin 𝜃

ଵ

sin 𝜃

ଶ

. sin 𝜃

ଵ

  • cos 𝜃

ଶ

. cos 𝜃

ଵ

cos(𝜃

ଶ

ଵ

) − sin(𝜃

ଶ

ଵ

sin(𝜃

ଶ

ଵ

) cos(𝜃

ଶ

ଵ

cos(𝜃

ଵ

ଶ

) − sin(𝜃

ଵ

ଶ

sin(𝜃

ଵ

ଶ

) cos(𝜃

ଵ

ଶ

=R(ɵ 1

+ɵ

2

⸫P’=R(ɵ 2

): R(ɵ

1

)=R(ɵ

1

+ɵ

2

) additive.

Or, Rotation ቈ

ଶ

ଶ

cos 𝜃 − sin 𝜃 0

sin 𝜃 cos 𝜃 0

ଵ

ଵ

  1. Scaling:

Two successive scaling operations are multiplicative:

Let (Sx 1

, Sy

1

) and (Sx

2

, Sy

2

) be two successive vector application to a

coordinate position P then the composite scaling thus produced is:

P’=S(Sx 2

, Sy 2

).{S(Sx 1

, Sy 1

).P}

⸫P’={S(Sx 2

, Sy

2

).S(Sx

1

, Sy

1

)}P

The composite transformation matrix for this sequence of scaling is:

ଶ

ଶ

൩ × ൥

ଵ

ଵ

ଶ

ଵ

ଶ

ଵ

⸫S(Sx 2

, Sy 2

)×S(Sx 1

, Sy 1

)= S(Sx 1

Sx 2

, Sy 1

Sy 2

Or, Scaling, ቈ

ଶ

ଶ

ଵ

ଵ

Significance of 2D transformation:

 Transformations are the building blocks of computer graphics.

 Positioning, shaping, viewing positions are done by transformations.

 Transformation is also used for determining views.

 The transformations that one can perform in 2 dimensions:

i. Translation: Movement of all points of an object within a fixed

direction for an object is known as translation.

ii. Rotation: Changing the angle of the object either clockwise or

anticlockwise.

iii. Scaling: Increasing or decreasing the coordinates of an object is

scaling.

Two dimensional object screen viewing transforms:

Window: A world coordinate area selected for display is called a

window. The window defines what is to be viewed.

Viewport: An area on a display device to which a window is mapped is

called viewport. The viewport defines where it is to be displayed.

Viewing Transformation/Window-to-viewport transformation:

The mapping of a part of an object from world-coordinate scene to device

coordinates or screen coordinates is known as viewing transformation.

Two dimensional viewing transformation is referred to as window to

viewport transformation or window transformation.

2D Viewing Transformation Pipeline (or steps):

We should know,

MC = Modeling coordinates

WC = World Coordinates

VC = Viewing Coordinates

NVC = Normalized Viewing Coordinates.

Window to viewport coordinate transformation:

Window-to-viewport coordinate transformation is done by maintaining

the same relative placement of objects in device coordinates as they had

been in world coordinates. For eg. If a coordinate position is at the centre

of the viewing window, then it will be displayed at the centre of the

viewport.

Fig: A point a position (xw, yw) in a window is mapped to viewport

coordinates (xv, yv) so that the relative positions in the two areas are the

same.

A point at position (xw, yw) in window is mapped to position (xv, yv) in

the viewport. To maintain the same relative placement in viewport, we

require:

௫௩ି௫

೘೔೙

௫௩ ೘ೌೣ

ି ௫௩ ೘೔೙

௫௪ି௫

೘೔೙

௫௪ ೘ೌೣ

ି ௫௪ ೘೔೙

௬௩ି௬௩

೘೔೙

௬௩

೘ೌೣ

ି ௬௩

೘೔೙

௬௪ି௬௪

೘೔೙

௬௪

೘ೌೣ

ି ௬௪

೘೔೙

Solving these expressions for the viewport position (xv, yv) we have

xv=xv

min

+(xw-xw

min

).Sx

yv=yv min

+(yw-yw min

).Sy

where the solving factors (Sx, Sy) are

௫௩ ೘ೌೣ

ି ௫௩ ೘೔೙

௫௪

೘ೌೣ

ି ௫௪

೘೔೙

௬௩ ೘ೌೣ

ି ௬௩ ೘೔೙

௬௪

೘ೌೣ

ି ௬௪

೘೔೙

If the scaling factors, Sx and Sy are same, relative proportions are

maintained. Otherwise, world objects will be stretched or contracted in

either x or y direction, that is, its shape will be distorted, when displayed

on the output device.

Workstation Transformation:

The workstation transformation defines that the part of NDC space which

will be visible, and where it will appear on the display surface.

Any number of output devices can be open in particular application and

another window viewport transformation can be performed for each open

output device. This mapping is called the workstation transformation, is

accomplished by selecting a window area in normalized space and

viewport area in coordinates of display device.

Clipping Operations:

Any procedure that identifies those portion of a picture that are either

inside or outside of a specified region of space is referred as clipping

algorithm or clipping. The region against which an object is to be dipped

is called clip window or clipping window. The clipping algorithm

determines which points, line or portion of lines lie within the clipping

window. These points, lines or portions of lines are retained for display.

All other are discarded.

Application for clipping:

 For extracting the part we desire.

 For identifying the visible and invisible area in 3D object.

 For creating objects using solid modeling.

 For drawing operations.

 Operations related to the pointing of object.

 For deleting, copying, moving part of an object.

Types of clipping:

  1. Point Clipping:

Clip window is a rectangle in standard form. Point clipping is used to

determine, whether the point is inside the window or not. For this

following conditions are checked:

i. x<=xw max

ii. x>=xw min

iii. y<=yw max

iv. y<=yw min

The point (x, y) is for display.

If anyone from the above inequalities is false, then the point will fall

outside that window and will not be considered to be visible.

  1. Line Clipping:

A line clipping procedure involves several parts:

i. First we test the given line segment whether it lies completely inside

the clipping window.

ii. If it does not, we try to determine whether it lies completely outside

the window.

iii. Finally, we cannot identify a line as completely inside or completely

outside, we must perform intersection calculations with one or more

clipping boundaries. Process the lines through “inside-outside” tests by

changing the line endpoints.

Inside-Outside Test

 Check both endpoints: if P1 and P2 are within boundaries line is

saved.

 If both end points outside, drop line segment.

 Remaining may require calculation of multiple intersections.

Line clipping against a rectangular clip window:

All other lines cross one or more clipping boundaries. For a line segment

with endpoints (x

1

, y

1

) and (x

2

, y

2

) and one or both endpoints outside the

clipping rectangle, the parametric representation,

x=x

1

+u(x

2

-x

1

y=y 1

+u(y 2

-y 1

), o<=u<=

could be used to determine the values of parameter u for intersection with

the clipping boundary coordinates.

  1. Cohe-Sutherland Line Clipping:

It is developed by Dan Cohen and Ivan Sutherland. To speed up the

processing this algorithm performs initial tests that reduces the number of

intersections that must be calculated.

In this algorithm, it is detected whether line lies inside the screen or it is

outside the screen. All lines come under any one of the following

categories:

  1. Visible: if a line lies within the window, a line is visible and will be

displayed as it is.

  1. Not-visible: if a line lies outside the window, it will be invisible and

rejected. Such lines will not be displayed.

  1. Clipping case: lines can be partial inside window then we should find

intersection point and drawn only that inside region.

This algorithm uses the clipping window as shown in figure below. The

minimum coordinate for the clipping region (xw

min

, yw

min

) and the

maximum coordinate for the clipping region is (xw

max

, yw

max

 line AB is visible case

 Line OP is invisible case

 Line PQ is invisible case.

 Line IJ are clipping candidates

 Line MN are clipping condidates

 Line CD are clipping candidates

The entire region is divided by

using 4-bits which represent Top,

bottom, right and left of region.

There are 9 regions and all are assigned codes of 4-bit. If both

endpoints of the line have end bits zero ‘0’, then the line is considered

to be visible.

Algorithm for Liang-Barsky Line clipping Algorithm:

Step 1: Accept the line end points A (x 1

, y 1

) and B(x 2

, y 2

) and window

coordinates xw min

, yw min

, xw max

, yw max

as input.

Step 2: Calculate P k

and Q k

for k=1, 2, 3, 4, as

P1= - ∆x q 1

= x

1

-xw

min

(p

1

, q

1

→left)

P2= ∆x q 2

= xw

max

-1 (p

2

, q

2

→right)

P3= - ∆y q 3

= y

1

-yw

min

(p

3

, q

3

→bottom)

P4= ∆y q 4

= yw

max

-y

2

(p

4

, q

4

→top)

Step 3: If, then line is parallel to K

th

boundry

If Q k

<0, then line is outside the boundary, discard the line and

stop

If Q k

≥0, then line is parallel to k

th

boundary

If Q k

≠0 then go to step 4.

Step 4: if P k

<0, find t

1

initial time

t

1

=max(o, q

k

/p

k

) [x=x

1

+t

1

∆x, y=y

1

+t

1

∆y]

If P

k

0, find t

2

final time

t

2

=min(1, q

k

/p

k

) [x=x

1

+t

2

∆x, y=y

1

+t

2

∆y]

Step 5: If t 1

t

2

, then line is totally outside, discard it and stop.

If t

1

<t

2

, then calculate end points of clipped line.

x'=x 1

+t 1

∆x y’=y 1

+t 1

∆y I’(x’, y’)

x”=x 1

+t 2

∆x y’’=y 1

+t 2

∆y I’’(x”, y”)

step 6: Display line segment form I’ to I”.

Example: consider the window size from 5 to 9.

Clip the following line A (4, 12) and B (8, 8).

= Given end points are

A(x 1

, y

1

B(x 2

, y

2

Window coordinates are

xw min

xw max

yw min

yw max

∆x=x 2

-x 1

∆y=8-12=-

Calculationof P k

and Q

k

for k=1,2,3, 4

P1= - ∆x = -4 q 1

= x

1

-xw

min

P2= ∆x = 4 q 2

= xw

max

P3= - ∆y = 4 q 3

= y

1

-yw

min

P4= ∆y = -4 q 4

= yw max

-y 2

Calculation of t 1

and t 2

p 1

<p<0 p 2

, p 3

t 1

=max(o, q k

/p k

) t 2

=min(1, q k

/p k

=max(0, q1/p1, p4/p4) =min(1, q2/p2, q3/p3)

=max(0, ¼, ¾) =min(1, 5/4, 7/4)

t 1

=3/4 t

2

  1. Three Dimensional Graphics:

Three-Dimensional (3D) computer graphics, are graphics that use a three

dimensional representation of geometric data that is stored in the

computer for the purposes of performing calculations and rendering 2D

images. The resulting images may be stored for viewing later or

displayed in real time.

5.1. Three-Dimensional Viewing Pipeline:

We know,

MC=Modeling Coordinates

WC=World Coordinates

VC=Viewing Coordinates

PC=Projection Coordinates

NC=Normalized Coordinates

DC=Device Coordinates.

Transformation from world coordinates to viewing coordinates:

The conversion of object description form world coordinates to viewing

coordinates is achieved by following transformation sequence:

  1. Translate the viewing coordinate origin to the world coordinate origin.
  2. Apply rotations to align the u, v, h, axes with the world coordinates x

w

y

w

, z

w

axes respectively.

5.2. Projection: Parallel Projections, Perspective Projections:

The technique used for 2-D display of 3-D objects is called projection. In

geometry, several types of projections are known. However in computer

graphics, mainly two: Parallel Projection, Perspective Projection are in

interest.

i. Parallel Projection:

 Mostly used by drafters and engineers to create working drawing of an

object this preserves its scale and shape.

 In parallel projection, z coordinate is discarded and parallel line form

each vertex on the object are extended until they intersect the view

panel.

 The point of intersection is the projection of the vertex.

 The distance between the COP (Centre of Projection) and the

Projection Panel (PP) is infinite. i.e. the projectors are parallel to each

other and have a fixed direction.

 Coordinate positions are transformed to the view panel along parallel

lines.

  1. Orthographic parallel Projection

 The direction of projection is perpendicular to the view panel.

 The centre of projection is infinity.

 Parallelism of lines is preserved but angles are not.

 The orthographic projection an display more than one face of an object

called axonometric orthographic projection.

 Most commonly used axonometric orthographic projection is the

isometric projection.

 Lines are parallel to each other making an angle of 90

o

with the view

panel.

  1. Oblique Parallel Projection:

 The parallel projection is not perpendicular to the view panel.

 Projection lines are parallel to each other but not making 90

o

with the

projection/view panel.

 Preserve parallel lines but not angles.

 Isometric view: Projection panel is placed symmetrically with respect

to the three principal faces that meet at a corner of object.

 Di-metric view: symmetric with two faces.

 Trimetric view: General Case.

 Direction of projection (DoP) is perpendicular to the projection/view

panel.

 Only faces of the object parallel to the projection plane are shown true

size and shape.

Two common oblique Parallel projections:

a. Cavalier projection:

  • Direction of projection makes an angle of 45

o

with the view panel.

  • Projection of line perpendicular to the view panel has the same length as

the original length.

b. Cabinet Projection:

 Direction of projection makes an angle of arc tan (z)= 63.4 with the

view panel.

 Lines perpendicular to view panel has half length of its original lenth.

ii. Perspective Projection:

-First discovered by Donatello, Brunelleschi and Davinci During

Renaissance.

  • Objects closer to viewer look larger.
  • Parallel lines appear to converge to single Point.
  • Lines of projection are not parallel. Instead they all converge at a single

point called the centre of projection or projection reference point.

There are 3 types of perspective projections:

i. One-Point Perspective Projection

ii. Two-Point Perspective Projection

iii. Three-Point Perspective Projection.

  1. Scaling:

Scaling is used to change the size of an object. The size can be increased

or decreased. For scaling 3 factors are required Sx, Sy, Sz.

For scaling

Initial coordinates = P[x, y, z]

Final coordinates = P’[x’, y’, z’]

Scaling factor = Sx, Sy, Sz.

The scaling is achieved by sing the following scaling equation.

x'=x.Sx

y’=y.Sy

z’=z.Sz

Or, P’=P.S

[x’ y’ z’ 1]=[x y z 1]. S

⸫[x’ y’ z’ 1]=[x.Sx y.Sy z.Sz 1]

5.5. Hidden line and hidden surface removal techniques:

When a picture that contains the non transparent objects and surfaces are

viewed, the objects that are behind the objects that are closer cannot be

viewed. To obtain a realistic screen image, these hidden surfaces need to

be removed. This process of identification and removal of these surfaces

is known as hidden surface problem.

The hidden surface problem can be solved by two method – Object-Space

method is implemented and image space method.

In physical coordinate system, object-space method is implemented and

in case of screen coordinate system, image space method is implemented.

These methods are also called a visible surface determination.

  1. Object space method:

In this method, various parts of objects are compared. After comparison

visible, invisible or hardly visible surface is determined. These methods

generally decide visible surface. In the wireframe mode, these are used to

determine a visible line. So these algorithms are line based instead of

surface based.

  1. Image space method:

Here, positions of various pixels are determined. It is used to locate the

visible surface instead of visible line. Each point is detected for its

visibility. If a point is visible then the pixel is on, otherwise off.

Object space Image space

It is object based method. It is pixel-based method.

Surface visibility is determined. Line or point visibility is

determined.

Calculations are not based on the

resolution of the display.

Calculations are resolution

based.

These are developed for vector

graphics system.

These are developed for raster

devices.

It requires a lot of calculations if

the image is to enlarge.

Image can be enlarged without

losing accuracy.

If the number of objects in the

screen increases, computation

time also increases.

In this method, complexity

increases as with the complexity

of visible parts.

Similarity of object and image space method:

In both methods, sorting is used a depth comparison of individual lines,

surfaces are objected to their distances from the view panel.

Algorithm used for hidden line surface detection:

  1. Black face removal algorithm
  2. Z-Buffer Algorithm
  3. Painter Algorithm
  4. Scaline Line Algorithm.
  5. Subdivision Algorithm
  6. Floating Horizon Algorithm

1.painter algorithm.

The painter's algorithm is a method of creating a 3D image by projecting

it onto a 2D surface. It is named after the Italian painter Giotto, who is

credited with first using this technique in the 14

th

century. The painter's

algorithm works by drawing the 3D image from back to front, so that

objects that are further away appear behind objects that are closer. This

gives the illusion of depth and perspective.

2.scaline line algorithm.

A scaline line algorithm is a mathematical procedure for finding a line

that best fits a set of data points. The algorithm starts by calculating the

slope and intercept of a line that passes through two data points. It then

calculates the slope and intercept of a line that passes through the next

two data points. This process is repeated until all the data points have

been used. The final line is the one that has the smallest sum of squared

errors, which is a measure of how well the line fits the data.

3.sub division algorithm.

The sub division algorithm is a method for creating a mesh from a given

set of points. It works by dividing the space into a set of small cubes, and

then subdividing each cube into smaller cubes, until the desired level of

detail is reached.

4.Floating horizon algorithm.

There are a number of different algorithms that can be used for floating

horizon control, but the most common one is the Proportional-Integral-

Derivative (PID) algorithm. This algorithm is used to adjust the control

input (usually a voltage or current) in order to keep the system variable

(such as temperature, position, or speed) at the desired set point. The PID

algorithm is composed of three separate terms: the proportional term, the

integral term, and the derivative term. Each of these terms has a different

effect on the control input, and the PID algorithm can be tuned to achieve

the desired performance by adjusting the values of the three terms.

5.6. Need for Shading in data visualization

Shading:

Shading is a way to paint the object with light.

Shading is referred to as the implementation of the illumination model at

the pixel points or polygon surfaces of the graphics objects.

Shading model is used to compute the intensities and colors to display the

surface. The shading model has two primary ingredients: Properties of

the surface and properties of the illumination falling on it. The principle

surface property is its reflection, which determines how much of the

incident light is reflected. If a surface has different rectangle for the light

of different wavelengths, it will appear to be colored.

Data Visualization

Data visualization is the representation of data or information in a graph,

chart or other visual format.

It is important because it allows trends and patterns to be more easily

seen.

Need of visualization: We need visualization because a visual summary

of information makes it easier to identify patterns and trends then looking

through thousands of rows on a spreadsheet. It’s the way the human brain

works.

Basic illumination models:

Ambient, Diffuse and Secular reflections:

Illumination models:

An Illumination model, also called a lighting model and sometimes

referred to as a shading model, is used to calculate the intensity of light

that we should see at a given point on the surface of an object.

 Simplified and fast methods for calculating surfaces intensities,

mostly empirical.

 Calculations are based on optical properties of surfaces and lighting

conditions (no reflected source no shadows).

 Light sources are considered to be point sources.

 Reasonably good approximation for most scenes.

i. Ambient Illumination Model:

  • In this model, we can set a general level of brightness for a scene. This

is a simple way to model the combination of light reflections form

various surfaces to produce a uniform illumination called the ambient

light or background light.

  • The amount of ambient light incident on each object is constant for all

surfaces and over all directions.

  • Very Simple mode, not very realistic.
  • The reflected intensity I amb

of any point on the surface is:

I

amb

=KaIa

Ia=ambient light intensity

Ka ∈[0,1], surface ambient reflectivity

ii. Diffuse Reflection Model:

 Diffuse reflections are constant over each surface in a scene.

 Surfaces that are rough or grainy tend to reflect light in all directions.

This scattered light is called diffuse reflection.

 The surface appears equally bright form all viewing direction.

 The brightness at each point is proportional to cos 𝜽.

 The reflected intensity I diff

of a point on the surface is:

𝒅𝒊𝒇𝒇

𝒅

𝑷

𝒅

𝑷

I

P

=the point light intensity.

K

d

∈[0, 1] = the surface diffuse reflectivity.

N= the surface normal

L= the light direction

Note: if N and L have unitary length:

iii. Specular Reflection Model:

 We see a highlight or bright spot, at certain viewing directions. This

phenomenon, called specular reflection, is the result of total or near

total reflection of the incident light in a concentrated region around the

specular reflected angle.

 The specular reflection angle equals the angle of the incident lignt.

 In specular reflection it may possible that some portion of the surface

generated more light or may produce bright spot.

 The Phong Model: reflected specular intensity falls of as some power

of cos (∅):

𝒔𝒑𝒆𝒄

𝒔

𝑷

𝐧

𝒙

𝑷

𝒏

𝑲𝒔= the surface specular reflectivity

𝒏 = sepcular reflection parameter

𝒂𝒎𝒃

𝒅𝒊𝒇𝒇

𝒔𝒑𝒆𝒄

𝒂

𝒂

𝒑

𝒅

𝒔

𝒏

Rendering:

Rendering means giving proper intensity at each point in a graphical

object to make it look like real world object.

Different rendering methods are:

  1. Constant Intensity Shading
  2. Gouraud Shading
  3. Phong Shading
  4. Fash_phong Shading
  5. Constant Intensity Shading:
  • Also called Flat shading.
  • Fast and simple method.
  • A single intensity is calculated for each polygon in the polygon mesh.
  • All points in the surface of polygon are displayed with the same

intensity value.

  • Object is polyhedron
  • Light source illuminating the

Objects are sufficiently far from the surface.

  • The viewing position is sufficiently far from the surface.
  1. Gouraud Shading:
  • Intensity interpolation scheme developed by Gouraud.
  • Represents a polygon surface by linearly interpolating intensity

across the polygon surface.

  • Intensity values for each polygon are matched with adjacent polygon

along common edges.

  • Eliminates the intensity discontinuity

that can occur in flat shading.

Polygon surface is calculated by

following calculations:

i. determine the average unit vector at

each polygon vertex.

ii. apply an illumination model to each

vertex to calculate the vertex intensity.

iii. linearly interpolate the vertex

intensities over the polygon surface.

  1. Phong Shading:
  • Normal vector interpolation shading.
  • Developed by Phong Bui Tuong.
  • Acurate Method.
  • Displays more realistic highlights.
  • Reduces match bond effect.
  • Interpolate normal vectors and then apply illumination.

Polygon surface is rendered using the following steps:

-Determine the average vector

at each polygon vertex.

  • Linearly interpolate the

vertex normal over the

surface of the polygon.

  • Apply illumination model

along each scan line to

calculate projected pixel

intensities for the surface

points.

  1. Fash-Phong Shading:

-It is a goal of any one writing a 3D engine.

-Phong Shading is still common in 3D system.

-It is faster and easier way to approximate the intensity calculation.

-Rendering is faster than the normal Phong shading.

-Surface rendering can be speed up using approximations in the

illumination model calculations of normal vectors.