You are on page 1of 73

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

LECTURE 1
INTRODUCTION TO COMPUTER GRAPHICS
COMPUTER GRAPHICS SYSTEM
Computer Graphics is the language of Engineers, which provides a powerful tool for communication
among the team members associated with the design, manufacturing and sales of a product. It has now
become a mature technology. Computer graphics involves the creation, storage, manipulation and
interrogation of models and images of objects by means of a digital computer. The shaded and colored twodimensional, three-dimensional and higher-dimensional models are generated to bring the realism in
different objects such as natural scene, animation, flight simulation, navigation, commerce, advertising, etc.
Moreover, it is possible to create the virtual reality such as walk through building, highways, flying in the
sky using the graphics images. It has made a tremendous impact on every aspect of life such as
entertainment, automobile and aviation industries, business management, architecture, education, research,
engineering and medical areas, etc. In recent years, the computer graphics has now become a very powerful
tool for the development of high quality pictures rapidly, consistently and economically. Computer
graphics is an important tool in CAM wherein graphical data of the object, converted into machine data,
operates CNC machines for the production.
A modern CAD system works on the principle of Dynamic or Interactive Computer Graphics (ICG).
An observer interacts with images on displays in real-time using various types of graphics input devices
such as keyboard, mouse, digitizers, touch sensitive panels, electronic tablet, etc.; hence, commonly known
as ICG. The term interactive refers to the devices and systems that facilitate the man-machine graphics
interaction in a way, which is more convenient than the writing conventions such as computer programs.
For example, to draw a straight line between the two points, one has to input end coordinates and run the
software; however, in computer graphics, input devices directly generate the line.
Advantages and Applications of ICG

In ICG, the image generation is not confined to static images but dynamically varying pictures present
a better understanding during the simulation (flight simulation training to pilots, race car driving, etc.)
and animation (virtually jerk feelings by the pilots without collision of aircraft) process.

The use of dynamics is more effective when the operator can control the animation by adjusting the
speed, the portion of scene in view and other operating parameters.

The recent development in computer graphics is to add the audio feedback chips to make the simulated
environment even more realistic.

ICG permits extensive interaction between the human and computer. With increase in ability to
understand the data, computer graphics creates higher quality precise products, with greater
productivity and reduced analytical efforts and design costs.

Computer graphics is very popular in not only industries, business, education, medicine, fashion,
entertainment, etc. but in home also. It has made things easier to visualize. Creativeness is always
associated with the computer graphics.

It is always better to communicate with the bar charts, curves, surfaces, etc. than to present the
tabulated data; therefore, ICG is extremely useful tool in teaching, research and industries.

The geometric models developed with CAD using different stages of design utilize the computer
graphics for the display of drawing. During the process of improvement, the simulation process
evaluates the product. The interference between the various mating components is observed;
consequently, components are modified until it satisfies the need and specifications of the product.

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

The real-time (dynamic) behavior of product can be studied using the computer graphics. Thus, graphics
capability enhances the efficiency of the designer in carrying out various calculations; and provides the
graphical results for visualization/modification of the objects/models.
GRAPHICS SYSTEMS HARDWARE
The graphics capabilities of a computer system mainly depend on the hardware attached to it and on the
software supports available. The conventional alphanumeric key board together with the laser printer can
be used for the image generation; however, the quality of images is not sufficient for many CAD
applications and demands the high quality images. Therefore, additional hardware devices are required to
produce high quality graphics images. Graphics hardware consists of graphics input devices, graphics
display devices and graphics output devices. Based on the capabilities of graphics hardware, numerous
types of graphics hardware systems are in use. Broadly, there are two types of interaction between the user
and graphics system. They are:

Graphics system that models one-to-many interaction wherein more than one designer
team can interact with the host computer on time sharing basis

Graphics system that models one-to-one interaction wherein each designer is allowed one-to-one
interaction at a time

Based on host computer that drives the graphics system, there are three types of graphics hardware:
I.
II.
III.

Mainframe-based graphics systems


Minicomputer or workstation-based graphics systems
Microcomputer-based graphics systems

Mainframe-Based Graphics Systems


It uses a large mainframe computer on which the software is installed. The graphics system is networked to
many design stations with separate graphics display and graphics input devices for each station, leading to
one-to-many interface for the designer. Mainframe-based graphics systems can handle the intricate
assemblies of engineering components such as aircrafts, ships, rockets that require different groups of
designer. Fig. 2 shows the schematic of overall graphics system, which divides into the user environment
and system environment. The user has access to the design stations and peripheral devices. Fig 3 shows the
components of workstations, which consist of mainly graphics input devices such as mouse, joystick,
electronic tablet, digitizer, thumbwheel, etc.; and graphics display devices and graphics output devices such
as laser, inkjet, electrostatic, electrothermal types hardcopy printer/plotter, etc. The display screen shows
the graphics images.
User Environment

System Environment

Design Workstation

Mainframe
Computer

2
Computer Peripherals
Other
Peripherals

Printers

Plotters

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Figure 2: Mainframe-based graphics system

Graphics display
Display
Screen

Display
Processor

Graphics input devices


Electronic
Tablet
Digitizer
Touch Panels

Mainframe
Computer

Graphics output devices


Keyboard
Hard Copy
Printer/Plotte
r

Figure 3:

Design workstation

Minicomputer-Based Graphics Systems


These systems also employ one-to-many interfaces between the designer and computer. The development
of minicomputers over the microcomputers came into existence during 1970s with the development of LSI
(Large Scale Integrated) and VLSI (Very Large Scale Integrated) circuit technologies. The graphics
communication networked with minicomputer systems is less costly than the mainframe based systems.
During early 1970s, the minicomputers came into existence with 16-bit word length of limited
storage capacity. Digital Equipment Corporation (DEC) developed its first minicomputer. In late 1970s, the
superminicomputers such as VAX11/780, with 32-bit word length and virtual memory operating systems,
were invented. They were small and less costly compared to the mainframe graphics systems. Today, we
have high-speed superminicomputers with good accuracy and sufficient storage capacity. The hardware for
the minicomputer-based graphics system is similar to the mainframe system, as shown in Fig. 2. These
systems are smaller than the mainframe systems with limited numbers of display monitors and graphics
input devices, and host computer is mini. The speed of minicomputer is low as compared to the mainframe
systems but it is possible to increase it by using the additional devices such as array processors and other
special purpose hardware chips.
Microcomputer-Based Graphics Systems
Microcomputer based, popularly known as Personal Computer (PC), graphics systems provide one-to-one
interaction between the computer and designer. The IBM was pioneer in the field of micro based personal
computer. Nowadays, large number of CAD software (e.g., AutoCAD, ProEngineer, Solidworks, etc.) is
compatible for the PCs from 2D drafting/presentation to 3D geometric modeling applications.
Microcomputers have great impact on CAD/CAM systems. They are free from the problem of speed, size
and accuracy and presents complete design and manufacturing solution by providing an interface between
CAD and CAM. For most of the engineering applications, microcomputers of 32-bit or 64-bit word length
3

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

are available with very large memory (160 GB or more) and good clock rate speed (1 MHz to 3 MHz or
more).
In PC based systems, one computer system works as a server. The other units are networked to the
server as shown in Fig. 4. The peripherals are connected to the server and data is stored and retrieved from
the server through the software installed in the server.
Out of the three graphics systems, the workstation-based system has the advantages of distributed
computation and networking potential with low cost as compared with the mainframe graphics system.

Computer 1

Computer 2

Computer 3

Computer 4

Computer 5

Server

Other
Peripherals

Printers

Plotters

Computer Peripherals

Figure 4:

Microcomputer based graphics system

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

LECTURE 2
GRAPHICS INPUT DEVICES
Graphics input devices help designers to input information to graphics software running in the computer.
Thus, these are the tools with which the designer interacts with the graphics system and specify or generate
the graphical information such as coordinate data on the graphics display devices. The graphics software
manipulates the object as per the design requirements and generates the results on the graphics display
devices.
These devices are mostly independent of the types of CAD systems discussed in the previous
section. The software driver is required for the particular graphics input devices to interpret the information
(received from the input devices) and transform it to the output devices. The input devices were hardware
dependent before the existence of graphics standards. However, they have now become independent of the
graphics system after the acceptance of graphics standards such as GKS (Graphics Kernel System).
Generally, two types of information are required on the graphics display devices: textual and
graphical. Keyboards are normally suitable for the alphanumeric character input but keyboard arrow keys
(cursor direction) are inadequate for most of the graphics applications. Commonly used graphics input
devices are cursor control devices, digitizers, image scanners and speech oriented devices.
Cursor Control Devices
These graphics input devices specify locations of cursor on the screen, also called as locators. They include
thumbwheels, mouse, joysticks, tracker balls, light pens, electronic tablets and touch panels. Thumb
wheels, joysticks, tracker balls are the devices which controls the cursor without touching the screen by the
user, whereas in other devices the control of cursor occurs by directly touching the screen. All locating
devices, except joystick, are 2D graphics input devices.
Mouse
Mouse was invented in the late 1960s as a locator device, used to control cursor location on the screen.
Recently, it has become more popular due to its convenient use with icons, pop-up, and pull down menus.
The mouse generally comes with a varying number of buttons in which each button can be programmed for
different input values. The mouse provides better coordination between the eyes and hands of the designer
of CAD systems to feed the data. In general, there are three types of mice available:
Mechanical mouse: Mechanical mouse works on a smooth table/pad. It consists of two rollers
located on its base, one fixed perpendicular to the other, to record the mouse motion in X and Y
directions. When rollers roll on the table, its relative positions convert into the electronic signals and
position of cursor, associated with the positions of mouse rollers, changes on the screen. These
positions may be stored, when a mouse pushbutton is depressed, in the mouse registers accessible by
the application program.
Electrical mouse: Electrical mouse has a base plate, which generates a magnetic field in the mouse;
and circuitry in the mouse interprets its relative position on the base and corresponding position of
cursor on the screen.
Optical mouse: In optical mouse, movement over the mouse pad is measured by a light beam
modulation and optical encoding techniques. The light source is located at the bottom and mouse
5

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

must be in contact with the surface for the screen cursor to follow its movements. Pushbutton
mounted on top of the mouse is used to record the cursor position, and can be programmed to other
functions.
Thumb wheels
Thumb wheel device uses two thumb wheels, one to control horizontal position of the cursor, the other to
control vertical position. Sometimes, thumb wheels may be an integral part of the CRT (Cathode Ray
Tube) terminal or keyboard (Fig. 1a). The cursor displays on the screen as intersection of vertical and
horizontal lines in the form of cross hair.

Thumb wheel for


vertical movement
of cursor
Thumb wheel for
horizontal
movement
of cursor

(b)

(a)

Figure 1:

Cursor control devices (a) Thumb wheels (b) Joystick

Joysticks
Joysticks consist of a box with a vertical toggle stick that works by pushing backward and forward or to the
left or right causing the cursor to move in that direction. The stick is capable of moving towards the four
corners of the screen; therefore, allowing eight directional movements of the cursor. A joystick indicates
the direction, speed and duration of cursor motion, by the movement of the stick. A joystick is used as 3D
input device by attaching a rotating knob on the top of stick that can be used to enter the third axis value
(Fig. 5b). The stick can be twisted in the clockwise and anticlockwise directions. Due to an amplification
factor, a slight change in the stick position significantly changes the cursor position; hence not preferred
when accurate movement of cursor is desirable. However, due to quick response compared to the other
cursor control devices, joysticks are frequently used to control the velocity or force in simulation
applications such as in video games.
Tracker balls
A tracker ball is more precise compared to a joystick. The tracker ball, as shown in Fig. 2a, often describes
as an upside-down mechanical mouse. The ball rotates freely within its housing, with the help of users
6

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

palm, in the desired direction. The joystick and tracker ball were used in early radar and flight control
systems.
Light pen
Physically, it is very similar to a fountain pen in the method of holding but it works on the principle of
photoelectricity. The glowing property of image on the CRT screen is used for locating the cursor. The
light pen is not sensitive to the room light or prolonged intensity of image on the phosphor-coated screen. It
detects only sharp intensity of light of the graphics image displayed by using the photodiode,
phototransistor or some form of other optical sensor, when light pen is hold perpendicularly against the
refreshed type CRT displays. The location of pen tip on the graphics screen is recorded when the photocell
fixed at pen tip senses the light. After the amplification, light pen sends output of the photocell to computer
through the light pen interface (Fig. 2b). The light pen is not suitable for the storage tube type of displays
due to the lack of refresh cycle. The resolution of light pen is poor because the field of view of
photosensitive element is conical. The light pen did not gain much popularity among the users because of
the need to hold it perpendicular to the display screen for a longer time.

Pen lens
Housing

Tracker Ball

Figure 2:
Cursor control

Push button

devices (a)

Fibre optic
cable

Graphics
display screen

Tracker ball (b)


Light pen

(a)

(b)

Electronic tablets
A tablet is a flat surface of size in the range 6"x6" to 48"x72" or more that can detect the position of a
movable stylus in the users hand. Most tablets use an electronic sensing mechanism to determine the
position of stylus tip. A grid of wires on - inch apart is embedded on the tablet surface. The electrical
pulse applied in sequence to the grid wire, which in turn induces electrical signals, transmitted to the
computer before converting it into the electromagnetic signals (Fig. 3). The user writes on the graphics
surface of tablet and position of stylus ( x, y ) records into the computer, normally at the rate of 30 to 60
times per second. The strength of each pulse determines the position of stylus, and the cursor displayed on
computer screen is an echo of the position of the stylus on the tablet.

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

" " wire grid

Movable
stylus
Fibre optic cable

Figure 3:

Electronic tablet

Touch panels
Sophistication in technology has brought in human interaction through touch and voice. Touch panels are
frequently used to locate the cursor on the screen for transmitting the input information to the computer.
They allow displayed objects or graphics position just by touching the panel at that location. Nowadays,
Banks ATM (Automatic Taylor Machine), railway/flight enquiry, insurance office, control panel of CNC
machines, etc. are equipped with touch panels. Based on techniques used for transmitting the input
information to the computer, the touch panels are classified as:
Optical touch panel: Optical touch panel uses a set of infrared Light Emitting Diodes (LEDs) and light
detectors along the vertical and horizontal edges of the graphics screen. The LEDs operate at infrared
frequencies so the light is invisible to the users. Large numbers of LEDs are placed on the horizontal and
vertical edges of the screen, whereas light detectors are fixed on the opposite edges, to receive the infrared
light (Fig. 4a). When the panel is pressed (alternatively, the light receiving is interrupted), it records the
cursor position and transmits the command to computer for the processing.

