Computer Graphics
Computer graphics is an art of drawing pictures, lines, charts, etc. using computers with the help of
programming. Computer graphics image is made up of number of pixels. Pixel is the smallest addressable
graphical unit represented on the computer screen.
The term computer graphics has been used in a broad sense to describe “almost everything on computers
that is not text or sound” Typically, the term computer graphics refers to several different things:
• The representation and manipulation of image data by a computer
• The various technologies used to create and manipulate images
In computer graphics, two or three-dimensional pictures can be created that are used for research.
“Computer graphics is the use of a computer to define, store, manipulate, interrogate, and represent the
pictorial output.” An image in computer graphics is made up of a number of pixels.
Applications of Computer Graphics:
Computer Art: Using computer graphics we can create fine and commercial art which include
animation packages, paint packages. These packages provide facilities for designing object shapes and
specifying object motion. Cartoon drawing, paintings, logo design can also be done.
Computer Aided Drawing: Designing of buildings, automobile, aircraft is done with the help of
computer aided drawing, this helps in providing minute details to the drawing and producing more
accurate and sharp drawings with better specifications.
Presentation Graphics – It is used to summarize financial statistical scientific or economic data.
For example- Bar chart, Line chart.
Entertainment- It is used in motion pictures, music videos, television gaming.
Education: Computer generated models are extremely useful for teaching huge number of concepts
and fundamentals in an easy to understand and learn manner.
Visualization For analyzing scientific, engineering, medical and business data or behavior. Converting
data to visual form can help to understand mass volume of data very efficiently.
Graphical User Interface Multiple window, icons, menus allow a computer setup to be utilized more
efficiently.
Types of Computer Graphics
There are two kinds of computer graphics are–
Interactive Computer Graphics
Non-Interactive Computer Graphics
Interactive Computer Graphics In interactive computer graphics, users have some controls over the image,
i.e., the user can make any changes to the image produced. Interactive Computer Graphics involves computer-
user two-way communication. For Example:
Ping-pong game.
Drawing on touch screens.
Display weather forecast or other moving charts/graphs on the screen.
Animating pictures or graphics in movies.
Graphics animation in video games.
Advantages of interactive computer graphics
Improved User Interfaces
More precise results
Higher Quality resolution
Greater Productivity
Lower analysis and design cost
Significantly enhances our ability to understand data
Non- Interactive Computer Graphics Non-interactive computer graphics are also known as passive computer
graphics. It is a type of computer graphics in which the user has no control over the image. The photo is
completely controlled by the instructions of the program, not by the user.
For Example:
Screen savers.
Map representation of the data.
Graphic elements are used in the text, document, and PDF presentation.
Static images are used in mobile applications and websites.
Business graphics are used as brochures, business cards, menu of the hotel.
Representation of graphics
We can represent the graphics by following two ways:
1. Raster (Bitmap) Graphics
2. Vector Graphics
1. Raster Graphics: In raster graphics, the image is presented as a rectangular grid of colored squares. Raster
images are also called bitmap images. Bitmap images are stored as the collection of small individual dots called
pixels. Bitmap images require high resolution and anti-aliasing for a smooth appearance. For example– Paint,
Photoshop, etc.
2. Vector Graphics: In vector graphics, the image is represented in the form of continuous geometric objects:
line, curve, etc. Vector images are not based on pixel pattern. They use mathematical formulas to draw line
and curves. The lines and curves can be combined to create an image.
For Example– PowerPoint, Corel Draw, etc.
Difference between Raster and Vector Graphics
s. no. Raster Graphics Vector Graphics
1 Raster images are constructed Vector images are constructed
through pixels. through lines, curves, and fills.
2 We can easily convert a raster We cannot change the vector
file into any file format. files.
3 Raster prefers graphic formats Vector prefers graphic formats
such as BMP, TIFF, RAW, etc. such as SVG, AI, PDF, etc.
4 Raster images can be edited in Vector images can be edited in
programs like Photoshop,
programs like Adobe Illustrator,
Paint, etc. Sketch, CorelDraw, etc.
5 Raster images are less scalable.
Vector images can be scaled to
any size without losing quality.
6 Converting a raster image to a It's easy to convert a vector
vector image can be a complex image into a raster image.
and time-consuming process.
Visualization
Visualization is any technique for creating images, diagrams, or animations to communicate a message.
Visualization through visual imagery has been an effective way to communicate both abstract and concrete
ideas since the dawn of humanity.
Visualization today has ever-expanding applications in science, education, engineering (e.g., product
visualization), interactive multimedia, medicine, etc.
RGB color model
The RGB color model is one of the most widely used color representation method in computer graphics. It use
a color coordinate system with three primary colors:
R(red), G(green), B(blue)
Each primary color can take an intensity value ranging from 0(lowest) to 1(highest). Mixing these three
primary colors at different intensity levels produces a variety of colors.
Example:
(0, 0, 0) for black, (1, 1, 1) for white,
(1, 1, 0) for yellow, (0.7, 0.7, 0.7) for gray
The main application of the RGB color model is to display digital images. Cathode ray tubes, LCDs, and LED
displays, such as televisions, computer monitors, or large screens, utilize RGB technology.
CMYK color model
CMYK stands for Cyan Magenta Yellow Key (Black). It is the color model that is mainly employed in projects
that include printed materials. It employs the primary colors cyan, magenta, yellow, and black, which are
mixed to produce a variety of colors. The CMYK color model is a subtractive color model used in color printing
that also describes the printing process, commonly known as process color or four colors.
The subtractive model is defined by the notion that the more color is added, the more color is
eliminated from the white color. A white color is produced when all colors are combined to 0%. For
example, CMYK (0%, 0%, 0%, 0%) for white that produces a black color when all colors are mixed.
Although, by adding equal quantities of every color, grey color shades may be produced.
Difference between RGB and CMYK Color Model
RGB CMYK
1 RGB is an abbreviation for Red, CMYK is an abbreviation for
Green, and Blue. Cyan, Magenta, Yellow and K for
Black.
2 It is also known as the additive It is also known subtractive
color model because when color model, in which we start
these colors are added with with a white sheet of paper and
light, they produce a brighter add additional ink to produce a
outcome. dark outcome.
3 The yellow color is created by The yellow color is produced by
combining red and green light subtracting blue light from
white light.
4 The white color is created by The addition of CMYK colors
adding the RGB colors. yields black.
5 The RGB color model is mostly CMYK color model is primarily
utilized in display monitors to utilized in printing.
produce varied colors.
A lookup table
In computer science, a lookup table is an array that replaces runtime computation with a simpler array
indexing operation. The savings in terms of processing time can be significant, since retrieving a value from
memory is often faster than undergoing an "expensive" computation or input/output operation. The tables
may be pre-calculated and stored in static program storage, calculated (or "pre-fetched") as part of a
program's initialization phase (memorization), or even stored in hardware in application-specific platforms.
Over View of Graphic System
Due to the widespread recognition of the power and utility of computer graphics in virtually all fields, a broad
range of graphics hardware and software systems is now available. Graphics capabilities for both two-
dimensional and three-dimensional applications are now common on general-purpose computers, including
many hand-held calculators.
Cathode Ray tube
A cathode ray tube (CRT) is a specialized vacuum tube in which images are produced when an electron beam
strikes a phosphorescent surface. It is a technology which is used in traditional computer monitor. The CRT in
a computer display is similar to the "picture tube" in a television receiver.
Operation of CRT is very simple −
The electron gun emits a beam of electrons cathode rays
The electron beam passes through focusing and deflection systems that direct it towards specified
positions on the phosphor-coated screen.
When the beam hits the screen, the phosphor emits a small spot of light at each position contacted by
the electron beam.
It redraws the picture by directing the electron beam back over the same screen points quickly.
Direct View Storage Tube (DVST) resembles CRT as it uses electron gun to draw picture and
phosphor coated screen to display it. DVST does not use refresh buffer or frame buffer to store
picture definition. Picture definition is stored in inside CRT in form positive charged distribution.
Because of this reason DVST is knows as Storage Type CRT. In DVST no refreshing is required
as result picture drawn on DVST will be seen for several minutes before fading.
Function of guns: Two guns are used in DVST
1. Primary guns: It is used to store the picture pattern.
2. Flood gun or Secondary gun: It is used to maintain picture display.
Advantage:
1. No refreshing is needed.
2. High Resolution
3. Cost is very less
Disadvantage:
1. It is not possible to erase the selected part of a picture.
2. It is not suitable for dynamic graphics applications.
3. If a part of picture is to modify, then time is consumed.
Liquid crystal display (LCD): The LCD depends upon the light modulating properties of liquid crystals. LCD is
used in watches and portable computers. LCD requires an AC power supply instead of DC, so it is difficult to
use it in circuits. It generally works on flat panel display technology. LCD consumes less power than LED. The
LCD screen uses the liquid crystal to turn pixels on or off. Liquid Crystals are a mixture of solid and liquid.
Light Emitting Diode (LED): LED is a device which emits when current passes through it. It is a semiconductor
device. The size of the LED is small, so we can easily make any display unit by arranging a large number of
LEDs. LED consumes more power compared to LCD. LED is used on TV, smartphones, motor vehicles, traffic
light, etc.
Random Scan Display:
Random Scan System uses an electron beam which operates like a pencil to create a line image on the CRT
screen. The picture is constructed out of a sequence of straight-line segments. Each line segment is drawn on
the screen by directing the beam to move from one point on the screen to the next, where its x & y coordinates
define each point. After drawing the picture. The system cycles back to the first line and design all the lines of
the image 30 to 60 time each second.
Raster Scan Display:
A Raster Scan Display is based on intensity control of pixels in the form of a rectangular box called Raster on
the screen. Information of on and off pixels is stored in refresh buffer or Frame buffer. Televisions in our house
are based on Raster Scan Method. The raster scan system can store information of each pixel position, so it is
suitable for realistic display of objects. Raster Scan provides a refresh rate of 60 to 80 frames per second.
3D display devices
In the 2D system, we use only two coordinates X and Y but in 3D, an extra coordinate Z is added. 3D graphics
techniques and their application are fundamental to the entertainment, games, and computer-aided design
industries. It is a continuing area of research in scientific visualization.
Plotters are special output devices used to produce hard copies of large graphs and designs on paper. Plotter
is a printing device which can draw continuous lines. This is useful to print vector graphics rather than raster
graphics unlike normal printers. Plotters are widely used in applications like CAD.
It is suitable for applications:
1. Architectural plan of the building.
2. CAD applications like the design of mechanical components of aircraft.
3. Many engineering applications.
There are a number of different types of plotters:
Drum plotter - A drum plotter draws on paper wrapped around a drum which turns to produce one direction
of the plot, while the pens move to provide the other direction.
Flatbed plotter - A flatbed plotter draws on paper placed on a flat surface; and an electrostatic plotter draws
on negatively charged paper with positively charged toner.
Printer
Hardcopy is a printed copy of information from a computer. Sometimes it refer to as a printout, so it called
hardcopy because it exists as a physical object. Hardcopy is tangible output that usually printed.
A printer is a peripheral device which is used to represent the graphics or text on paper. The quality is
measured by its resolution. The resolution of any printer is measured in dot per inch (dpi).
Impact Printers: The printers that print the characters by striking against the ribbon and onto the
papers are known as Impact Printers. These printers are typically loud but remain in use today
because of their unique ability to function with multiple forms.
Dot-Matrix Printers: Dot Matrix is an impact printer. These printer forms characters from
individual dots. The print head has a two-dimensional array of pins called dot matrix. There may
be 9 to 24 pins in the dot matrix
Daisy Wheel- Head is lying on a wheel and pins corresponding to characters are like petals of
Daisy (flower) which is why it is called Daisy Wheel Printer.
The printer uses a metal or plastic disk containing each of the letters, numbers, and other
characters it supports. When printing, the printer rotates the disk to each character and, using a
hammer, strikes each character into an ink ribbon to create characters on paper.
Line printers: It is an impact printer and it is also known as a bar printer. It prints one
line of text at a time.
These are of two types −
1. Drum Printer - This printer is like a drum in shape hence it is called drum printer. The surface
of the drum is divided into a number of tracks. Total tracks are equal to the size of the paper,
i.e. for a paper width of 132 characters, drum will have 132 tracks.
2. Chain Printer In this printer, a chain of character sets is used, hence it is called Chain
Printer. A standard character set may have 48, 64, or 96 characters.
Non-impact printers: It is a type of printer that does not hit or impact a ribbon to the printer. They
used laxer, xerographic, electrostatic, chemical and inkjet technologies. Non-impact printers are
generally much quieter.
These printers are of two types –
Inkjet Printers
Laser Printers
Inkjet Printers Inkjet printers are non-impact character printers based on a relatively new technology. They
print characters by spraying small drops of ink onto paper. Inkjet printers produce high quality output with
presentable features.
Advantages
High quality printing
More reliable
Disadvantages
Expensive as the cost per page is high
Slow as compared to laser printer
Laser printer - Laser printer is a type of printer which makes use of a laser beam to produce an image on
the drum or you can say that it is a printer that makes use of a focused beam of light to transfer text and
images onto paper.
Advantages
Very high speed
Very high quality output
Good graphics quality
Supports many fonts and different character size
Disadvantages
Expensive
Cannot be used to produce multiple copies of a document in a single printing
Digitizer
Digitizer is an input device which converts analog information into digital form. Digitizer can convert a signal
from the television or camera into a series of numbers that could be stored in a computer. They can be used
by the computer to create a picture of whatever the camera had been pointed at.
Digitizer is also known as Tablet or Graphics Tablet as it converts graphics and pictorial data into binary inputs.
A graphic tablet as digitizer is used for fine works of drawing and image manipulation applications.
Light Pen Light pen is a pointing device similar to a pen. It is used to select a displayed menu item or draw
pictures on the monitor screen. It consists of a photocell and an optical system placed in a small tube.
When the tip of a light pen is moved over the monitor screen and the pen button is pressed, its photocell
sensing element detects the screen location and sends the corresponding signal to the CPU.
Graphics software
Graphics software is a type of computer program that is used to create and edit images. There is a wide
range of graphics software available on the market, ranging from simple programs that allow users to create
and edit basic images.
Some of the most popular graphics software programs include Adobe Photoshop, Corel Painter, and
Autodesk Maya.
Software Standard
Primary goal of standardize graphics software is portability so that it can be used in any hardware systems
& avoid rewriting of software program for different system
Some of these standards are discuss below
Graphical Kernel System (GKS)
This system was adopted as a first graphics software standard by the international standard organization
(ISO) and various national standard organizations including ANSI.
GKS was originally designed as the two dimensional graphics package and then later extension was
developed for three dimensions.
PHIGS (Programmer’s Hierarchical Interactive Graphic Standard)
PHIGS is extension of GKS. Increased capability for object modeling, color specifications, surface rendering,
and picture manipulation are provided in PHIGS.
Extension of PHIGS called “PHIGS+” was developed to provide three dimensional surface shading capabilities
not available in PHIGS.
Unit -2
Overview of Simple Raster Graphics Package (SRGP) - SRGP stands for Simple Raster
Graphics Package. SRGP consists of library functions that describe custom data types and
constants. SRGP procedures operate on canvases, which is a 2D array of pixels. The depth will
be the number of planes requested by the designated application. Every canvas has its local
coordinate system.
SRGP supports a basic collection of primitives: lines, polygons, circles and ellipses, and text. To specify a
primitive, the application sends the coordinates defining the primitive's shape to the appropriate SRGP
primitive-generator procedure. It is legal for a specified point to lie outside the screen's bounded 'rectangular
area; of course, only those portions of a primitive that lie inside the screen bounds will be visible.
Unit 3
Polygon:
Polygon is a representation of the surface. It is primitive which is closed in nature. It is formed using a collection
of lines. It is also called as many-sided figure. The lines combined to form polygon are called sides or edges.
The lines are obtained by combining two vertices.
Following figures shows some polygons.
Types of Polygons
1. Concave
2. Convex
1- Concave Polygon: A line segment joining any two points within the polygon which is not
completely inside the polygon is called a concave polygon.
2- Convex Polygon: A line segment joining any two points within the polygon which is
completely inside the polygon is called a convex polygon.
POLYGON FILLING
There are two approaches to fill the polygon:
1. Seed fill algorithms
2. Scan Line Algorithms
1- Seed fill algorithms -In this fill a polygon starts with a point known as a seed from inside polygon & highlight
outwards from this point through neighboring pixels until boundary pixels are encountered. This is known as
seed fill because color flows from seed pixel until reaching the polygon boundary.
The seed algorithm can be further classified into two algorithms: Flood Fill and Boundary filled.
Flood Fill Algorithm:
Sometimes it is required to fill in an area that is not defined within a single color boundary. In such cases area
can be filled by replacing a specified interior color instead of searching for a boundary. This approach is known
as flood fill.
Algo.
Function floodfill(x, y, fillcolor, previouscolor)
if (getpixel (x, y) = previouscolor)
setpixel (x, y, fillcolor);
floodfill( x+1, y, fillcolor,previouscolor);
floodfill( x-1, y, fillcolor,previouscolor);
floodfill( x, y+1, fillcolor,previouscolor);
floodfill( x, y-1, fillcolor,previouscolor);
getpixel() - The color of specified pixel.
setpixel() - Sets the pixel to specified color.
Program
#include <stdio.h>
#include<conio.h>
#include <dos.h>
#include <graphics.h>
void flood(int,int,int,int);
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:/TURBOC3/bgi");
rectangle(50,50,250,250); flood(55,55,10,0);
getch();
}
void flood(intx,inty,intfillColor, intdefaultColor)
{
if(getpixel(x,y)==defaultColor)
{
delay(1);
putpixel(x,y,fillColor);
flood(x+1,y,fillColor,defaultColor);
flood(x-1,y,fillColor,defaultColor);
flood(x,y+1,fillColor,defaultColor);
flood(x,y-1,fillColor,defaultColor);
}
}
Boundary Fill Algorithm:
The boundary fill algorithm uses polygon boundaries. It is also called an edge fill algorithm. In this method, a
seed point is taken in the polygon boundary and checks whether the adjacent or neighboring pixel is colored
or not. If the adjacent pixel is not colored then, fill it.
Alog
Function boundaryfill(x, y, color, color1)
int c;
c = getpixel(x ,y);
if (c! =color) & (c!=color1)
setpixel (x, y, color);
boundaryfill( x+1, y, color, color1);
boundaryfill( x-1, y, color, color1);
boundaryfill( x, y+1, color, color1);
boundaryfill( x, y-1, color, color1);
Program
#include <stdio.h>
#include<conio.h>
#include <dos.h>
#include <graphics.h>
void b_fill(int x, int y, int bc, int fc)
{
int p;
p=getpixel(x,y);
if((p!=bc) && (p!=fc)
{ putpixel(x,y,fc);
b_fill(x,y+1,bc,fc);
b_fill(x,y-1,bc,fc);
b_fill(x+1,y,bc,fc);
b_fill(x-1,y,bc,fc)
}}
void main()
{
int gd=DETECT,gm; initgraph(&gd,&gm,”c:\\tc\\bgi”);
settextstyle(5,HORIZ_DIR,3);
outtextxy(100,100,”Program to boundary fill”);
setcolor(10);
rectangle(260,200,310,260);
delay(1000);
b_fill(280,250,10,12);
getch();
}
Clipping
When we have to display a large portion of the picture, then not only scaling &
translation is necessary, the visible part of picture is also identified. This process
is not easy.
Clipping determines each element into the visible and invisible portion. Visible
portion is selected. An invisible portion is discarded.
Types of Lines:
Lines are of three types:
1. Visible: A line or lines entirely inside the window is considered visible
2. Invisible: A line entirely outside the window is considered invisible
3. Clipped: A line partially inside the window and partially outside is clipped.
For clipping point of intersection of a line with the window is determined.
The Cohen-Sutherland Algorithm for Line Clipping
The Cohen-Sutherland algorithm uses a region code to clip a portion of a line not present in the visible
region. It divides a region into 9 cells based on Xmin, Xmax, Ymin, and Ymax
Step1:Calculate positions of both endpoints of the line
Step2:Perform OR operation on both of these end-points
Step3:If the OR operation gives 0000
Then
line is considered to be visible
else
Perform AND operation on both endpoints
If And ≠ 0000
then the line is invisible
else
And=0000
Line is considered the clipped case.
Step4:If a line is clipped case, find an intersection with boundaries of the window
m=(y2-y1 )(x2-x1)
(a) If bit 1 is "1" line intersects with left boundary of rectangle window
y3=y1+m(x-X1)
where X = Xwmin
where Xwminis the minimum value of X co-ordinate of window
(b) If bit 2 is "1" line intersect with right boundary
y3=y1+m(X-X1)
where X = Xwmax
where X more is maximum value of X co-ordinate of the window
(c) If bit 3 is "1" line intersects with bottom boundary
X3=X1+(y-y1)/m
where y = ywmin
ywmin is the minimum value of Y co-ordinate of the window
(d) If bit 4 is "1" line intersects with the top boundary
X3=X1+(y-y1)/m
where y = ywmax
ywmax is the maximum value of Y co-ordinate of the window
Algorithm of cohen subdivision Line Clipping:
Step1: Calculate the position of both endpoints of the line
Step2: Perform OR operation on both of these endpoints
Step3: If the OR operation gives 0000
then
Line is guaranteed to be visible
else
Perform AND operation on both endpoints.
If AND ≠ 0000
then the line is invisible
else
AND=6000
then the line is clipped case.
Step4: For the line to be clipped. Find midpoint
Xm=(x1+x2)/2
Ym=(y1+y2)/2
Xmis midpoint of X coordinate.
Ymis midpoint of Y coordinate.
Step5: Check each midpoint, whether it nearest to the boundary of a window or not.
Step6: If the line is totally visible or totally rejected not found then repeat step 1 to 5.
Step7: Stop algorithm.
Cyrus–Beck algorithm
The CyrusBeck algorithm is a line clipping algorithm. It was designed to be more efficient than the Sutherlan
d–Cohen algorithm which uses repetitive clipping.
CyrusBeck is a general algorithm and can be used with a convex polygon clipping window unlike Sutherland-
Cohen that can be used only on a rectangular clipping area.
Algorithm:
Step 1: Every edge of normal edge is calculated.
Step 2: Clipping line of vector is calculated.
Step 3: Perform the product operation between the difference of one vertex per edge and one
selected end point of the clipping line and the normal of the edge is calculated .
Step 4: Perform product operation between the vector of the clipping line and the normal of edge is
calculated.
Step 5: The former dot product as to be divided with latter dot product and multiplied by -1.
Step 6: The values of ‘t’ are entering or exiting (from all edges) by observing their
denominators (latter dot product).
Step 7: From each group one value of ‘t’ has to be chosen,
and represent into parametric form of a line to calculate the coordinates.
Step 8: Suppose, the entered ‘t’ value is greater than the existing ‘t’ value,
then the clipping line has to be rejected.
Liang-Barsky Line Clipping
The Liang-Barsky algorithm is a line clipping algorithm.
This algorithm is more efficient than Cohen–Sutherland line clipping algorithm and can be extended to
3-Dimensional clipping.
This algorithm is considered to be the faster parametric line-clipping algorithm.
Algorithm –
1. Set tmin=0, tmax=1.
2. Calculate the values of t (t(left), t(right), t(top), t(bottom)),
(i) If t < tmin ignore that and move to the next edge.
(ii) else separate the t values as entering or exiting values using the inner
product.
(iii) If t is entering value, set tmin = t; if t is existing value, set tmax = t.
3. If tmin < tmax, draw a line from (x1 + tmin(x2-x1), y1 + tmin(y2-y1)) to (x1 + tmax(x2-
x1), y1 + tmax(y2-y1))
4. If the line crosses over the window, (x1 + tmin(x2-x1), y1 + tmin(y2-y1)) and (x1 +
tmax(x2-x1), y1 + tmax(y2-y1)) are the intersection point of line and edge.
Sutherland-Hodgeman Polygon Clipping:
It is performed by processing the boundary of polygon against each window corner or edge.
First of all entire polygon is clipped against one edge, then resulting polygon is considered,
then the polygon is considered against the second edge, so on for all four edges.
The following figures show how this algorithm works at each edge, clipping the polygon.
a. Clipping against the left side of the clip window.
b. Clipping against the top side of the clip window.
c. Clipping against the right side of the clip window.
d. Clipping against the bottom side of the clip window.
Sutherland Hodgman Algorithm:
Step 1: Read coordinates of all vertices of the polygon Step
2: Read coordinates of the clipping windows
Step 3: Consider the left edge of the window
Step 4: Compare the vertices of edge of the polygon, individually with the clipping plane
Step 5: According to four possible relationship between the edge and clipping boundary , Save the resulting
intersection and vertices in the new list of vertices
Step 6: Repeat the step 4 and 5 for removing edges or the clipping windows. Each time the resultant list of
vertices in successively passed to process the next edge of the clipping windows.
Step 7: Stop
Unit 5
Three Dimensional Graphics
The three-dimensional transformations are extensions of two-dimensional transformation. In 2D two
coordinates are used, i.e., x and y whereas in 3D three co-ordinates x, y, and z are used.
For three dimensional images and objects, three-dimensional transformations are needed. These are
translations, scaling, and rotation. These are also called as basic transformations are represented using
matrix. More complex transformations are handled using matrix in 3D.
Projection in Computer Graphics
Projection is the process of converting the 3D objects into 2D objects. Projection is also
defined as a mapping or transformation of the object in a projection plane or view plane. The
view plane is displayed surface.
Here are two types of projection: Parallel Projection and Perspective Projection.
(1) Parallel Projection: One method for generating a view of a solid object is to project points on the
object surface along parallel lines on to the display plane. By selecting different viewing positions, we
can project visible points on the object into the display plane to obtain different two-dimensional views
of the object.
This technique is used in engineering and architectural drawing to represent an object.
There are two primary types of parallel projections: orthographic projections and oblique projections.
Orthographic Projection
In orthographic projection the direction of projection is normal to the projection of the
plane. There are three types of orthographic projections −
Front Projection
Top Projection
Side Projection
Oblique Projection
In oblique projection, the direction of projection is not normal to the projection of plane. In oblique
projection, we can view the object better than orthographic projection.
There are two types of oblique projections − Cavalier and Cabinet. The Cavalier projection makes
45° angle with the projection plane. The projection of a line perpendicular to the view plane has the
same length as the line itself in Cavalier projection.
The Cabinet projection makes 63.4° angle with the projection plane. In Cabinet projection, lines
perpendicular to the viewing surface are projected at ½ their actual length.
(2) Perspective Projection: Another method for generating a view of a three-dimensional scene is to
project point to the display plane along converging paths. This causes objects further from the viewing
position to be displayed smaller than the object size that is nearer to the view position.
Two main characteristics of perspective are vanishing points and perspective foreshortening. Due to
foreshortening object and lengths appear smaller from the center of projection. More we increase the
distance from the center of projection, smaller will be the object appear.
Moreover, perspective projection can be further classified as one-point, two-point, and three-point. This
is based on the number of vanishing points possible on the view plane.