Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

UNIT 4 COMPUTER GRAPHICS

Structure

1.1 Introduction
Objectives

1.2 Software Configuration of a Graphic System.


1.2.1 Graphics Package
1.2.2 Application Program
1.2.3 Application Data base
1.3 Functions of a Graphic Package.
1.3.1 Generation of Graphic Elements
1.3.2 Transformations
1.3.3 Display Control and Windowing Functions
1.3.4 Segmenting Functions
1.3.5 User Input Functions
1.4 Transformations
1.5 2D & 3D Transformations
1.5.1 Scaling
1.5.2 Rotation
1.5.3 Translation
1.6 Concatenation or Combined Transformation
1.7 Summary

1.1 Introduction

The Graphics software is a collection of programs written to make it convenient for user
a user to operate the computer the computer graphic system. It includes programs to
generate images on the CRT screen, to manipulate the images and to accomplish
various types of interaction between the user and system. The Graphics software for a
particular computer graphics system is very much function of the type of hardware used
in the system. The software must be written specifically for the type of CRT and the
types of CRT and the types of input devices used in the system. The details of the
software for a stroke- writing CRT would be different than for raster scan CRT. The
differences between a storage tube and a refresh a tube would also influence the
graphics software.

The Newman and Sproull Ground Rules that should be considered in designing
graphics software:

• Simplicity: the graphics software easy to use.

• The package should operate in a consistent and predictionable way to the


user.

• Completeness: There should be no inconvenient omissions set of functions.

• Robustness: the graphic system should be tolerant of minor instances of


misuse by the operator.

• Performance: The performance should be exploited as much as possible by


software. The graphics programs should be efficient and speed of response
should be fast and consistent.

• Economy: Graphics Programs should not be so large or expensive as to make


their use prohibitive.
The Objective of the Unit is mainly to provide description about software configuration of
a graphic system, functions of graphic package and 2 dimensional and 3 dimensional
transformations.

OBJECTIVES

After studying this unit, you should be able to


• Understand the ground rules for designing graphics software.
• To know about the software configuration of a graphic system.
• To understand the functions of a graphics package.
• Understand the transformations of the graphic elements or cells composed of
elements or entire model.
1.2 The Software Configuration of a Graphic System

In the operation of the graphic system by the user, a variety of activities take place,
which can be divided in to three categories:

• Interact with the graphics terminal to create and alter images on the screen.
• To construct a model of something physical out of the images on the screen. The
models are sometimes called application models.
• Enter the model in to computer memory and / or secondary storage.

Figure 1: Software configuration of the System

In working of Graphics System the user performs the various activities in combination
rather than sequentially.The user performs these various activities in combination rather
than sequentially. The user constructs a physical model and inputs it to memory by
interactively describing images to the system. The reason for separating these activities
in this fashion is that they correspond to the general configuration of the software
package used with the interactive computer graphics system. The graphics software
can be divided in to these modules according to conceptual model defined by Foley and
Van Dam.

• The graphic Package


• The application programme
• The application data base

The software configuration is illustrated in the fig.1.The central module is the


application of the programme. It controls the storage of data into and retrieves data out
of the application data base. The application program is driven by the user through the
graphics package.
1.2.1 Graphic Package
The graphics package is the software support between the user and the graphic
terminal. It manages the graphical interaction between the user and system. It also
serves as the interface between the user and the application software. The graphic
package consists of input subroutines and output subroutines. The input routines accept
input commands and data from the user and forward them to the application program.
The output subroutines control the display terminal and converts the application models
into two-dimensional or three dimensional graphical pictures.
1.2.2 Application Programme
The application program is implemented by the user to construct the model of a physical
entity whose image is to be viewed on the graphics screen. Application Programs are
written for particular areas. The problem areas in engineering design would include
architecture, construction, mechanical components, electronics, chemical engineering,
and aerospace engineering. Problem areas other than design would include flight
simulators, graphical display of data, mathematical analysis and even art work.
1.2.3 Application Data Base
The third module in the ICG software is the data base. The data base contains
mathematical, numerical and logical definitions of the applications models, such as
electronic circuits, mechanical components, and automobile bodies and so on. It also
includes alphanumeric information associated with the models, such as bill of materials,
mass properties and other data. The contents of the data base can be readily displayed
on the CRT or Plotted out in hard –copy form.

1.3 Functions of a Graphic Package