Computer Graphics (MA-312)

** * * * * * * * * * * *
*
*
*
*
*
************

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Light
Detectors

Transparent
plates

Infrared Light

Infrared Light
Emitting Diodes
(LEDs)

Conducting
material coating

Resistive
material coating

(b) Electrical Touch Panel

(a) Optical Touch Panel

Reflected
Wave

Sound Wave
Generator

*
*
*
*
*
*

High Frequency
Emitted Sound Waves

************
(c) Acoustic Touch Panel

Figure 4:

Principles of touch panels

Electrical touch panel: Electrical touch panel consists of two transparent plates separated by a small
distance. One plate coated with a conducting material and other with a resistive material. A contact
between the two plates occurs when finger (Fig. 4b) touches the outer plate. Consequently, small electric
current flows between the two plates and a small voltage drop across the plate records the location of
cursor, and transmit the command to computer for the processing.
Acoustic touch panel: Acoustic touch panel uses high frequency sound waves generated in horizontal and
vertical directions across the glass plates. When the screen is touched, it causes part of the wave to reflect
towards the wave emitter (Fig. 4c). The time interval between the transmission of each wave and its
reflection back to the emitter calculates the cursor location on the touch panel.
Digitizers
A digitizer is a two-dimensional operator input device with high resolution and accuracy. They are
available in different sizes (42"x60" or more), and consists of a large smooth board and an electronic
tracking device (stylus), allowed to move over the drawing to follow the existing paths (Fig. 5). It is a
common technique for generating the (x, y) coordinates of any drawing; therefore, considered as electronic
drafting board. The electronic tracking device contains a button that records the (x, y) coordinates when
pressed. The stylus of the digitizer acts as a mouse. Thus, any drawing can be digitized or forwarded to the
computer, or to some other secondary storage device. Moreover, intermediate coordinates, between the
recorded points, be evaluated using the software at the desired level of accuracy. Typical accuracies of
digitizers vary from 0.005" to 0.05".
9

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

A-D Converter
Button

Vx

X-Register

Vy

Y-Register

Analog Voltage
Sheet

Figure 5:

Digitizer

The electronic images of drawing, graphics and black & white or color photographs can be stored for
computer processing with an image scanner. The image can be stored by passing the optical mechanism
over the graphics. Fig. 6 shows the fixed type and portable hand scanners. The gradation of gray-scale or
colored images are recorded and stored, in the digital form. They can be further manipulated by applying
the geometric transformations such as scaling, rotation, reflection, etc. The image is stored in array form,
which can be modified using different image processing techniques. Similar to the image scanners, video
digitizers, in which digitizer is connected to a video source, also convert the analog signals into digital
bitmap file. Some image scanners have the capability of optical character recognition for the common
fonts. Image scanners are available in different sizes (stationary and portable) and used for the conversion
of paper drawing into CAD database. Nowadays, portable type image scanners are frequently used in the
market to decode the bar codes tagged on the product.
Bar Code

Graphics Display
Fixed scanner

Hand scanner

Figure 6:

Image scanners

Speech Oriented Devices


In graphics applications, almost all the graphics input devices are visible whereas hands and eyes of user
are busy. The voice of user can be used as an input thereby giving some relief to the user, which in turn,
may increase the productivity of the designer. The accuracy of the input information can be improved by
10

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

using the voice of user.


Fig. 7 shows the Voice Recognition System. In this device, the speech input is fed to a Voice
Recognition Module (VRM), which generates a unique computer code corresponding to the particular
voice. The software recognizes the input from VRM in the same way as it receives from the keyboard.

Voice Input

Voice Recognition Module


(VRM)

Computer Code

Graphics Display

Figure 7: Voice recognition systems

11

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

LECTURE 3, 4 & 5
GRAPHICS DISPLAY DEVICES
CAD applications require the output devices for the graphics generated by the user. The graphics display is
most important component of a graphics system. The quality of image influences the perception of the
designer. A designer can communicate his ideas by adding, moving and deleting the 2D & 3D graphics
entities (output primitives) on the displays; thus, making it interactive, which is different from the passive
display devices such as television, where user cannot change the displayed object.
There are two types of graphics output devices: soft devices and hard devices. Graphics display
devices come under the category of soft devices whereas printers/plotters, which provide the hard copies of
graphics images are referred as graphics output devices. The graphics information displayed on the
computer screen is of temporary nature. In interactive computer graphics, it is required to change quickly
the images generated on the screen. The image presented on a CRT display can be dynamically modified,
erased or regenerated. On hardcopy device, images are created on the paper; therefore, dynamic
modification is not possible. However, hardcopy is used for the further activities.
There are various types of display technologies available to the user. The purpose of these devices is
to generate the desired digital visible image on the screen at high speeds. Broadly, the graphics displays are
classified into the devices based on Cathode Ray Tube (CRT), as well as Solid State Monitors also referred
as Flat Panel Display (FPD).
Cathode Ray Tube
This display device works on the principle of Cathode Ray Tube (CRT). It is the most popular and
dominating technology being widely used in refreshed and storage type of graphics display devices. The
monochromatic CRTs are essentially the same as those used in Black & White television sets.
Fig. 1 shows a schematic diagram of a typical CRT. The principle of CRT based on the generation of
high-speed electron beam that strikes on the phosphor-coated glass screen. The impact of electron beam
causes it to illuminate and produces a bright spot (or glow) on the screen at the desired location until next
time the beam is focused. The CRT consists of an electron gun forming cathode rays, optical focusing
device, deflection system and phosphor-coated glass screen. The electrons are generated by an electron gun
(i.e., cathode) in the form of showers. When a direct current, through a filament, heats metal cathode, the
electrons are boiled off from the cathode surface. A high vacuum in the cathode tube is maintained wherein,
a high positive voltage, using anode accelerator, accelerates free negatively charged particles. The electrons
are focused in the form of a beam by a focusing system. Suitable deflection voltages, applied to horizontal
and vertical deflection plates, causes the electron beam to impinge on the phosphor-coated glass screen at
the desired location. The illumination of phosphor dot takes place where the electron beam strikes, referred
as display.

12

Computer Graphics (MA-312)

Grid

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Free negatively
charged electron
Phosphor
coated screen

Vacuum
Bright spot
Hot cathode

Anode
accelerator

Focusing
arrangement

Vertical
deflection

Horizontal
deflection
CRT casing

Figure 1: Schematic diagram of Cathode Ray Tube (CRT)


Resolution
The intensity of bright spot is greatest at the centre, and decreases with Gaussian distribution out towards
the edges. The number of pixels that are available on the viewing surface of a display unit gives a
qualitative idea on the sharpness of images generated. This measure of pixels is referred as resolution. In
other words, the maximum number of points (dots) displayed without overlap on the CRT screen defines its
resolution. The resolution of CRT screen is dependent on the following parameters:
(i).
(ii).
(iii).
(iv).

Type of phosphor (material) dot


Intensity of dot to be displayed
Optical focusing arrangement
Deflection system of electron beam

There are two ways to specify the resolution of display surfaces:

Number of pixels in the horizontal direction and vertical direction, and diagonal size of the screen

Number of pixels per unit length in horizontal and the number of pixels per unit length in
vertical direction

In many CRT displays, the pixels may not be square and the number of pixels per unit length in
horizontal and vertical directions varies. Typically, the physical size of the monitor used in CAD
workstations has a range of about 640x480 pixels on a 14" diagonal monitor to 1280x1024 pixels on 19"
diagonal monitor. A very high resolution 4096x4096 on a 19" (or more) diagonal monitor is also available
for some specialized CAD applications. Thus, for the same numbers of pixels along the horizontal and
vertical directions, the physical lengths of horizontal and vertical lines may be different, leading to
distortion of the images. Such difference in physical lengths of lines in horizontal and vertical directions
results into aspect ratio, which is not equal to one. Aspect ratio of video monitor is the ratio of the number
of vertical pixels to the number of horizontal pixels required to produce equal length lines in vertical and
horizontal directions on the screen, respectively. It is ideal to have square pixels and an aspect ratio equal
to 1. An aspect ratio represents a vertical line plotted with 3 dots has same length as that of horizontal
line plotted with 4 dots. The present trend in computer graphics is towards the ideal situation of display
13

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

devices with an aspect ratio 1. The above discussion, based on the measurement of number of pixels on the
display surfaces, is termed as spatial resolution. This type of resolution gives one kind of measure, i.e., the
sharpness of images generated.
The number of colors or different levels of brightness of the images provide another measure of
quality of images. The number of memory bits associated with every pixel, called as tonal resolution,
measures this quality of display surfaces. In fact, the spatial and tonal resolution together gives a clear
indication about the quality of images generated on the display surfaces.
Image Generation Techniques
Based on the way of controlling the electron beam in CRT displays, there are two types of image
generation techniques: random scan and raster scan.
Random scan: Early displays in 1960s, based on the random scan technique, is referred as stroke writing,
vector display, line drawing, directed beam or calligraphic (refresh) display. Fig. 2a shows the random scan
display technique used in computer graphics. This technique uses the electron beam like a pencil to create a
line image connecting two given points on the CRT screen. Images generated using line drawing technique
is sharper as compared to the one with raster scan. The word random indicates that screen is not scanned in
a particular order. Each line segment is generated by directing the electron beam from one point to the
other. Each point is defined by x and y coordinates values. The images consisting of curves are generated
by approximating the small line segments of very short length, as shown in Fig. 2a.
CRT
screen

CRT screen

B
D
A
b
a

c d

C
e

horizontal
retrace

h
curve by straight
line segments

f g

(a) Random scan display

scan line

Vertical retrace

(b) Raster scan display

Figure 2: Image generation techniques


Raster scan: Raster scan display, based on Television technology, is the most common type of graphics
display. In this technique, a matrix of closely spaced dots is used to form the images. Compared to the
random display or line drawing device, it is referred as a point plotting device or digital scan. The computer
screen is divided into a large number of discrete phosphor dots, called pixel (picture element). These pixels
form the display screen. The number of pixels in a raster display may vary from 256x256 (over 65000 dots)
to 4096x4096 (over 16,000,000 or sixteen million pixels) or more. Each pixel can be made to glow with
different intensity giving rise to gray scale black/white images. On the other hand, color screens may
provide the pixels to have different colors as well as brightness. In raster displays, it is not possible to draw
a straight line from one pixel to another, except in special cases, when the line is completely horizontal,
vertical or 45o lines (for square pixels). All other lines show a stair-steps called jaggies (staircase
appearance). This can be easily observed on low-resolution display devices. Fig. 3a, b & c shows a general
14

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

line (AB), special lines (AB, AC & AD) and circle, respectively, visible on the screen during rasterization.
C

Pixel

B
Approximation
to line AB line
A

(a)

(b)

Approximation to
circle

(c)

Figure 3: Raster display (a) General line AB (b) Special line AB, AC and AD (c) Circle
In raster scan system, the electron beam scans the images from left to the right along a horizontal
line and energizes the pixels in that line (Fig. 3b). After sweeping one line, the electron beam moves to the
next line just below, forming horizontal retrace, and proceeds to a final point at the right bottom corner of
CRT screen. During this sweeping, the deflection voltages are adjusted in such a way that the entire
scanning of screen takes place. When final point reaches, the electron beam again goes back to the initial
point (left top corner of CRT screen) forming the vertical retrace. The entire scanning of screen repeats at a
rate of 30-60 scans per sec.
Graphics Display Devices for CAD Applications
The two approaches (random and raster scan) are used in majority of current computer graphics CRT
display. Based on these two image generation techniques, the three types of graphics display devices are:
I.
II.
III.

Refresh or Calligraphic display


Direct View Storage Tube (DVST)
Raster display (Digital TV)

First two display devices work on the principle of random scan technique known as vector display and the
last one works on the raster scan technique.
Refresh or calligraphic display
The refresh display technique utilizes the stroke writing approach for the generation of images on the CRT
screen. The word refresh refers to the regeneration of image many times on the display screen. The electron
15

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

beam strikes the phosphor dot and glow occurs for a few microseconds. Refresh rate in random scan system
depends on the number of lines required to generate the image. In order to view the continuous image, the
display screen must be refreshed at least at a rate of 30-60 times per second. If the image is complicated
(consists of many lines), the flickering (burning or shining unsteadily) of image occurs. High quality refresh
display can handle as high as 1,00,000 short line segments at 30-60 Hz; however, if the refresh rate exceeds
this limit, the phosphor coating of CRT screen could burn.
Fig. 4 shows a typical refresh display system. The refresh graphics display processor is often
called as a Display Processing Unit (DPU) or a graphics controller. The refresh buffer/display file stores the
image information consisting of 2D & 3D primitives, text, characters and other attributes of the image to be
drawn on the computer screen. For the display of image, the DPU processes through the set of commands
(program) and draw each line in sequence. The commands are interpreted and processed by the display
processor, and passed to the deflection system that controls the movement of electron beam. Any changes
made to the display file by the commands must synchronize with the display refresh cycle, which in turn,
prevents the display of an incomplete image. After processing all the commands, the display system cycles
back to the first line command.
Advantages
Following are the advantages of refresh displays over the raster scan systems:
(i).

Refresh (vector) display is characterized by its high resolution (4096x4096 pixels)


leading to high-quality image.

(ii).

Vector display generates smooth line drawings compared to the raster scan jagged line
system because the electron beam follows the line path.

(iii).

Selective erasure of a portion of image is possible due to the continuous refreshing


(redrawing) of display screen.

(iv).
(v).

Refresh display results into the image with high brightness and resolution.
The animation (viz. simulation of movements) of object is possible due to the fast
refreshing of display screen.
Display Processing Unit

Deflection
system
Text font

Input Devices
Display
File

Display
Processor

Phosphor
coating
x position
CRT

Input data
Peripheral
Devices

Display
commands

y position
Vector generator

Central Processing
Unit

Figure 4: Refresh display system


16

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Limitations
The refresh displays are designed for the line drawing applications. Due to the following limitations, the
devices based on random or refresh scan principles are not preferred for CAD systems:
(i).

It is a binary display device; hence, able to generate only two levels of color intensity.

(ii).

Refresh display cannot produce shaded colored images.

(iii).

It could display only the limited number of line segments on the screen without
flicker. The images involving curves may require large number of short line segments (alternatively,
substantial amount of data); therefore, the need of refreshing the image at 30-60 Hz rate places a
limit on the number of lines that can be displayed without flicker.

(iv).

The refresh display devices are expensive due to the need of refresh buffer memory
and fast display processor.

Direct view storage tube


Once the picture is generated, it is to be retained on the CRT phosphor coating. The duration of time that a
phosphor continues to glow, after the electron beam excites it, is termed as persistence. As the persistence
of CRT displays is very short, it is necessary to retain the images for more time. Consequently, in early
1960s, the Direct View Storage Tube (DVST) was come into existence as an alternative display device. A
storage tube physically retains the image generated until it is erased, whereas a refreshed tube continuously
regenerates the image at some frequency. Because of the elimination of refresh buffer, DVST was less
expensive as compared to the refresh type devices.
Similar to refresh display, DVST also employs the vector display technique for the image
generation. As the name indicates, the storage tube refers to the ability of retaining the image on CRT
screen by the special type of phosphor coating; thus, avoid the need of continuous refreshing. In DVST, the
refresh buffer/display file is completely removed (Fig. 16). Due to the absence of refresh buffer/display
file, the speed of electron beam is slow as compared to the refresh type displays. DVST stores the picture
information by activating the phosphor dots by the primary electron gun and keeps illuminating the dots by
the secondary electron gun. Therefore, flicker-free images, consisting of large number of short line
segments, can be obtained at high resolution on the CRT screen. As it is a vector drawing device, and has
high resolution, the images are sharp and have crisp edges. The images retain until erased. The resolution
of display with storage capacity of 4000 displayable points on 19" screen is possible.
Deflection
system
Text font
Input Devices

Phosphor storage
coating

Display Processor
Input
data

Display
commands

Peripheral Devices
Central Processing
Unit

x position
CRT
y position
Vector generator

17

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi


Figure 5: DVST display system

Limitations
Following are the limitations of DVSTs over the refresh displays:
(i).

Selective eraser of images is not possible. During the process of image generation, if a portion of
image is required to be erased (selective erasure) the entire screen must be cleared before redrawing
the modified image. This technology brought down the popularity of DVSTs in interactive computer
graphics.

(ii).

DVST cannot provide the vector images of different colors and simulation of movements
(animation).

(iii). Due to the absence of continuous refreshing, the DVST is not suitable for display devices with light
pen as an input device.
In spite of these limitations, the advantages of inexpensive price and high-resolution capability have
motivated the early CAD/CAM systems to adopt DVST as display devices.
Raster display
There is continuous demand of colors, shaded images and animation of designs in CAD/CAM applications.
This has motivated the hardware engineers to develop the graphics display devices based on the Television
Technology (TV). A TV uses analog signal generated by a video camera. During 1970s, raster scan CRT
screens were introduced which uses the digital signals generated by a computer. Raster display became
very popular due to its capability of presenting realistic display of colored, shaded and flicker-free graphics
images on the CRT screen.
The viewing surface of a raster display unit has a matrix of tiny picture elements, called pixels.
Every display has a finite number of pixels both in horizontal and vertical directions. The size of these
picture elements is the size of smallest dot that is to be displayed on the monitor. Every pixel on viewing
surface has a unique address by referring to its position in the matrix by specifying the row and the column.
It is possible to control the brightness or color of each of these pixels by a hardware known as display
controller. The sharpness of images generated with raster displays depend on the number of pixels available
on the viewing surface. This is termed as resolution of the viewing surface. The resolution of raster display
is as high as 4096x4096 pixels or more.
Monochrome display
Fig. 6 shows a single bit-plane monochrome (black/white) frame buffer for the raster CRT display. The
picture definition is stored in the frame buffer called as bitmap refresh buffer. There is one-to-one mapping
between the bitmap memory and corresponding pixel location on the screen. The refreshing of entire screen
takes place at a rate of 30-60 Hz, which is independent of the complexity of image and number of graphics
items displayed on the CRT screen. Therefore, there is no possibility of flickering with increased
complexity of the image, as in the case of refresh display.

18

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Frame buffer or bitmap

Raster CRT display


Pixel location
loaded to a register

DAC

Electron
beam

One-to-one mapping

Analog device

Digital device

Figure 6: Single bit-plane monochrome frame buffer raster CRT display


In black/white raster display, 1 bit per pixel memory is required corresponding to either on (bright)
or off (dark) position of pixel. The frame buffer is termed as a bitmap. For monochrome display device
(1bit/pixel, i.e., bright or dark phosphor dot) with 1024x1024 pixels density, 210 x 210 = 220 or 1,048,576
bits memory is required in a single-bit-plane. A digital to analog conversion between the frame buffer
(digital device) and CRT screen (analog device) must takes place before a pixel is visible on the screen. For
gray levels (gradation between the perfect black and perfect white color), additional bit-plane is employed
by the frame buffer. Fig. 7 shows N-bit-plane gray level frame buffer. The binary value (0 and 1) of pixel is
loaded in a register corresponding to each bit plane that gives an intensity level between 0 (dark) and 2 N-1
(full intensity) on the raster screen after the digital to analog conversion. Therefore, a total of 2 N intensity
levels are possible with N-bit-plane. For example, for N = 3, 23 or 8 intensity levels will be visible for each
pixel location, and frame buffer requires 3x1024x1024 = 3,145,728 memory bits or 3.14 MB memory for
each monochrome image on the raster screen.

Raster CRT display

Frame buffer or pixmap


N

=
=

Pixel location
loaded to N register

2N intensity
levels

0
0

0 0 1
2N DAC

N=3

Electron
beam

Analog device

Digital device

Figure 7: N-bit-plane monochrome gray level frame buffer raster CRT display
Color display
The two levels of image (black/white) are not satisfactory to various ICG applications. For color and
intensity variations, additional bits are required. Practically, continuous gray shades for the monochrome
19

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

display require a memory of 8 bits/pixel and it increases up to 24 bits/pixel (8-bits for each Red, Blue and
Green primary colors) for colored images on raster CRT displays. This means that 24 bits/pixel, i.e., 2 24
(viz., 16,777,216) different colors would be available on a particular pixel location. For multiple bits/pixel,
the frame buffer is termed as pixmap. For colored images, a display system with 24 bits/pixel and a screen
resolution of 1024x1024 1x106 pixels requires approximately 1x106x24, i.e., 24 MB memory of storage
in the frame buffer.
A further increase in the intensity levels of colored images is possible by using the lookup table. The
number of intensity levels available at one time in frame buffer or pixmap is used as an index in the lookup
table. Each intensity level in the lookup table is W bits wide (W>N). Thus, 2 N different intensity levels are
always available at the pixel location on CRT display, out of total 2 W intensity levels. This would mean that
when N = 3 and W = 4, a total of 23 or 8 different intensities are available at a time out of 2 4 or 16 intensity
levels. Fig. 8 shows a 3-bit-plane gray level frame buffer with 4-bits wide lookup table.
4 bits wide
lookup table
7

Frame buffer or pixmap

3
=
=

Raster CRT display

N Register
0 1 0 0

1 0 0

2N intensity
levels

1
0

2W DAC
3

2 entries
Electron
beam

Digital device

Analog device

Figure 8: A 3-bit-plane monochrome gray level frame buffer with 4 bits wide lookup table
Color Frame Buffer
A simple color frame buffer consists of 3-bit-plane corresponding to Red, Blue and Green primary colors.
Each bit plane controls the individual electron beam as shown in Fig. 20. Table 1 gives eight different
colors at the pixel location (in frame buffer) on raster CRT display obtained by various combinations of the
three primary colors.

20

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Frame buffer or bit plane

Raster CRT display

Red
Blue
Green

Electron
beams

Registers

1
0

8 Colours

DAC

Red

DAC

Blue

DAC

Green

Analog device
Digital device

Figure 9: Simple color frame buffer (Single-bit-plane for each primary color)

Table 1: Simple 3-bit-plane color combinations


Colors
Black
Red
Blue
Green
Yellow
Cyan
Magenta
White

Red electron
beam
0
1
0
0
1
0
1
1

Blue electron
beam
0
0
1
0
0
1
1
1

Green electron
beam
0
0
0
1
1
1
0
1

1: bright; 0: dark
Full color frame buffer generates 16.77 million colors on CRT raster display. Each primary color
uses multiple bit planes instead of single-bit-plane. For example, 8-bit-plane for each color, i.e., 24-bitplane frame buffer as shown in Fig. 10, generates 28 or 256 intensity levels for each red, blue and green
primary color. These intensities are further combined into (2 8)3 or 16,777,216 or 16.77 million possible
color shades, known as full color frame buffer.

21

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

8 Frame buffer or pixmap


Red
Red
0

Blue
Blue

1 1 0 0 0 1 1 0
Registers

Red beam

8 bit DAC
Raster CRT
display

Green
Green

0 1 0 1 0 1 0 1
Registers

8 bit DAC

Blue beam

0
0

Green beam

0 1 1 0 0 1 1 0
Registers

8 bit DAC

Analog
device

Digital device

Figure 11: 24-bit-plane full color frame buffer (8-bit-plane for each color)
The color shades can be improved by using the lookup tables. For N-bit-plane per color with W bits
wide color lookup tables (three lookup tables for each primary color) gives (2 3)N colors from a palette of
(23)W possible colors available at a time. For example, N = 8 and W = 10 gives (2 3)8 or 16,777,216 colors
from a palette of (23)10 or 1,073,741,824 colors comprising a real world image.

Color CRT Monitors


The quality of colored images and animated pictures depends on the hardware used. For excellent quality
images, refresh display and DVST are better, whereas color capability of refresh display is moderate
compared to the raster display devices. Raster display can handle a large amount of data; however, its
animation capability is moderate. The mixing of colored light emitted from different phosphor dots results
into the colored images on CRT monitors. There are two basic techniques for the color displays on CRT
screen:
Beam penetration method
This method utilizes the random scan technique for displaying colored images on the CRT displays. Fig. 12
shows the inner side of CRT screen, coated with two layers of phosphor dots. The color of emitted light
depends on the depth of penetration of electron beam on the phosphor coating. Slow moving electron beam
energizes the outer red layer of coating, emits red light; whereas very fast moving electrons penetrate
through the red coating and energizes the inner green phosphor coating, emits green light. At intermediate
values of electron speeds, red and green light combines and emits two additional colors orange and yellow.
Beam penetration method is an inexpensive way to produce images in random scan CRT display devices
but only four colors of moderate quality are possible.

22

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

CRT casing
Slow electron speed
: Red colour
Fast electron speed
: Green colour
Moderate electron speed : Orange and Yellow colour

Electron beam

Red Phosphor
coating
Green Phosphor
coating

Figure 12: Principle of beam penetration method for color display


Shadow mask method
Shadow mask method utilizes the raster scan technique for displaying colored images on the CRT displays.
A wide range of colors can be produced with shadow mask method. A shadow mask color CRT display has
three primary phosphor colored dots (Red, Blue and Green) compared to single phosphor dot, used in beam
penetration method. The three electron beams, one for each colored phosphor dots, energize these dots. In
between the electron guns and phosphor-coated screen, one perforated shadow mask grid is placed. At each
pixel location, one dot emits red light, another emits blue and third emits green light. When these three
colored lights of different intensities (obtained from 8-bit-plane) combine, they produce wide range of
colors as high as 16.77 million colors; however, the range of actual colors depends on the amount of
excitation. The shadow mask method could be cost effective if three electron beams are set to either on or
off, limiting to the display of only eight colors.
There are two types of dots arrangement. Fig. 13 shows delta-delta shadow mask method. This
pattern of colored dots is termed as triad. The shadow mask contains series of holes, which aligns the Red,
Blue and Green electron beams to the corresponding red, blue and green dots. When three electron beams
activate the corresponding dots, the combined intensities of emitted light from these dots produce a small
color spot on the screen. The other dots arrangement for the three electron beams is an inline arrangement
in which the electron guns and RGB dots aligned on the same scan line (Fig. 14). This arrangement of dots
is easier as compared to the delta pattern; therefore, preferred in high-resolution colored CRTs.

23

Computer Graphics (MA-312)

Electron beams
Blue

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Red

Perforated shadow
metal mask

Green

CRT display
Electron beam
convergence

B G
R

Phosphor dots triangle


(Triad)

Figure 13: Delta-Delta shadow mask CRT

Red

Electron beams

Perforated
shadow metal
mask

Green
Blue

CRT display

Electron beam
convergence
R

In-line Phosphor dots

Figure 14: Inline shadow mask CRT

2D GEOMETRIC TRANSFORMATIONS
A set of operations on coordinate system (alternatively, object) that results in a change in the position (or
location) of the coordinate system is known as geometric transformation.
Geometric transformations that describe the rigid body transformations include translation, rotation,
scaling and reflection. In shear, the distortion causes sliding of the internal layers over the others. These
transformations are applied directly to the parametric representations of objects such as points, curves,
surfaces and solids.
24

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

A point is a basic entity for the object representation. For example, a line is represented by its
endpoints. Similarly, curves, surfaces and solids are the collection of several points. The geometric
transformation of a given point P( x, y, z ) of a geometric model to the corresponding new point

PT ( xT , yT , zT ) is given as
PT f (P, transformation parameters)
Thus, transformed coordinates PT is a function of original coordinates P and the motion parameters
corresponding to the given geometric transformation. However, if an object consists of several points, all
points of the object must transform corresponding to the given geometric transformation.

Translation: Whenever an entity of geometric model remains parallel to its initial positions, the rigid body
transformation of the model is termed as translation. Alternatively, translation is a rigid body
transformation that moves the images without deformation. Translation allows the repositioning of an
object from one place to another along a straight line; therefore, every point in the model moves an equal
distance in a given direction. Translation of an object is obtained by adding the translational distances t x
and t y to the original coordinate positions ( x, y ) of the model. Thus, a point P( x, y ) is transformed to

PT ( xT , yT ) by adding translational distances t x and t y as


xT x t x , y T y t y

1 0 t x
[Tt ] 0 1 t y
0 0 1
Rotation: A two-dimensional rotation can be defined by repositioning the object on a circular path in the
xy plane. To achieve the rotation, the following information is required:

Rotation point or pivot point ( x c , y c ) , i.e., reference point about which the object is to be rotated

Rotation angle and direction of rotation (clockwise or counterclockwise)

Further, a convention of choosing signs of angles of rotations must be established. In this book, the righthand convention is chosen. Therefore, counter clockwise (ccw) rotation about the pivot point, when viewed
from a point on the positive portion of the axis towards the origin, is termed as positive and vice-versa.
Rotations are achieved about an axis perpendicular to the xy plane that passes through the pivot point
other than the origin.
Rotation about the origin
Rotating a point through a given angle about the coordinate axes is sometimes referred to as rotation about
the origin. Let the initial point P( x, y ) is at a distance r from the origin and makes an angle with the