The graphic package must perform a variety of different functions. It can be grouped in
to set of functions. Each set of functions accomplishes a certain kind of interaction
between the user and the system. The functions of graphic package are

• Generation of Graphic Elements


• Transformations
• Display Control and Windowing Functions
• Segmenting functions
• User input functions

1.3.1 Generation of Graphic Elements:

A graphic element in computer graphics is a basic image entity such as a dot, line
segment, circle and so on. The collection of elements in the system could also include
alphanumeric characters and special symbols. There is often a special hardware
component in the graphics system associated with the display of many elements. This
speeds up the process of generating the element. The user can construct the
application model out of collection of elements available in the system.

The term ‘primitive’ is often used in reference to graphic elements. The use of this term
to three-dimensional graphics construction. Accordingly, a primitive is a three –
dimensional graphics element such as a sphere, cube, or cylinder. In a three-
dimensional wire-frame models and solid modeling, primitives are used a building
blocks to construct the three-dimensional model of particular object of interest to user.

1.3.2 Transformations:

Transformations are used to change the image on the display screen and to reposition
the item in the data base. Transformations are applied to the graphic elements in order
to aid the user in constructing an application model. The transformations include
enlargement and reduction of the image by a process called scaling, repositioning of the
image or translation and rotation.

1.3.3 Display Control and Windowing Functions:

The function set provides the user with the ability to view the image from the desired
angle and at the desired magnification. In effect, it makes use of various transformations
to display the application model the way the user wants it shown. This is some times
referred to us windowing functions because the graphics screen is like a window being
used to observe the graphics model. The notion is that the window can be placed
wherever desired in order to look at the object being modeled.

Another aspect of display control is hidden line removal. In the most graphic system, the
image is made of lines used to represent a particular project. Hidden line removal is the
procedure by which the image is divided into is visible and invisible lines. In some
systems, the user must identify which lines are invisible so that they can be removed
from the image to make it more understandable. In other systems, the graphics package
is sufficiently sophisticated to remove the hidden lines remove from the picture
automatically.

1.3.4 Segmenting Functions:

The segmenting functions provide users with the capability to selectively replace,
delete, or otherwise modify portions of the image. The term segment refers to a
particular portion of the image which has been identified for the purposes of modifying it.
The segment may define a single element or logical grouping elements that can be
modified as a unit.

Storage –type CRT Tubes are unsuited to segmenting functions. To delete or modify a
portion of the image on a storage tube requires erasing entire pictures and redrawing it
with the changes incorporated. Raster Scan refresh tubes are ideally suited to
segmenting functions because the screen is automatically redrawn 30 or more times per
second. The image is regenerated each cycle from a display file, a file used for storage
that is part of hard ware in the raster scan CRT. The segment can readily defined as a
portion of the file would then be deleted or altered to execute the particular segmenting
functions.

1.3.5 User Input Functions

The user input functions constitute a critical set of functions in the graphic package
because they permit the operator to the enter commands or data to the system. The
entry is accomplished by means of operator input devices. The user input functions, be
written specifically for the particular compliment of input devices used on the system.
The extent to which the user input functions are well designed has to significant effect
on how friendly the system is to the user, that is how easy it is work on the system.

The input functions should be written to maximize the benefits of the interactive feature
of ICG. The software design compromise is to find optimum balance between providing
enough functions to conveniently cover all data entry situations without inundating the
user with so many commands that they cannot be remembered. One of the goals that
are sought after by software designers with little or no programming experience can
function effectively on the system.

1.4 Transformation

The transformation actually converts the geometry from one coordinate system to
theother coordinate system. By means of the transformation, the images can be
enlarged insize or reduced, rotated or moved on the screen. It plays a central role in
modelconstruction and viewing the image.

1.5 Two Dimensional (2D) Transformation and Three (3D) Transformation

During modeling of an object, it becomes necessary to transform the geometry


manytimes. The transformation actually converts the geometry from one coordinate
system toother coordinate system. The main types of 2D transformation which are often
come acrossare as follows.

• Translation.
• Scaling.
• Rotation.

1.5.1 Translation

It is one of the most important and easily understood transformations in


CAD.Translation is the movement of an object from one position to another position. It is
to bemoved to the co-ordinates of each comer point. Figure 2 shows a square object.
Let us nowconsider a point on the object, represented by P which is translated along x
and y axes byadded Tx, and Ty to a new position P.
Figure 2 Translation

The new co-ordinate after transformation is given by the following equation.

Pꞌ = [Xꞌ,Yꞌ]

Xꞌ = X+Tx

Yꞌ=Y+Ty

Pꞌ = [ X + T x , Y + T y ]

= [ X Y ] + [T x T y ]

In matrix form, we can write the above equation as

1 0 0

[Pꞌ] = [XꞌYꞌ1]=[X Y 1] 0 1 0

TxTy 1

Pꞌ =P.T

Where T = Translation matrix.

It is normally the operation used in the CAD system as MOVE command.

For 3 D Translation

xꞌ = x + tyꞌ yꞌ = y + tyꞌ zꞌ = z + tz
Pꞌ=Tt• P Tt = transformation matrix for translation

1.5.2 Scaling

Scaling is the transformation applied to change the scale of an entity. It is done


byincreasing the distance between points of the drawing. It means that it can be done
be doneby multiplying the coordinates of the drawing by an enlargement or reduction
factor calledscaling factor. The size of the entity altered by the application of scaling
factor is shown infigure 3.

Figure 3 Scaling

The new co-ordinates after scaling are given by the following equations

Pꞌ=[Xꞌ, Yꞌ] = [ Sxx X,SY x Y]

This equation can also represented in a matrix form as

[Pꞌ]= [S] [P]


where

Sx 0

[S] = = Scaling matrix

0 Sy

For example, figure 4 shows a triangle to be scaled before scaling. Figure shows the
same triangle after scaling. Here, all coordinates of the entity are multiplied by scaling
matrix. Therefore, it is enlarged two times the original one.

Figure 4 Scaling

For 3 D Scaling

xꞌ = x.Sx, yꞌ = y.Sy, zꞌ = z.Sz

Pꞌ=Ts• P
1.5.3 Rotation

Rotation is another important geometric transformation in CAD. Here, the drawing is


rotated about a fixed point. The final position and orientation of geometry is decided by
the angle of rotation ()and the base point about which the rotation is to be done. Figure
5 shows a rotation transformation of an object about origin 0. To develop the
transformation matrix, consider a point P as the object in XY plane, being rotated in
anticlockwise direction to the new position Pꞌ by an angle . The new position Pꞌ is given
by

Pꞌ = [Xꞌ, Yꞌ]

From Figure, the original position is specified by

X= r cos 
y= r sin

The new position Pꞌ is specified by

Xꞌ = r cos(+)
= r cos cos -r sin sin
=x cos-y sin
Y'= r sin ( + )
= r sin cos +r cos sin 
= x sin + y cos

It can be written in a matrix for as[Pꞌ]= [R] . [P]

Figure 5: Rotation
For 3 D Rotation

We must designate an axis of rotation and angle of rotation 

Let the point is rotated about Z axis through an angle 

 xꞌ = x cos − y sin

yꞌ = x sin + y cos

zꞌ =z

Pꞌ=Tr• P
Tr= Transformation matrix for rotation

1.6 CONCATENATION OR COMBINED TRANSFORMATION

Many times, it becomes necessary to combine the aforementioned transformations


inorder to achieve the required results. In such cases, the combined transformation
matrixcan be obtained by multiplying the respective transformation matrices. The
sequence oftransformations can be combined into a single transformation using the
concatenationprocess. For example, a line AB shown in figure 6 is to be rotated through
45° in clockwisedirection about point A. This process can be achieved by the following
three processes:

(a) Inverse translation of AB to A 1 B 1.


(b) A 1 B 1 is then rotated through an angle of 45° to A 2 B 2.
(c) The line A 2 B 2 is then translated to A 3 B 3.

The respective transformation matrices are given by


Figure 6: Combined Transformation

The same effect can be achieved using the concatenated matrix or overall
transformation given below.

SAQ 1:

(a) Explain the software configuration of the system with suitable Block diagram.

(b) Describe the function of Graphic Package.

(c) Explain the various2D Transformations with suitable Example.

(d) Explain the various3D Transformations with suitable Example.

1.7 SUMMARY

This unit covers the construction and working of the software configuration of the
system. The software configuration system which includes Graphic Package,
Application Programme, Application Data Base and Application Data base and also in
this unit describe the Function of graphic package which include, Generation of graphic
elements, Transformations, Display control and windowing functions, Segmenting
functions, User input functions. The various basic geometric 2D and 3D transformations
such as Translation, Scaling and Rotation are described in this unit.

You might also like