x -axis. The point P( x, y ) is rotated by an angle through the counterclockwise direction in the xy plane
(alternatively, about the z -axis) about the origin to new coordinate position PT ( xT , yT ) , as shown in Fig.
1a. The angular and coordinate relationships of the transformed rotated coordinate PT ( xT , yT ) is expressed
as
25

Computer Graphics (MA-312)

and

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

x r. cos , y r. sin

(1)

xT r. cos( ) r. cos. cos r. sin . sin

(2)

yT r. sin( ) r. sin . cos r. cos. sin

(3)

Thus, eqn. (2) gives xT x. cos y. sin and yT x. sin y. cos

(4)
PT (xT, yT)

r
PT (xT, yT)

P(x, y)

z
( xc , yc ) z

P(x, y)

(0,0)

z
z

(0,0)

Fig. 1: Rotation of a point (a) about origin (b) about pivot


Rotation about the pivot
Let the initial point P( x, y ) is at a distance r from the pivot point ( xc , yc ) and makes an angle with the

x -axis. The point P( x, y ) is rotated by an angle through the counterclockwise direction about the pivot
point ( xc , yc ) in the xy -plane to the new coordinate position PT ( xT , yT ) , as shown in Fig. 1b. Using
geometry and trigonometric relations, the angular and coordinate relationships of the transformed rotated
coordinates PT ( xT , yT ) can be expressed as

xT x c ( x x c ). cos ( y y c ). sin

(5)

and

yT y c ( x x c ). sin ( y y c ). cos

(6)

where

x x c r. cos and y y c r. sin

(7)

cos
Counter clockwise rotation (ccw) in the xy plane, [Tr ] sin
0

Clockwise rotation (cw) in the xy plane,

sin
cos
0

cos
[Tr ] sin
0

sin
cos
0

0
0
1
0
0
1

Scaling: Scaling is used to change, increase or decrease, the size of an object. The scaling transformation
can be applied whenever enlargement/magnification or reduction in size of an object within the image is
required. Scaling can be done either in x or y direction or in both the directions simultaneously. Scaling
factors can be specified as S x and S y along x and y coordinate axes, respectively. For polygons, scaling
is performed by multiplying the coordinate values ( x, y ) of each vertex by the scaling factors S x and S y ,
26

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

respectively. Thus, transformed coordinates will be

xT S x .x , y T S y . y

(7)

Scaling factors are always positive (negative factor produces reflection of the model). If scaling
factors are less than unity, the reduction in size of the object occurs, i.e., the geometric model is
compressed. However, if scaling factors are more than unity, the geometric model is stretched and
enlargement or magnification in size occurs. Whenever scaling transformation is applied, one point remains
the same and this is the fixed point of the scaling transformation. There are two types of scaling:
Uniform Scaling: If S x S y , scaling factors are equal; alternatively, the model is uniformly enlarged or
reduced, in both the directions and results into changes in the size only and not in the shape. Thus, the
shape of the model retains. Fig. 2a shows the uniform scaling of a lamina. This operation is equivalent to
zoom command in CAD software.
Differential Scaling: If S x S y , scaling factors are different, the model distorts due to non-uniform
enlargement/reduction in coordinate directions. Differential scaling changes both size and shape of the
geometric model. Differential scaling is only of mathematical interest because it is seldom used in practical
applications. Fig. 2b shows the differential scaling of a lamina.

y
18

18
Sx = 2
Sy = 2

16
(13, 14 )

14

14

12

12

10

10

(13, 10.5)

(6.5, 7)

(10,6 )

(6.5, 7)

( 16, 6 )

4
( 8, 3 )

(5, 3 )

2
0

Sx = 2
Sy = 1.5

16

(a)

12

14

16

18

( 8, 3 )

(5, 3 )

2
10

(16, 4.5)

(10,4.5)

0
0

10

12

14

16

18

(b)

Fig. 2: Scaling of a lamina about the origin (a) uniform scaling (b) differential scaling
Polygon scaling is obtained by applying transformations to each vertex, and polygon redraws with
the new transformed coordinates of its vertices. Other objects are scaled by applying the scaling
transformation equations to the parameters defining 2D objects. For example, an ellipse is resized by
scaling the semi-major and semi-minor axes and redrawing the ellipse about the specified centre
coordinates. Similarly, uniform scaling of a circle occurs by simply adjusting its radius, and circle redraws
with the specified radius using the transformed coordinates.

27

Computer Graphics (MA-312)

S x
[ S ] 0
0

0
Sy
0

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

0
0
1

Reflection: A reflection (or mirroring) is a geometric transformation that produces mirror image of an
object. Reflection transformation is used for constructing the symmetric models. If a model is symmetric
with respect to a plane then one-half of the geometry is created at first, followed by the reflection
transformation to generate the full model. A geometric model may be reflected through a plane, a line, or a
point in space. The mirror image of 2D reflection is generated with respect to an axis of reflection.
Reflection of a geometric model is achieved by rotating the object by 180o about the reflection axis. The
axis of reflection may be either in the xy plane or in perpendicular to the xy plane. When reflection axis is
in xy plane, the rotation path about this axis is in a plane perpendicular to the xy plane. However, the
rotation path is in xy plane if reflection axes are perpendicular to the xy plane. There are different types of
two-dimensional reflections:
Reflection of a point about x-axis: It represents the reflection of a point about the line y 0 . Reflection
transformation keeps x coordinate same, but y value reverses in sign. Thus, the transformed coordinates
of a point P( x, y) about the x -axis (Fig. 3) is given as

xT x , y T y

(8)

1 0 0
About the x-axis, [ R x ] 0 1 0
0 0 1
Reflection of a point about y-axis: It represents the reflection of a point about the line x 0 . Reflection
transformation keeps y coordinate same, but x value reverses in sign. Thus, the transformed coordinates
of a point P( x, y ) about the y -axis (Fig. 3) is given as

xT x , y T y
About the y-axis,

(9)

1 0 0
[ R y ] 0 1 0
0 0 1

Reflection of a point about the origin: The transformed coordinates of a point P( x, y ) about the origin is
given as (Fig. 3)

xT x , y T y

(10)

28

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

PT ( x, y)

Reflection
about y-axis

P( x, y)

Reflection
about origin

PT ( x, y )

Reflection

about x-axis
PT ( x, y)

Fig.3: Reflection of a point about the coordinate axes and the origin

About the origin,

1 0 0
[R] 0 1 0
0 0 1

Reflection of a point about the line y = x: The transformed coordinates of a point P( x, y ) about the line

y x is given as (Fig. 4)
xT y , y T x

(11)

Fig. 4 shows the reflections of 2D objects about the coordinate axes and the line y x .
About the line y x ,

0 1 0
[R] 1 0 0
0 0 1

29

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

y
Reflection
about y-axis

Original
image
Original
image

x
Original
image

Reflection
about x-axis

Reflection about
line y x

4.4.2
Shear
The geometric transformation that distorts shape of an object such that the transformed shape appears as if
the object were composed of internal layers that slide over each other, is termed as shear. In other words,
the sliding of internal layers of an object over the other layers to distort its shape is termed as shear
transformation. Shear is the controlled distortion of an object model in x and y coordinates. Two
common shear transformations are those in which x coordinate depends on y coordinate and vice-versa.
Fig. 5 shows two such shear transformations. The transformed coordinates of a point P( x, y ) , when shear
along the x -direction takes place, is given as

xT x Sh x . y ,

yT y

(12)

Moreover, shear along the y -direction will be


y T y Sh y .x , xT x

(13)

30

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

y
14

14

12

12

10

(2, 9 )

y
Shx = 0.2

(8 , 13 )

12

10

(8, 9 )

Shy = 0.5

14

(3 .8 ,9 )

10

(9.8, 9)

(2 , 9 )

(8 , 8 )

4
(2, 4 )

(2 , 4 )

(8, 4 )

(8, 4 )

(2 , 4)

2
0
0

10

12

0
0

(a)

(b)

10

12

0
0

10

12

(c)

Fig. 5

Along the x-axis,

1 Sh x
[ Sh x ] 0 1
0 0

Along the y-axis,

1
[ Sh y ] Sh y
0

1
Along the x and y-axes, [ Sh] Sh y
0

0
0
1

0 0
1 0
0 1

Sh x
1
0

0
0
1

Scaling and Shear: The general 3x3 transformation matrix producing a combination of shear and scaling, is
expressed as

Sx
[T ] Sh y
0

Sh x
Sy
0

0
0
1

In general, transformations with a determinant identically equal to +1 gives pure rotations. However,
if the determinant of matrix is identically -1 then the transformation produces pure reflection. If two pure
reflection transformations applied successively about the lines passing through origin, it results into a pure
rotation.

Problem 1: Determine the transformed coordinates for the following geometric transformations:
31

Computer Graphics (MA-312)


(i)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Triangular lamina having vertices A(4,2) , B(2,2) and C (6,2) is subjected to the translation
with translational distances t x 5 and t y 7 along the coordinate axes.
Let A( x1 , y1 ,1) , B( x 2 , y 2 ,1) and C ( x3 , y 3 ,1) are the original homogeneous coordinates and

AT ( xT 1 , yT 1 ,1) , BT ( xT 2 , yT 2 ,1) and CT ( xT 3 , yT 3 ,1) , respectively, are the transformed homogeneous


coordinates of a triangular lamina. Thus, transformed translated coordinates may be calculated as

xT 1

yT 1
1

xT 2
yT 2
1

xT 3 1 0 t x x1

y T 3 0 1 t y . y1

1
0 0 1 1

x2
y2
1

x 3 1 0 5 4 2
6 9 7 11

y 3 0 1 7.2 2 2 9 5 5

1
1
0 0 1 1 1
1 1 1

Thus, the transformed coordinates is given as

AT (9, 9) , BT (7, 5) , CT (11, 5)


Fig. 6a shows the original and transformed positions of the lamina after the translation.
(ii)

Triangular lamina having vertices A(4,2) , B(2,2) and C (6,2) is rotated through 90o in
counterclockwise direction about the origin.
The transformed coordinates after the rotation may be calculated as

xT 1

yT 1
1

xT 2
yT 2
1

xT 3 cos 90 0

y T 3 sin 90 0

1
0

sin 90 0
cos 90 0
0

0 x1

0. y1
1
1

x2
y2
1

x3

y3
1

6 2 2 2
0 1 0 4 2

1 0 0.2 2 2 4 2 6
0 0 1 1 1
1 1 1 1
Thus, the transformed coordinates is given as

AT (2, 4) , BT (2, 2) , CT (2, 6)


Fig. 6b shows the original and transformed positions of the lamina after the rotation.

32

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

y, yT

y, yT

12

12

10

10
AT

2
6

-2
-2

AT

2
-4

CT

BT

CT

6
2

8
6

10
0

12

14

-4

x, xT

-2
-2

-4

BT
2
6
B

6
2

8
6

10
0

12

14

x, xT

-4

(a)

(b)

Fig. 6
(iii)

Triangular lamina having vertices A(4, 2) , B(4, 4) and C (2, 4) is subjected to the uniform scaling
with scaling factors S x S y 2 and nonuniform (differential) scaling with scaling factors S x 3
and S y 0.5 , both about the origin.
After the uniform scaling, the transformed coordinates of the lamina are

xT 1

yT 1
1

xT 2
yT 2
1

xT 3 S x

y T 3 0
1 0

0
Sy
0

0 x1

0. y1
1 1

x2
y2
1

x 3 2 0 0 4 4 2 8 8 4

y 3 0 2 0.2 4 4 4 8 8
1 0 0 1 1 1 1 1 1 1

Thus, vertices A(4, 2) , B(4, 4) and C (2, 4) are transformed to AT (8, 4) , BT (8, 8) , CT (4, 8) ,
respectively.
The transformed coordinates after the nonuniform scaling may be calculated as

xT 1

yT 1
1

xT 2
yT 2
1

xT 3 S x

y T 3 0
1
0

0
Sy
0

0 x1

0. y1
1
1

x2
y2
1

x 3 3 0 0 4 4 2 12 12 6

y 3 0 0.5 0.2 4 4 1 2 2

1
0 0 1 1 1 1 1 1 1

Thus, the vertices A(4, 2) , B(4, 4) and C (2, 4) are transformed to DT (12, 1) , ET (12, 2) , FT (6, 2) ,
respectively.
Fig. 7a shows the original and transformed positions of the lamina after the uniform and nonuniform
scaling.
(iv)

Triangular lamina having vertices A(8, 1) , B(5, 2) and C (7, 4) is subjected to two individual
reflections (a) about the x-axis, and (b) about the line y = x.
(a) The transformed coordinates after reflection about the x -axis is calculated as
33

Computer Graphics (MA-312)

xT 1

yT 1
1

xT 2
yT 2
1

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

xT 3 1 0 0 x1

y T 3 0 1 0. y1

1
0 0 1 1

x 3 1 0 0 8 5 7 8
5
7

y 3 0 1 0.1 2 4 1 2 4


1
1
1
0 0 1 1 1 1 1

x2
y2
1

Thus, the vertices A(8, 1) , B(5, 2) and C (7, 4) are transformed to AT (8, - 1) , BT (5, - 2) and

CT (7, - 4) , respectively.
(b) The transformed coordinates after reflection about the line y x is calculated as

xT 1

yT 1
1

xT 2
yT 2
1

xT 3 0 1 0 x1

y T 3 1 0 0. y1

1
0 0 1 1

x2
y2
1

x 3 0 1 0 8 5 7 1 2 4

y 3 1 0 0.1 2 4 8 5 7

1
0 0 1 1 1 1 1 1 1

Thus, the vertices A(8, 1) , B(5, 2) and C (7, 4) are transformed to DT (1, 8) , ET (2, 5) and FT (4, 7) ,
respectively.
Fig. 7b shows the original and transformed positions of the lamina after reflections about the x -axis
as well as about the line y x .

y, yT

y, yT

12

12

10

10
BT

CT

6
4

-2
-2

y x line

FT

6
C

B
4

AT

2
-4

DT

2
6

FT

6
2

ET

ET

B
A

DT
8
6

10
0

12

14

x, xT

-4

-2
-2

-4

2
6

4
BT

6
2

-4

(a)

8 10
6 AT 0

12

14

x, xT

CT

(b)

Fig. 7
(v)

Lamina having vertices A(9, 4) , B(6, 4) and C (6, 8) is subjected to shear along the coordinate
axes with shear factors Sh x 1 / 2 and Sh y 1 / 3 about the origin.
The transformed coordinates after shear along the coordinate axes is calculated as
34

Computer Graphics (MA-312)

xT 1

yT 1
1

xT 2
yT 2
1

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

xT 3 1

y T 3 Sh y
1
0

Sh x
1
0

0 x1

0. y1
1
1

x2
y2
1

x 3 1 1 / 2 0 9 6 6 11 8 10

y 3 1 / 3 1 0.4 4 8 7 6 10

1
0 1
0
1 1 1 1 1 1

Thus, the vertices A(9, 4) , B(6, 4) and C (6, 8) are transformed to AT (11, 7) , BT (8, 6) and

CT (10, 10) , respectively. Fig. 8a shows the original and transformed positions of the lamina after
the shear.
(vi)

Triangular lamina having vertices A(9, 2) , B(6, 2) and C (6, 4) is subjected to shear along the
coordinate axes with shear factors Sh x 1 / 2 , Sh y 1 / 3 , and scaling with scaling factors

S x 1 / 3 , S y 2 , both about the origin.


The transformed coordinates after combined shear and scaling is calculated as

xT 1

yT 1
1

xT 2
yT 2
1

xT 3 S x

y T 3 Sh y
1 0

Sh x
Sy
0

0 x1

0. y1
1 1

x2
y2
1

x 3 1 / 3 1 / 2 0 9 6 6 4 3 4

y 3 1 / 3 2 0.2 2 4 7 6 10
1 0
0 1 1 1 1 1 1 1

Thus, vertices A(9, 2) , B(6, 2) and C (6, 4) are transformed to AT (4, 7) , BT (3, 6) and CT (4, 10) ,
respectively. Fig. 8b shows the original and transformed positions of the lamina after the combined
shear and scaling transformations.
y, yT

y, yT

12

12
CT

CT
10

10
C

8
AT

AT
6

BT
B

2
-4

-2
-2

2
6

6
2

8
6

10
0

12

14

x, xT

-4

-2
-2

-4

BT

2
6

A
6
2

8
6

10
0

12

14

x, xT

-4

(a)

(b)

Fig. 8
COMPOSITE TRANSFORMATIONS AND CONCATENATION
When there is arbitrary sequence of rotation, translation and scaling transformations, parallel lines remain
parallel but angles and lengths may change. Such transformations are termed as affine transformations. The
35

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

shape and position of 2D objects can be controlled by performing the matrix operations on the position
vectors defining vertices of the model such as lamina/surface. In CAD, desired orientations may require
more than one geometric transformation. Most often, it becomes necessary to combine the aforementioned
individual transformations in order to achieve the desired results. Any sequence of transformation is termed
as composite (or combined) transformations. This can be achieved by multiplying all the transformation
matrices in sequence (or order) and overall transformation is represented by a single matrix. This is also
termed as concatenation of transformations.
Since matrix multiplication is non-commutative ( A.B B. A) , the order of applications of
transformation is important; therefore, care must be taken to ensure the order of matrix multiplication in the
same way as that of the transformations. For some special cases, the multiplication of transformation
matrices is commutative such as two successive transformations of the same kind are commutative.
Another commutative pair of transformations may be uniform scaling and rotation operations. The
associative property of matrix ( A.B.C ( A.B).C A.(B.C )) does not impose any restriction for the
evaluation of composite matrix in either order. This can be verified using a suitable example.
If numbers of geometric transformations are taking place successively, e.g., operation sequence is
Rotation [Tr ] Scaling [S ] Reflection [R] Translation [Tt ]
Then, overall transformation matrix is expressed as

[T ] [Tt ].[R].[S ].[Tr ]

(4.38)

Moreover, matrix equation for the transformation of a point with position vector {X } is expressed as

{ X T } [T ].{X }

(4.39)

If numbers of vertices are connected to form a 2D object then matrix equation for the composite (or
combined) geometric transformation (eqn. 4.39) is expressed as

xT 1

yT 1
1

xT 2
yT 2
1

xT 3
yT 3
1



1 1

xTn
x1

y Tn [T ]. y1
1
1

x2
y2
1

x3
y3
1



1 1

xn

yn
1

(4.40)

Problem 2: Find the transformed position of a line with endpoints A(3, 5) and B(10, 5) when it is
translated by 2 units in the x -direction and then rotated by 30o in clockwise direction about the z -axis.
Solution: The overall transformation matrix will be the product of three matrices corresponding to the two
geometric transformations taken in an order:
(i).
Translate line by 2 units in the x -direction
(ii).

Rotate the line by 30o in clockwise direction about the z -axis

Translation matrix,

1 0 2
[Tt ] 0 1 0
0 0 1

36

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

cos(30 o ) sin( 30 o ) 0 0.866 0.5 0

[Tr ] sin( 30 o ) cos(30 o ) 0 0.5 0.866 0

0
0
1 0
0
1

Rotation matrix,

The resulting concatenated matrix is expressed as

[T ] [Tr ].[Tt ]

0.866 0.5 0 1 0 2 0.866 0.5 1.732


[T ] 0.5 0.866 0.0 1 0 0.5 0.866 1
0
0
1 0 0 1 0
0
1
Hence, transformed position vectors of line AB is calculated as

xT 1

yT 1
1

xT 2 0.866 0.5 1.732 3 10 6.83 12.89

y T 2 0.5 0.866 1 .5 5 1.83 1.67


1 0
0
1 1 1 1
1

Thus, transformed coordinates of endpoints of line AB are

AT (6.83, 1.83) , BT (12.89, - 1.67)


Fig. 9 shows the original and transformed position of line AB .
y, yT

10
8
6
4

A (3, 5 )

2
0

B (10, 5 )

AT (6. 83, 1.83)

10

12

14

16

18

20

x, xT

BT (12.89, -1.67)

-2
-4
-6

Fig. 9
Problem 3: Find the transformed position of a triangle having vertices A(1, 8) , B(4, 2) and C (5, 4) , first
translated by 2 units in y-direction, second rotated by 45o in ccw direction about the z -axis and finally
scaled by 3 units in x-direction.
Solution: The overall transformation matrix will be the product of three matrices corresponding to the three
geometric transformations taken in an order:
37

Computer Graphics (MA-312)


(i).

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Translate the triangle by 2 units in the y -direction

(ii). Rotate the triangle by 45o in counterclockwise direction about the z -axis
(iii). Scale the triangle by 3 units in the x -direction

Translation matrix,

1 0 0
[Tt ] 0 1 2
0 0 1

Rotation matrix,

cos 45 o

[Tr ] sin 45 o
0

sin 45 o
cos 45 o
0

0 0.707 0.707 0

0 0.707 0.707 0
1 0
0
1

3 0 0
[S ] 0 1 0
0 0 1

Scaling matrix,

The resulting concatenated matrix is

[T ] [ S ].[Tr ].[Tt ]

3 0 0 0.707 0.707 0 1 0 0 2.12 2.12 4.242


[T ] 0 1 0.0.707 0.707 0.0 1 2 0.707 0.707 1.414
0 0 1 0
0
1 0 0 1 0
0
1
Hence, transformed position vectors of triangle ABC are calculates as

xT 1

yT 1
1

xT 2
yT 2
1

xT 3 2.12 2.12 4.242 1 4 5 19.1 0


2.48

y T 3 0.707 0.707 1.414 .8 2 4 7.77 5.65 7.77



1
0
1
1
1
0
1 1 1 1

Thus, the transformed coordinates of the lamina ABC are

AT (19.1, 7.77) , BT (0, 5.65) , CT (2.48, 7.77)


Fig. 10 shows the original and transformed positions of the lamina ABC .

38

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi


y, yT
20
18
16
14
12
10
CT (-2.12, 7.77)

AT (-19.1, 7.77)

A (1, 8 )

8
6

BT (0, 5. 65 )
C (5, 4 )

4
2
B (4, 2 )

-20

-18

-16

-14

-12 -10

-8

-6

-4

-2

x, xT

Fig. 10
Problem 4: Find the transformed position of a rectangular lamina having vertices A(1, 2) , B(3, 2) , C (4, 3)
and D(2, 4) subjected to the following successive transformations:
(i).
Reflection about the y-axis
(ii). Translation by -1 unit in x & y directions
(iii). Rotation by 180o counterclockwise direction about the z-axis
Solution: The overall transformation matrix will be the product of three matrices corresponding to the three
geometric transformations taken in an order:
(i).
Reflect the lamina about the y -axis
(ii).

Translate the lamina by -1 unit in the x and y directions

(iii). Rotate the lamina about the z -axis by 180o counterclockwise direction

Reflection matrix,

1 0 0
[R] 0 1 0
0 0 1

Translation matrix,

1 0 1
[Tt ] 0 1 1
0 0 1

Rotation matrix,

cos180 o

[Tr ] sin 180 o


0

sin 180 o
cos180 o
0

0 1 0 0

0 0 1 0
1 0 0 1

The resulting concatenated matrix is


39

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

[T ] [Tr ].[Tt ].[R]

1 0 0 1 0 1 1 0 0 1 0 1
[T ] 0 1 0.0 1 1. 0 1 0 0 1 1
0 0 1 0 0 1 0 0 1 0 0 1
Hence, transformed position vectors of the lamina ABCD are

xT 1

yT 1
1

xT 2
yT 2
1

xT 3
yT 3
1

xT 4 1 0 1 1 3 4 2 2 4
5
3

y T 4 0 1 1.2 2 3 4 1 1 2 3


1
1
1
0 0 1 1 1 1 1 1 1

Thus, the transformed coordinates of rectangular lamina ABCD are

AT (2, - 1) , BT (4, - 1) , CT (5, - 2) , DT (3, - 3)


Fig. 11 shows the original and transformed positions of the rectangular lamina ABCD .
y, yT

12
10
8
6
4

D (2, 4)
C (4, 3 )

2
A (1, 2)

-6

-4

-2 0

AT

B (3, 2 )

4 BT 6

-2
-4

10

12

14

x, xT

CT
DT

Fig. 11
ROTATION ABOUT AN ARBITRARY POINT
In general, rotations about an arbitrary point ( x r , y r ) , other than the origin, can be accomplished by
performing three steps taken in sequence:
I.

Translate point ( x r , y r ) to the origin

II.

Rotate the object by the desired angle direction about the origin (alternatively, about an axis
perpendicular to the plane of rotation)

III.

Translate point ( x r , y r ) back to the original centre of rotation

Thus, matrix equation for the rotation of position vector {X } about the point ( x r , y r ) , by an angle in
40

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

ccw direction in the xy plane is expressed as

{X T } [Tt ] 1 .[Tr ].[T t ].{X }


where

[Tt ]

= translation matrix obtained by adding translational distances x r and y r to the


position vector {X } so that it coincides with the origin

[Tr ]

= rotation matrix for rotation of position vector {X } by an angle in ccw direction


so that it rotates about the origin in xy plane

[Tt ] 1

= Inverse translation matrix obtained by adding translational distances x r and y r to


the position vector {X } so that it translates back to the original position

The matrix equation (4.41) yields

xT 1 0

y T 0 1
1 0 0

x r cos
y r . sin
1 0

sin
cos
0

0 1 0 x r x

0.0 1 y r . y
1 0 0
1 1

By carrying out the products of interior matrices, we have

xT cos

y T sin
1 0

sin
cos
0

x r .(1 cos ) y r . sin x



y r .(1 cos ) y r . sin . y
1
1

Problem 5: Find the transformed position of a triangle having vertices A(1, 10) , B(5, 3) and C (8, 4)
rotated about point A by 45o in ccw direction.
Solution: The overall transformation matrix will be the product of three matrices corresponding to the three
geometric transformations taken in an order:
(i).

Translate point A(1, 10) to the origin

(ii). Rotate triangle by 45o in ccw direction about the origin


(iii). Translate point A back to the original position

Translation matrix,

1 0 1
[Tt ] 0 1 10
0 0 1

Rotation matrix,

cos 45 o

[Tr ] sin 45 o
0

Inverse translation matrix, [Tt ]

sin 45 o
cos 45 o
0

0 0.707 0.707 0

0 0.707 0.707 0
1 0
0
1

1 0 1
0 1 10
0 0 1

The resulting concatenated matrix is expressed as

[T ] [Tt ] 1 .[Tr ].[Tt ]


41

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

1 0 1 0.707 0.707 0 1 0 1 0.707 0.707 7.367


[T ] 0 1 10.0.707 0.707 0.0 1 10 0.707 0.707 2.223
0 0 1 0
0
1 0 0 1 0
0
1
Hence, the transformed position vectors of triangle ABC are

xT 1

yT 1
1

xT 2
yT 2
1

xT 3 0.707 0.707 7.367 1 5 8 1 8.78 10.19

y T 3 0.707 0.707 2.223.10 3 4 10 7.68 10.71



1
0
1
1
1
0
1 1 1 1

Thus, the transformed coordinates of triangle ABC is

AT (1, 10) , BT (8.78, 7.68) , CT (10.19, 10.71)


Fig. 12 shows the original and transformed positions of the triangle ABC .
y, yT
18
16
14
12
CT (10.19,10. 71)

A (1, 10 )

10
AT (1, 10)

8
BT (8.78, 7.68)

6
4

C (8, 4 )
B (5, 3 )

2
-6

-4

-2

10

12

14

x, xT

Fig. 12
SCALING ABOUT AN ARBITRARY POINT
In general, scaling about an arbitrary point ( x s , y s ) , other than the origin, can be accomplished by
performing the three steps in sequence:
I.

Translate point ( x s , y s ) to the origin

II.

Scale the object along x and y directions about the origin with scaling factors S x and S y

III.

Translate point ( x s , y s ) back to the original position

Thus, matrix equation for scaling of position vector {X } about the point having coordinates ( x s , y s ) is
given as

{X T } [Tt ] 1 .[S ].[T t ].{X }


where

[Tt ]

= translation matrix obtained by adding translational distances x s and y s to the


42

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

position vector {X } so that it coincides with the origin

[S ]

= scaling matrix with scaling factors S x and S y about the origin

[Tt ] 1

= Inverse translation matrix obtained by adding translational distances x s and y s to


the position vector {X } so that it translates back to the original position

The matrix eqn. (4.43) yields

xT 1 0

y T 0 1
1 0 0

x s S x
y s . 0
1 0

0
Sy
0

0 1 0 x s x

0.0 1 y s . y

1 0 0
1
1

By carrying out the products of interior matrices, we have

xT S x

yT 0
1 0

0
Sy
0

x s .(1 S x ) x

y s .(1 S y ). y
1
1

Problem 6: Find the transformation matrix and transformed coordinates of a square ABCD converted to
half its size with centre remains at the same position. The coordinates of vertices are A(2, 2) , B(4, 2) ,

C (4, 4) and D(2, 4) with centre at (3, 3) .


Solution: The overall transformation matrix will be the product of three matrices corresponding to three
geometric transformations taken in an order:
(i).

Translate centre coordinates (3, 3) to the origin by translating -3 units in x -direction and -3 units in

y -direction
(ii).

Scale the square with scaling factors S x 0.5 and S y 0.5

(iii). Inverse translate centre coordinates (3, 3) back to the original position by translating it 3 units in x direction and 3 units in y -direction

Translation matrix,

1 0 3
[Tt ] 0 1 3
0 0 1

Scaling matrix,

0.5 0 0
[S ] 0 0.5 0
0
0 1

1 0 3

Inverse translation matrix, [Tt ] 1 0 1 3


0 0 1
The resulting concatenated matrix is

[T ] [Tt ] 1 .[S ].[Tt ]


43

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

1 0 3 0.5 0 0 1 0 3 0.5 0 1.5


[T ] 0 1 3. 0 0.5 0.0 1 3 0 0.5 1.5
0 0 1 0
0 1 0 0 1 0
0
1
Hence, transformed position vectors for the square ABCD are calculates as

xT 1

yT 1
1

xT 2
yT 2
1

xT 3
yT 3
1

xT 4 0.5 0 1.5 2 4 4 2 2.5 3.5 3.5 2.5

y T 4 0 0.5 1.5.2 2 4 4 2.5 2.5 3.5 3.5


1 0
0
1 1 1 1 1 1
1
1
1

Thus, transformed coordinates of square ABCD are

AT (2.5, 2.5) , BT (3.5, 2.5) , CT (3.5, 3.5) , DT (2.5, 3.5)


Fig. 13 shows the original and transformed position of square ABCD .

y, yT

12
10
8
6
4

Transformed
Position

2
-6

-4

-2 0

10

12

14

x, xT

-2
-4

Fig. 13
Problem 7: Find the homogeneous transformation matrix to change a square into a rectangle with scaling
factors S x 1 , S y 2 and rotating it by 90o in ccw direction, keeping the centre of rectangle at the centre
of original square.
Solution: The overall transformation matrix will be the product of four matrices corresponding to the four
geometric transformations taken in an order:
(i).

Translate centre coordinates ( x c , y c ) of square to the origin by translating x c in the x -direction


and y c in the y -direction

(ii).

Scale the square with scaling factors S x 1 and S y 2 about the origin

(iii). Rotate the rectangle by 90o in ccw direction about the origin
(iv).

Inverse translate the centre coordinates ( x c , y c ) back to the original position by translating it x c in
44

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

the x -direction and y c in the y -direction


Thus, the overall transformation matrix will be

[T ] [Tt ] 1 .[Tr ].[S ].[Tt ]


o
1 0 x c cos 90

o
[T ] 0 1 y c . sin 90
0 0 1 0

sin 90 o
cos 90 o
0

0 1 0 0 1 0 x c 0 2 x c 2 y c

0.0 2 0.0 1 y c 1 0
y c x c
1 0 0 1 0 0
1 0 0
1

REFLECTION THROUGH AN ARBITRARY LINE


In subsection 4.4.1, the reflection of a point through the axes/lines that passes through the origin, are
considered. In general, reflection through a general line that may or may not pass through the origin is
required. This can be accomplished using a procedure similar to that for the rotation about an arbitrary
point. In general, there are two axes of reflections:
Axis of Reflection Passes through Origin
The axis of reflection may be a line ( y mx) passing through the origin having a slope m tan where

is the angle made by the line with the x -axis. The overall transformation matrix for the reflection about
this line can be achieved by performing the following transformations steps in sequence:
I.

Rotate the line and the object about the origin until line is coincident with one of the coordinate axes
(say, the line is rotated by an angle in clockwise direction about the z -axis so that it becomes
coincident with the x -axis).

II.

Reflect the object through the coordinate axis (say, x axis).

III.

Inverse rotate the object about the coordinate axis (say, z axis).

Thus, the resulting concatenated matrix is

[T ] [Tr ] 1 .[R].[Tr ]
The rotations and reflections are also applied to the object to be transformed. The matrix equation for the
reflection of position vector {X } about the line ( y mx) is given by

{ X T } [T ].{X }
Problem 8: Find the transformed coordinates of a triangle having vertices A(4, 1) , B(7, 1) and C (7, 3)
subjected to reflection through the line 2 y x .
Solution: The line 2 y x passes through origin and makes an angle tan 1 (0.5) 26.56 o with the

x axis. The overall transformation matrix will be the product of matrices corresponding to three
geometric transformations taken in an order:
(i).

Rotate the line (hence, triangle) by an angle 26.56 o in clockwise direction to align it with the

x -axis.
(ii).

Reflect the triangle through the x axis.

(iii). Inverse rotate the line and the triangle back by an angle 26.56 o in counterclockwise direction to
45

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

restore the original position of line and triangle.


Thus, the resulting concatenated matrix is expressed as

[T ] [Tr ] 1 .[R].[Tr ]
cos(25.56 o ) sin( 25.56 o ) 0 1 0 0 cos(25.56 o ) sin( 25.56 o ) 0

[T ] sin( 25.56 o ) cos(25.56 o ) 0.0 1 0. sin( 25.56 o ) cos(25.56 o ) 0

0
0
1 0 0 1
0
0
1

0.629 0.762 0
0.778 0.628 0
0
0
1

Hence, transformed position vectors of triangle ABC are calculates as

xT 1

yT 1
1

xT 2
yT 2
1

xT 3 0.629 0.762 0 4 7 7 3.28 5.16 6.69

y T 3 0.778 0.628 0.1 1 3 2.48 4.82 3.56



1
0
1
1
1
0
1 1 1 1

Thus, transformed coordinates of triangle ABC are

AT (3.28, 2.48) , BT (5.16, 4.82) , CT (6.69, 3.56)


Fig. 14 shows the original and transformed positions of the triangle ABC .
y, yT
10
8

2y = x

6
BT

CT

4
2

AT
A

-4

-2

0
-2

10

x, xT

Fig. 14
Axis of Reflection is Arbitrary Line
When the axis of reflection is a line ( y mx c) , not passes through the origin, having a slope m tan
where

is the angle, which line makes with the x -axis. The overall transformation matrix can be

obtained by performing the following steps in sequence:


I.

Translate the line and the object so that the line passes through the origin.

II.

Rotate the line and object about the z axis until the line becomes coincident with one of the
coordinate axes (say, line is rotated by an angle in clockwise direction so that it becomes
coincident with the x -axis).
46

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

III.

Reflect the object through the coordinate axis (say, x axis).

IV.

Inverse rotate the object about the coordinate axis (say, z axis).

V.

Translate back the line/object to the original position

Thus, the resulting concatenated matrix is given by

[T ] [Tt ] 1 .[Tr ] 1 .[R].[Tr ].[Tt ]


The translations, rotations and reflections are also applied to the object. The matrix equation for the
reflection of position vector {X } about the line ( y mx) is given as

{ X T } [T ].{X }
Problem 9: Find the transformed coordinates of a triangle having vertices A(4, 1) , B(7, 1) and C (7, 3)
subjected to reflection through the line 2 y x 2 .
Solution: The line 2 y x 2 or y 0.5x 1 makes an angle tan 1 (0.5) 26.56 o with the x axis
and it does not pass through the origin. The overall transformation matrix will be the product of matrices
corresponding to five geometric transformations taken in an order:
(i).

Translate the line/triangle by -1 unit in the negative y direction so that the line passes through the
origin.

(ii).

Rotate line/triangle about the z axis by an angle 26.56 o in clockwise direction so that line
aligns with the x -axis.

(iii). Reflect the triangle through the x axis.


(iv).

Inverse rotate the line/triangle about the z axis, back by an angle 26.56 o in counterclockwise
direction, to restore the original position of line/triangle.

(v).

Translate back the line/triangle by 1 unit in the positive y direction in order to restore line

2 y x 2 and triangle to the original position.


Thus, the resulting concatenated matrix is expressed as

[T ] [Tt ] 1 .[Tr ] 1 .[R].[Tr ].[Tt ]


o
o
1 0 0 cos(25.56 ) sin( 25.56 ) 0 1 0 0

[T ] 0 1 1 sin( 25.56 o ) cos(25.56 o ) 0.0 1 0


0 0 1
0
0
1 0 0 1

cos(25.56o ) sin( 25.56o ) 0 1 0 0

. sin( 25.56o ) cos(25.56o ) 0.0 1 1

0
0
1 0 0 1

0.627 0.777 0.777


0.777 0.627 1.627
0
0
1

Hence, the transformed position vectors of triangle ABC are calculates as


47

Computer Graphics (MA-312)

xT 1

yT 1
1

xT 2
yT 2
1

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

xT 3 0.627 0.777 0.777 4 7 7 2.51 4.39 5.94

y T 3 0.777 0.627 1.627 .1 1 3 4.11 6.44 5.18



1
0
1
1
1
0
1 1 1 1

Thus, the transformed coordinates of triangle ABC is

AT (2.51, 4.11) , BT (4.39, 6.44) , CT (5.94, 5.18)


Fig. 15 shows the original and transformed position of triangle ABC as well as different intermediate steps
(b to f) to achieve the reflection of triangle through an arbitrary line.

48

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

y, yT

y, yT

10

10

2y = x+2

BT

6
4

CT
AT

4
C

-4

-2 0

10

x, xT

-4

-2 0

-2

-2

-4

-4

(a)

10

2
2

10

x, xT

-4

-2 0

-2

-2

-4

-4

(c)

10

10

10

x, xT

x, xT

(d)

10

10

-2 0

y, yT

y, yT

-4

y, yT

10

-2 0

(b)

y, yT

-4

10

x, xT

-4

-2 0

-2

-2

-4

-4

(e)

x, xT

(f)

Fig. 15

49

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

THREE DIMENSIONAL TRANSFORMATIONS


In two-dimensional transformations, we have discussed three basic geometric transformations (translation,
rotation, scaling) and two complex transformations (shear and reflection). These transformations are
applied to reposition and resize a two-dimensional objects on the displays (alternatively, in the database). In
this section, the matrix formulation for two-dimensional objects is extended in three-dimensions. The basic
and complex transformations are applied first to a point in 3D space; thereafter, it is extended to threedimensional objects model.
Translation: In three-dimensional homogeneous coordinates, a point translates from P( x, y, z, 1) to

PT ( xT , yT , zT , 1) using the matrix equation

xT
x 1
y
y 0
T

[Tt ].
zT
z 0

1
1
0

0
1
0
0

0 tx x

0 t y
y
.
1 tz z

0 1
1

where [Tt ] is the translation matrix and t x , t y and t z are the translational distances (any real values) along
the coordinate axes, respectively. The matrix eqn. is equivalent to three equations

xT x t x , yT y t y , zT z t z
Fig. 1 shows the graphical visualization of translation of a point P( x, y, z ) to the new location

PT ( xT , yT , zT ) . The inverse of translation matrix can be obtained by taking the negative values of
translational distances such as t x , t y and t z in opposite directions; thus, the product of translation
matrix and inverse translation matrix produces the identity matrix.

y
Translational
distances

tx , t y, tz

PT ( xT , yT , zT )

P( x, y, z )
x

Rotation: Rotation is another important geometric transformation, which is used frequently in software
50

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

packages to view the object from different angles. Rotation is a rigid body transformation that moves the
object without deformation. This means that every point on the object is rotated through the same angle. To
generate a rotation transformation for the three-dimensional object, we must specify the axis of rotation and
angle of rotation. Unlike the two-dimensional rotations, wherein rotation occurs in the xy plane, the
easiest three-dimensional rotation may be taken about the coordinates axes. Rotation of an object about the
line, which is parallel to the coordinate axes, is obtained in two steps:
I.
II.

Translate line so that it becomes coincident with any one of the coordinate axes
Rotate object about the coordinate axes by the desired angle and direction

Thus, we can use combinations of coordinate axes rotations (along with appropriate translations) to specify
the general rotations of an object. In the followings, the most general case of rotation of an object, about
any arbitrary line, is considered.
For rotation about the x -axis, the x coordinate of position vector remains same because rotation
occurs in a plane perpendicular to the x -axis. Similarly, when rotation occurs about y and z axes,
respectively, y and z coordinates remain unaltered. The transformations of position vectors in each of
these planes are governed by the general 2D rotation matrix. The rotation matrix is obtained using the right
hand coordinate system in which the positive rotations are such that when looking from a positive axis
towards the origin, a 90o counterclockwise rotation will transform one positive axis to the other. This
agrees with our discussion of rotation in two-dimensions, where positive rotations in the xy plane are
counterclockwise about the axes parallel to the z -axis. Fig. shows the right handed coordinate system to
determine the direction of positive rotation.

51

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Axis of
rotation

x
y
z

y to z
z to x
x to y

Direction of positive
rotation

The two-dimensional z -axis rotation can be extended to the three-dimensions using the equations

xT x. cos y. sin
yT x. sin y. cos

(1)

zT z
Parameter is the positive rotation angle (ccw) about the z -axis in the xy plane. In homogeneous
coordinates, three-dimensional z -axis rotation equation in matrix form is expressed as

cos
sin
[Trz ]
0

sin
cos
0
0

0
0
1
0

0
0
0

Fig. shows the rotation of an object about the z -axis in a plane parallel to the xy plane. Since the object
rotates about the z -axis; therefore, z coordinates remain unaltered after the rotation. This can be observed
in the transformation matrix, in which third row, third column element is equal to unity.

52

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Transformation equations for the rotation about the other two axes can be obtained with a cyclic
permutation of the coordinate parameters x, y and z in eqn. (5.8). Thus, we can replace x y

z x . For x -axis rotation by an angle in counterclockwise direction, the eqns. (5.8) are modified as

yT y. cos z. sin
zT y. sin z. cos

(2)

xT x
In homogeneous coordinates, the matrix equation is expressed as

0
1
0 cos
[Trx ]
0 sin

0
0

0
sin
cos
0

0
0
0

Fig. shows the rotation of an object about the x -axis in a plane parallel to the yz plane. Since the object
rotates about the x -axis; therefore, x coordinates remain unaltered after the rotation. This can be observed
in the transformation matrix in which first row, first column element is equal to unity.

53

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

x
For y -axis rotation by an angle in counterclockwise direction, the eqns. (1) are modified as

zT z. cos x. sin

xT z. sin x. cos

(3)

yT y
In homogeneous coordinates, the matrix equation for y -axis rotation is expressed as

cos
0
[Try ]
sin

0 sin
1
0
0 cos
0
0

0
0
0

Fig. shows the rotation of an object about the y -axis in a plane parallel to the zx plane. Since object
rotates about the y -axis; therefore, y coordinates remain unaltered after the rotation. This can be observed
in the transformation matrix (eqn. 5.13) in which second row, second column element is equal to unity. It
should be noted that the determinant of each rotation matrix is +1, as required for the rotation.

54

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

z
Scaling: Scaling changes the size and position of object relative to origin in the database. In homogeneous
coordinates, the matrix representation for scaling transformation of a point P( x, y, z ) , relative to the
coordinate origin, may be expressed as

xT
x S x
y
y 0
T

[ S ].
z
T
z 0
1
1 0

0
Sy
0
0

0
0
Sz
0

0 x
0 y
.
0 z

1 1

where S x , S y and S z are the scaling factors along the coordinate axes, respectively, which can be
assigned any positive value. The transformed coordinates for the scaling relative to the coordinate origin
may be expressed as

xT S x .x , yT S y . y , zT S z .z

(4)

If scaling factors are not equal, the relative dimensions of the object are modified. However, the original
shape of objects maintain if equal values of scaling factors, i.e. S x S y S z are considered. Fig. shows the
uniform scaling of object with scaling factors set at 3.

55

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Reflection: Reflection is used for generating the symmetric models. The mirror image of 2D reflection is
obtained by rotating the object 180o about the reflection axis. A three-dimensional reflection can be
obtained either relative to a reflection axis or through a reflection plane. Reflection through a given axis is
equivalent to 180o rotation about that axis. When reflection occurs through a coordinate plane (either xy ,
yz or xz plane), it can be considered as a conversion between the left-hand and right-hand systems. For

example, reflection of an object through the xy plane is a conversion of coordinates from right-handed
system to the left-handed system (or vice-versa), as shown in Fig.

y
z
C (x, y, z)

Reflection
relative to
xy plane

C (x, y,- z)

Right hand
coordinate
system

Left hand
coordinate
system

The transformed coordinates for the reflection through the xy coordinate plane changes the sign of z
56

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

coordinates of position vectors only, keeping x and y values unchanged.


The reflection matrix through the xy plane is given as

1
0
[ Rxy ]
0

0 0
1 0
0 1
0 0

0
0
0

Similar matrices for the reflections through the xz plane and yz plane, respectively, are

1 0
0 1
[ Rxz ]
0 0

0 0

0
0
1
0

0
0
0

1
0
[ R yz ]
0

0
0
1
0

0
0
0

0
1
0
0

In general, reflections about the other planes are obtained by the composite transformations such as
rotations, followed by the reflections through the coordinate planes.
Shear: Shear is the controlled distortion of an object model. Shear transformations can be used to distort the
shape of an object model by sliding of internal layers over the other layers. In two-dimensions, individual
and simultaneous shear transformations of x and y coordinates are considered. In three-dimensions, shear
is extended relative to the z -axis. If we ignore the shear along the x and y axes, the following
transformation produces z -axis shear

1
0
[ Shz ]
0

0 Sh13
1 Sh23
0
1
0
0

0
0
0

The transformation matrix is equivalent to the following shear equations:

xT x Sh13 .z

yT y Sh23 .z
zT z
Shear parameters Sh13 and Sh23 may be assigned any real values. The effect of z -axis shear is to change

x and y coordinates (keeping z coordinate unchanged) of an object by an amount that is proportional to


the z coordinates value. Thus, boundaries of planes that are perpendicular to the z -axis are shifted by an
amount proportional to z . Fig. shows a unit cube sheared by the z -axis shear (eqn. 5.21) with shear
parameters Sh13 Sh23 1 .

57

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Shearing

Similar matrices for the x -axis shear and the y -axis shear, respectively, may be written as

1
Sh
[ Shx ] 21
Sh31

0
1
0
0

0
0
1
0

0
0
0

1 Sh12
0 1
[ Shy ]
0 Sh32

0
0

0
0
1
0

0
0
0

The general form of shear transformation matrix is given as

1
Sh
[ Sh] 21
Sh31

Sh12
1
Sh32
0

Sh13
Sh23
1
0

0
0
0

The shear transformation matrix is equivalent to the following shear equations:

xT x Sh12 . y Sh13 .z
yT Sh21.x y Sh23 .z
zT Sh31.x Sh32 . y z
Problem1: A rectangular parallelepiped, shown in Fig. a, subjected to individual rotations of 90o cw about
the x-axis and 90o ccw about the y -axis. Find the transformed coordinates of its vertices for these
58

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

rotations.
Solution: The position vector matrix of vertices of parallelepiped in homogeneous coordinate system can be
expressed as
A B C D E F G H

0
0
X
1

3
0
1
1

3
2
1
1

0
2
1
1

0
0
0
1

3
0
0
1

3
2
0
1

0
2
0

The transformation matrix for rotation by 90 o about the x -axis is written as

0
1
0 cos
[Trx ]
0 sin

0
0

0
sin
cos
0

0 1 0
0 0 0

0 0 1

1 0 0

0
1
0
0

0
0
0

The transformed position vector can be obtained as


A B

1 0
0 0
X T Trx .X
0 1

0 0

0
1
0
0

0 0
0 0
.
0 1

1 1

3
0
1
1

3
2
1
1

0
2
1
1

0
0
0
1

3
0
0
1

3
2
0
1

0 0
2 1

0 0

1 1

3 3
0
1 1
1
0 2 2
1 1
1

E F G

0
0
0
1

3 3
0
0 0
0
0 2 2

1 1
1

It can be observed that x elements of the matrices { X T } and {X } are identical, as required. Fig. shows the
transformed position of parallelepiped.
The transformation matrix for rotation by 90 o about the y -axis is written as

cos
0
[Try ]
sin

0 sin
1
0
0 cos
0
0

0 0
0 0

0 1

1 0

0
1
0
0

0
0
0

1
0
0
0

The transformed position vector can be obtained as


A

0
0
X T Trx .X
1

0
1
0
0

1
0
0
0

0 0
0 0
.
0 1

1 1

3
0
1
1

3
2
1
1

0
2
1
1

0
0
0
1

3
0
0
1

3
2
0
1

0 1 1
1

2 0 0
2

0 0 3 3

1 1 1
1

D E

1
2
0
1

0 0
0
0 0
2
0 3 3
1 1
1

0
2
0

It can be observed that y elements of matrices { X T } and {X } are identical. Fig. shows transformed
position of the parallelepiped.

59

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

C
E

(a)
90o ccw
Rotation
about y-axis

90 cw
Rotation
about x-axis

yT

yT
DT

GT

CT
HT

DT

BT

AT

FT

BT

GT

HT
ET

xT

FT

zT

CT

ET

zT

(b)

xT

AT

(c)

Problem 5.2: A rectangular parallelepiped, shown in Fig. a, subjected to scaling with scaling factors

S x 13 , S y

1
2

along x and y coordinates axes, respectively. Find transformed position of the

parallelepiped. Next, the transformed parallelepiped is subjected to an overall scaling by a factor S

1
2.5

find the new position of parallelepiped.


Solution: The position vector matrix of vertices of parallelepiped, in homogeneous coordinate system, is
given as
A B C D E F G H

0
0
X
1

3
0
1
1

3
2
1
1

0
2
1
1

0
0
0
1

3
0
0
1

3
2
0
1

0
2
0

For local scaling, the transformation matrix is given as

60

Computer Graphics (MA-312)

S x
0
S
0

0
Sy
0
0

0
0
Sz
0

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

0 1 3
0 0

0 0

1 0

0
1

0
0

0
0
1
0

0
0
0

The transformed position vectors can be obtained as


A B C D E F G H

13
0
X T Trx .X
0

0
1

0
0
1
0

0
0

0 0
0 0
.
0 1

1 1

3
0
1
1

3
2
1
1

0
2
1
1

0
0
0
1

3
0
0
1

3
2
0
1

0 0
2 0

0 1

1 1

1
0
1
1

1
1
1
1

0
1
1
1

0
0
0
1

1
0
0
1

1
1
0
1

0
1
0

Fig. b shows transformed position of the parallelepiped, which is a cube of unit side.
Overall scaling matrix is obtained by assigning a scaling factor S on the fourth diagonal element as

1
0
S
0

0
1
0
0

0
0
1
0

0 1
0 0

0 0

S 0

0
1
0
0

1
2.5

0
0
1
0

0
0
0

The transformed position vector can be obtained as

1
0
X T Trx .X
0

0
1
0
0

0
0
1
0

0
0
.
1

1
2.5 1
0
0
0

1
0
1
1

1
1
1
1

0
1
1
1

0
0
0
1

1
0
0
1

1
1
0
1

0
1
0

1
1
0
0
1
1
0
0
0
0
1
1
0
0
1
1

1
1
1
1
0
0
0
0

0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4

The homogeneous coordinate factor for each transformed position is h 0.4 . Thus, to obtain the physical
coordinates in normalized form of homogeneous position vector, each position vector must be divided by
h . Thus, the transformed position vectors of the unit cube is given as

D E

0 2.5 2.5 0
0
0 2.5 2.5
X T
2.5 2.5 2.5 2.5

1
1
1
1

0 2.5 2.5 0
0 0 2.5 2.5
0 0
0
0

1 1
1
1

Fig. c shows the new position of parallelepiped. It is observed that the homogeneous coordinate factor h is
not unity in case of two-dimensional overall scaling. By analogy, this represents another volume in the
four-dimensional space, which is out of h 1 volume. Therefore, new transformed coordinates are
obtained by projecting back all the vertices into the physical h 1 volume through the centre of 4D
61

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

coordinate system since overall scaling factor S

1
2 .5

0.4 which is less than 1; hence, expansion occurs.

yT

HT
H

GT

DT
CT

FT

ET

BT

AT

(a)

(c)

zT
Local
Scaling

xT

Overall
Scaling

yT

HT
DT

GT
CT

ET
AT

FT

xT

BT

zT
(b)

Problem 3: A rectangular parallelepiped, shown in Fig. a, reflected individually through the xy plane and

yz plane, respectively. Find the new coordinates of its vertices for these reflections.
Solution: The position vector matrix of vertices of parallelepiped, in homogeneous coordinate system, may
be written as
A B C D E F G H

1
0
X
3

4
0
3
1

4
2
3
1

1
2
3
1

1
0
2
1

4
0
2
1

4
2
2
1

1
2
2

Matrix for reflection through the xy plane is given as

R
xy

1
0

0 0
1 0
0 1
0 0

0
0
0

1
62

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

The transformed position vectors can be obtained as


A

4
4
1
1
4
4
1
1 0 0 0 1 4 4 1 1 4 4 1 1
0 1 0 0 0 0 2 2 0 0 2 2 0
0
2
2
0
0
2
2
.

X T Rxy .X
0 0 1 0 3 3 3 3 2 2 2 2 3 3 3 3 2 2 2 2

1
1
1
1
1
1
1
0 0 0 1 1 1 1 1 1 1 1 1 1
Fig. b shows reflected position of the parallelepiped. Here, it should be noted that reflection through the xy

plane reverses only the sign of z coordinates.


Reflection matrix through the yz plane is given as

R
yz

1
0

0
1
0
0

0
0
0

0
0
1
0

The transformed position vector can be obtained as


A

1
0
X T Ryz .X
0

1 1 4 4 1 1 4 4 1
2 0
0
2
2 0
0
2
2

2 3
3
3
3 2
2
2
2

1 1
1
1
1 1
1
1
1
Fig. c shows reflected position of the parallelepiped. It should be noted that reflection through the yz plane

0
1
0
0

0
0
1
0

0 1
0 0
.
0 3

1 1

4
0
3
1

4
2
3
1

1
2
3
1

1
0
2
1

4
0
2
1

4
2
2
1

reverses only the sign of x coordinates.

63

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

x
E

z
(a)
Reflection
through yz plane

Reflection
through xy plane

yT

yT

GT

HT

CT

GT

DT

HT
DT

CT

xT
FT

ET

FT

AT

ET
AT

BT

BT

xT

zT

zT
(c)

(b)

Problem 4: A unit cube having homogeneous positions vectors


A B C D E F G H

0
0
X
1

1
0
1
1

1
1
1
1

0
1
1
1

0
0
0
1

1
0
0
1

1
1
0
1

0
1
0

is subjected to shear with shear factors Sh12 Sh21 0.25 , Sh13 Sh31 0.50 , Sh23 Sh32 0.75 . Find
the transformed coordinates of its positions vectors.
Solution: The general form of shear transformation matrix is given as

1
Sh
[ Sh] 21
Sh31

Sh12
1
Sh32
0

Sh13
Sh23
1
0

0
0
0

1
64

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

The transformed position vector can be obtained as

0.25 0.50 0 0
1
0.25
1
0.75 0 0
X T Sh.X
.
0.50 0.75
1
0 1

0
0
1 1
0
A

1
0
1
1
E

1
1
1
1

0
1
1
1

0
0
0
1
G

1
0
0
1

1
1
0
1

0
1
0

1 1.25 0.25
0.50 1.50 1.75 0.75 0
0.75 1
2
1
.
75
0
0
.
25 1.25 1

1 1.50 2.25 1.75 0 0.75 1.25 0.75

1
1
1
1
1
1
1
1

COMPOSITE TRANSFORMATIONS
Any sequence of geometric transformations is termed as composite (or combined) transformations. Similar
to the two-dimensional geometric transformations, the three-dimensional composite transformations is
obtained by multiplying individual 4x4 transformation matrices in the transformation sequence. The
concatenation is performed from the right to left where rightmost transformation matrix corresponds to the
first transformation applied on a three-dimensional object. The other transformation matrices are arranged
relative to the first transformation matrix, towards the left side, in a successive manner. Alternatively, the
matrix [T1 ] nearest to the position vector matrix generates the first individual transformation and the
farthest matrix [T4 ] will correspond to the last individual transformation. Mathematically, matrix equation
for the composite transformation of position vectors {X } to { X T } may be expressed as

X T T4 . T3 . T2 . T1 X T .X
where

{X T }

transformed position vectors of the model

{X }

original position vectors of the model

Ti

scaling, shear, rotation, reflection, translation, projective and perspective

transformations matrices
overall transformation matrix

[T ]

The perspective transformation distorts the geometric model, and projective transformation
(orthographic, axonometric projections, etc.) results into the lost information during the conversion from
three-dimensions to two-dimensions (e.g., z dimensions are lost in orthographic projections on the xy
plane). If these matrices are included in the composite transformations, they must occur as the last matrix
(projective transformation), after next to the last matrix (perspective projection). Therefore, transformation
matrices will be in the following order of sequence.
Translation / Scaling / Rotation / Reflection / Shear Perspective Projective
If numbers of vertices constituting a three-dimensional object, is subjected to composite transformation
then the matrix equation (eqn. 5.27) is given as

65

Computer Graphics (MA-312)

xT 1
y
T1

zT 1
1

xT 2
yT 2
zT 2
1

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

xT 3
yT 3
zT 3
1

xTn
x1

y
yTn
1
[T ].
zTn
z1

1
1

x2
y2
z2
1

x3
y3
z3
1

xn
yn

zn
1

(5.28)

Problem 5: Find the transformed coordinates of homogeneous position vector (3, 2, 2, 1) subjected to the
following successive transformations:
(i)
Translation by 1 , 1, 1 along the coordinates axes, and
(ii)

30o cw rotation about the x -axis

Solution: The translation matrix is expressed as

1
0
[Tt ]
0

0
1
0
0

0 t x 1
0 t y 0

1 t z 0

0 1 0

0
1
0
0

0 1
0 1
1 1

0 1

For 30 o , rotation matrix about the x -axis is expressed as

0
1
0 cos
[Trx ]
0 sin

0
0

0
sin
cos
0

0 1
0
0

0 0 0.866 0.5

0 0 0.5 0.866

1 0
0
0

0
0
0

Therefore, the resulting concatenated matrix is expressed as

[T ] [Trx ].[Tt ]

0 1 1
0
0
1

0 1 0 0.866 0.5 1.366

1 1 0 0.5 0.866 0.366


0 1 0
0
0
1
Hence, transformed position vector is obtained as
0
0
1
0 0.866 0.5
[T ]
0 0.5 0.866

0
0
0

0 1
0 0
.
0 0

1 0

0
1
0
0

0
0
1 3 1
xT 1
y 0 0.866 0.5 1.366 2 0
T

z
0

0
.
5
0
.
866

0
.
366
2
0
.
35
T

0
0
1
1
0
1 1

Thus, transformed coordinates of homogeneous position vector (3, 2, 2, 1) is (1, 0, 0.35, 1) .


Problem 6: Find the transformed coordinates of position vector (3, 2, 4, 4) when translated along the
coordinate axes by 1, 2, 3 , respectively, followed by 45o ccw rotation about the x -axis on the
homogeneous coordinate position vector.
Solution: The translation matrix is expressed as
66

Computer Graphics (MA-312)

1
0
[Tt ]
0

0
1
0
0

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

0 t x 1
0 t y 0

1 t z 0

0 1 0

0
1
0
0

0 1
0 2
1 3

0 1

For 45o , rotation matrix about the x -axis is given as

0
1
0 cos
[Trx ]
0 sin

0
0

0
sin
cos
0

0 1
0
0
0 0 0.707 0.707

0 0 0.707 0.707

1 0
0
0

0
0
0

The resulting concatenated matrix is expressed as

[T ] [Trx ].[Tt ]

0
0
1
0 0.707 0.707
[T ]
0 0.707 0.707

0
0
0

0 1
0 0
.
0 0

1 0

0
1
0
0

0 1 1
0
0
1

0 2 0 0.707 0.707 0.707

1 3 0 0.707 0.707 3.535


0 1 0
0
0
1

Hence, transformed position vector is obtained as

0
0
1 3 1
xT 1
y 0 0.707 0.707 0.707 2 1.414
T

zT 0 0.707 0.707 3.535 4 10.019

0
0
1
1
0
4

4

The physical position of coordinates can be obtained by normalizing the position vector after dividing it by
a factor 4; thus, the normalized transformed coordinates will be

xT 1 0.25
y 1.414 0.353
T

10
.
019

2
.
505
T

1
4
1

The transformed coordinates of position vector (3, 2, 4, 4) is (-0.25, 0.353, -2.505, 1).
Problem 7: A unit cube having homogeneous positions vectors
A B C D E F G H

0
0
X
1

1
0
1
1

1
1
1
1

0
1
1
1

0
0
0
1

1
0
0
1

1
1
0
1

0
1
0

is rotated successively three times in counterclockwise directions by 45 o about the x -axis, by 30o about
the y -axis, and by 60o about the z -axis. Find the new coordinates of its positions vectors.
67

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Solution: For 45o , rotation matrix about the x -axis is given as

0
1
0 cos
[Trx ]
0 sin

0
0

0 1
0
0

0 0 0.707 0.707

0 0 0.707 0.707

1 0
0
0

0
sin
cos
0

0
0
0

For 30 o , rotation matrix about the y -axis is given as

cos
0
[Try ]
sin

0 sin
1
0
0 cos
0
0

0 0.866
0 0

0 0.5

1 0

0
0
0

0 0.5
1
0
0 0.866
0
0

For 60 o , rotation matrix about the z -axis is given as

cos
sin
[Trz ]
0

sin
cos
0
0

0 0.5 0.866
0 0.866
0.5

0 0
0

1 0
0

0
0
1
0

0
0
0

0
0
1
0

The resulting concatenated matrix is expressed as

0.433 0.436 0.788 0


0.749 0.658 0.048 0

[T ] [Trz ].[Try ].[Trx ] =


0.5 0.612 0.612 0

0
0
1
0
Hence, transformed position vectors of its vertices are obtained as

0.433 0.436 0.788 0 0


0.749 0.658 0.048 0 0
.
X T
0.5 0.612 0.612 0 1

0
0
1 1
0
A

1
0
1
1
E

1
1
1
1

0
1
1
1
F

0
0
0
1

1
0
0
1
G

1
1
0
1

0
1
0

1
H

0
0.436
0.788 1.221 0.785 0.352 0 0.433
0.048 0.797 1.455 0.706 0 0.749 1.407 0.658

0.612 0.112 0.724 1.224 0 0.5 0.112 0.612

1
1
1
1
1
1
1
1
ROTATION ABOUT AN ARBITRARY AXIS
In engineering applications such as in robotics, animation, simulation, etc., the general case of rotation
about an arbitrary axis in space is frequently required. In previous sections, the combinations of translations
and simple rotations, about the coordinate axes, achieve the rotation about an arbitrary axis. This idea can
be extended for the rotation of an object about an arbitrary axis (line) in space, by making the axis (line)
coincident with one of the coordinate axes.
68

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Let an arbitrary axis in space passes through the point P( xo , yo , zo ) having direction cosines c x , c y
and cz along the coordinate axes. Rotation about the arbitrary axis by an angle

(say, in

counterclockwise direction) can be accomplished using the following steps:


I.

Translate the point P( xo , yo , zo ) to make it coincident with the origin of coordinate system

II.

Perform appropriate rotations to make the axis of rotation coincident with the y -axis

III.

Rotate about the y -axis by an angle in counterclockwise direction

IV.
V.

Perform the inverse rotations back to the original position


Perform the inverse translation back to the original position
When axis of rotation lies in a coordinate plane (xy , yz or zx ) , only one rotation is required to

make axis coincident with one of the coordinate axes. However, if axis of rotation lies in three-dimensional
space, two successive rotations are required to achieve the same. Suppose the arbitrary axis is rotated, first
about the z -axis by an angle and then about the x -axis by an angle , to make it coincident with the

y -axis. Now, it is required to calculate the rotation angles and about z and x coordinates axes,
respectively. Fig. shows a unit vector OP that passes through the point P( xo , yo , zo ) , and its projection
onto the xy plane as well as along the coordinate axes. The x, y and z components of the projected
vector OP are c x , c y and c z , respectively, the direction cosines of unit vector along the arbitrary axis

OP . From Fig. 5.14, we have


y

cz

P ' (o, d , cz )
cx

P( xo , yo , zo )

cz

cy

cx
cz

d cx c y
2

(1)

cy

c
, sin x
(2)
d
d
Thus, eqn. (5.31b) can be used for the calculation of angle of rotation about the z -axis. The rotation of

and

cos

unit vector OP by an angle in ccw direction into the yz plane is shown by the unit vector OP ' having
69

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

endpoint coordinate at P' (0, d , c z ) . The length of the unit vector is unity. Once again, the unit vector OP '
is rotated about the x -axis in cw direction to make it coincident with the y -axis. The rotation angle can
be calculated using following relationships:
cos

d
d,
1

sin

cx
cx
1

(3)

The concatenated matrix for the complete transformation is given as


[T ] [Tt ]1.[Trz ]1.[Trx ]1.[Try ].[Trx ].[Trz ].[Tt ]

where

(4)

[Tt ]

translation matrix

[Trz ]

rotation matrix for angle ccw about the z -axis

[Trx ]

rotation matrix for angle cw about the x -axis

[Try ]

rotation matrix for angle ccw about the y -axis

[Trx ]1

inverse rotation matrix for angle ccw about the x -axis

[Trz ]1

inverse rotation matrix for angle cw about the z -axis

[Tt ]1

inverse translation matrix

The different transformation matrices are given as

1
0
[Tt ]
0

0
1
0
0

cos
sin
[Trz ]
0

0 xo
0 yo
1 zo

0
1
sin
cos
0
0

(5)

0
0
1
0

0 c y / d
0 c x / d

0 0

1 0

0
0
1
0 cos( ) sin( )
[Trx ]
0 sin( ) cos( )

0
0
0
cos
0
[Try ]
sin

0 sin
1
0
0 cos
0
0

0
1
0 cos
[Trx ]1
0 sin

0
0

0
sin
cos
0

cx / d
cy / d
0
0

0 1 0
0 0 d

0 0 c x

1 0 0

0
0
1
0
0
cx
d
0

0
0
0

1
0 1 0
0 0 d

0 0 c x

1 0 0

0
0
0

(6)

0
0
0

(7)

(8)

0
cx
d
0

0
0
0

(9)

70

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

cos( ) sin( )
sin( ) cos( )
[Trz ]1
0
0

0
0
1
0
[Tt ]1
0

0 c y / d
0 c x / d

0 0

1 0

0
0
1
0

cx / d
cy / d
0
0

0
0
1
0

0
0
0

0 xo
0 yo
1 zo

0 1

0
1
0
0

(10)

(11)

If direction cosines of the vector are unknown, they can be calculated using the second point on the axis.
Thus, direction cosines of a vector that passes through the points ( xo , yo , zo ) and ( x1 , y1 , z1 ) may be
calculated by normalizing it from first point to second point as

c
where

(x x )
cz 1 o
V

cy

( y1 yo )
V

( z1 zo )

(12)

V ( x1 xo ) 2 ( y1 yo ) 2 ( z1 zo ) 2

(13)

Problem 5.10: A unit cube, as shown in Fig., has homogeneous positions vectors
A B C D E F G H

1
1
X
2

2
1
2
1

2
2
2
1

1
2
2
1

1
1
1
1

2
1
1
1

2
2
1
1

1
2
1

rotated by 60o in ccw direction about a local axis passing through the principal diagonal of the cube EC.
Find the transformed coordinates of its vertices.

H
D

C
E

Axis of
rotation

71

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

Solution: Principal diagonal of the cube that passes through the points E (1, 1, 1, ) and C (2, 2, 2) is
calculated, from eqn., as

V ( x1 xo ) 2 ( y1 yo ) 2 ( z1 zo ) 2 =

(2 1) 2 (2 1) 2 (2 1) 2 = 3

Moreover, using eqn. (5.41), the direction cosines of principal diagonal (EC) of the cube is calculated as

( x xo )
cz 1
V

cy

( y1 yo )
V

( z1 zo ) 1

V
3

1
3

Eqns. (5.31) and (5.32) yields

d cx c y 2 / 3
2

and

cos1 (c y / d ) cos1 (1 / 2 ) 45o


cos1 d cos1 ( 2 / 3 ) 35.26o

Since point E (1, 1, 1) passes through the axis of rotation; therefore, it can be translated to the origin of
coordinate axes. For t x t y t z 1 , the translation matrix is given as

1
0
[Tt ]
0

0
1
0
0

0 1
0 1
1 1

0 1

The rotation matrices (eqns. 5.35 & 5.36), to make the axis of rotation EC coincident with the y -axis, are
expressed as

cos 45o

sin 45o
[Trz ]
0

sin 45o
cos 45o
0
0

0
0
1
0

0 0.707 0.707

0 0.707 0.707

0
0 0

0
0
1

0
0
1
0 cos(35.26o ) sin( 35.26o )
[Trx ]
0 sin( 35.26o ) cos(35.26o )

0
0
0

0
0
1
0

0
0
0

0 1
0
0
0

0 0 0.816 0.577 0

0 0 0.577 0.816 0

1 0
0
0
1

The successive rotations about z and x axes, respectively, makes the axis of rotation coincident with the

y -axis. The rotation about the arbitrary axis (which has become coincident with the y -axis) by angle

60o is given as
cos 60 o

0
[Try ]
sin 60o

0 sin 60 o
1
0
0 cos 60o
0
0

0 0.5

0 0

0 0.866

1 0

0 0.866
1
0
0 0.5
0
0

0
0
0

1
72

Computer Graphics (MA-312)

Abhishek Tevatia, MPAE, NSIT, Dwarka, Delhi

The inverse matrices [Trx ]1 , [Trz ]1 and [Tt ]1 are obtained by substituting the angles 35.26o ,

45o and ( xo , yo , zo ) (1, 1, 1) into eqns. (5.38 to 5.40), respectively. The resulting concatenated
matrix is given as
[T ] [Tt ]1.[Trz ]1.[Trx ]1.[Try ].[Trx ].[Trz ].[Tt ]

1
0

0
1
0
0

0
0
1
0

1 0.707 0.707 0 0 1
0
0
1 0.707 0.707 0 0 0 0.816 0.577
.
.
1 0
0
1 0 0 0.577 0.816

1 0
0
0 1 0
0
0

0 0.5
0 0
.
0 0.866

1 0

0
0
0 0.707 0.707
1
0 0.816 0.577 0 0.707 0.707

.
0 0.577 0.816 0 0
0

0
0
1 0
0
0

or

0.666 0.333 0.666


0.666
0.666 0.333
[T ]
0.333 0.666
0.666

0
0
0

0
0
1
0

0 0.866
1
0
0 0.5
0
0

0 1
0 0
.
0 0

1 0

0
1
0
0

0
0
.
0

0 1
0 1
1 1

0 1

0
0
0

The transformed coordinates of the vertices of cube are

0.666 0.333 0.666


0.666
0.666 0.333
X T T .X
0.333 0.666
0.666

0
0
0

0 1
0 1
.
0 2

1 1
E

2
1
2
1

2
2
2
1
G

1
2
2
1

1
1
1
1

2
1
1
1

2
2
1
1

1
2
1

1.666 2.333 2 1.333 1 1.666 1.333 0.666


0.666 1.333 2 1.333 1 1.666 2.333 1.666

1.666 1.333 2 2.333 1 0.666 1.333 1.666

1
1
1
1
1
1
1
1

73

You might also like