Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Comp Graphics

Computer graphics technical study

Uploaded by

mithunms5050
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Comp Graphics

Computer graphics technical study

Uploaded by

mithunms5050
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

MODULE 1

•Computer graphics generally refers to the


specific creation, storage and manipulation of
image data using a digital computer with the
help from a specialized graphical h/w or s/w.
•In a broad sense it includes everything on

computers that is not text or sound

Typically CG refers to
•Representation and manipulation of image
data by computer
•Various technologies used to create and
manipulate images
•The subfield of computer science which
studies methods for digitally synthesizing
and manipulate visual content.

APPLICATIONS OF COMPUTER
GRAPHICS
1.COMPUTER AIDED DESIGN (CAD)
2.PRESENTATION GRAPHICS
3.COMPUTER ART
4.ENTERTAINMENT
5.EDUCATION AND TRAINING
6.SCIENTIFIC VISUALIZATION
7.IMAGE PROCESSING
8.GUIS
9.DESKTOP PUBLISHING(DTP)

1.COMPUTER AIDED DESIGN (CAD)


•Graphics for engineering and architectural
system
• Design of building, automobile, aircraft,
machine etc.

AUTOCAD
•In design of buildings, automobiles, aircraft,
watercraft, spacecraft, computers, textiles etc.
•Multi window environment

•shows enlarged sections and different views


•Wireframe

•Show overall shape and internal features of


objects
•Electronics
•Design circuits and components
•Animations
•Real time animations using wireframe
displays on a video monitor are useful
for testing performance of a vehicle or system.

2.PRESENTATION GRAPHICS
•To summarize financial, statistical,
mathematical, scientific and economic data
•Examples
•Bar charts (2D, 3D)
•Line graphs
•Surface charts
•Pie charts
•Power point presentations

3.COMPUTER ART
•Any art in which computers play a role in
production or display of the artwork
•They are used in both fine art and commercial
art
• Fine artiste’s use a variety of technologies
like special purpose h/w , artist’s paint
brush program, other paint packages,
cad packages to produce image.
• In commercial art they are used for logos and
other design, advertising etc

4.ENTERTAINMENT
Computer graphics methods are now

commonly used in making motion


pictures,music videos,Games and television
shows
Games
•Interactive virtual worlds
Movies
•Animation
•Special effects
Television
•Cartoons - simple animation
•Advertisements - simple special effects (eg. Morphing)
5.EDUCATION AND TRAINING
•Computer-generated models of physical,
financial and economic systems are often used as
educational aid
•It can help trainees to understand the operation
of the system.
• Examples are the simulators for practice
sessions or training of
•Ship captains
• Aircraft pilots
• Heavy-equipment operators
• Air traffic control personnel.

6.SCIENTIFIC VISUALIZATION
•To analyze large amounts of data or to study the
behavior of certain processes
•Produce graphical representation
•Scientific, engineering and medical data sets

•Data sets
• scalar, vector also 2d and 3d
•For better visualization
•Color coding, graphs, charts, also
image processing with graphics
•Some applications
* Numerical visualization of ocean currents
* Thunderstorm simulation
* molecular visualization

7.IMAGE PROCESSING
•Computer manipulation of images.
•In CG a computer is used to create a picture,
on the other hand it applies techniques to
modify or interpret existing pictures such as
photographs & tv scans.
•Photo enhancement - sharpening blurred photos

•Medical Imaging-MRI,CT scan,Non invasive

internal examination
•Commercial art- enhancing images

8.GUIs
•GUI, A graphic, mouse-oriented paradigm which

allows the user to interact with a computer.


•Computer graphics methods now provides
GUIs for s/w packages.
•A major component of GUI is window
manager, which allows a user to display
multiple-window areas.
•Each window can contain graphical or non
graphical displays.
•A typical GUI contains a window manager that
holds icons, menus etc.
9.DESKTOP PUBLISHING(DTP)
•DTP is the creation of documents using page
layout skills on a PC primarily for print.
• It combines a pc and WYSIWYG(what you
see is what you get) page layout s/w to create
publication documents on a computer.
•It provide more control over design layout
than word processing
DIFFERENCE BETWEEN RASTER AND RANDOM SCAN
DISPLAYS

In raster scan displays an electron beam is swept across


the screen one row at a time. As the electron beam passes
the beam intensities are turned on to create a pattern of
illuminated spots. electron beam is directed only to the
parts of the screen where a picture is to be drawn. Random scan
monitors draw a picture one line at a time and for this reason are
also referred to as vector displays

SOME BASIC CONCEPTS


•PIXEL:
• The smallest element of an image that can be individually p
rocessed in a video display system.
• In Digital imaging, a pixel, pel, dots, or picture
element is a physical point in a raster image, or the
smallest addressable element in a display device.
•Pixels are arranged in rows and columns and are
lit up in a specific pattern to create an image
FRAMEBUFFER
•The portion of memory reserved for holding the complete
bit-mapped image that is sent to the monitor.
•This memory area holds the set of intensity values for all
the screen points.
• Stored intensity values are then retrieved from the frame
buffer and "painted" on the screen.
• Frame buffer containing 1 bit/pixel is called as bitmap
• Frame buffer containing more than 1 bit per pixel is
pixmap.

RASTER AND RANDOM SCAN DISPLAYS

THERE ARE TWO KINDS OF COMPUTER GRAPHICS –

1)RASTER (COMPOSED OF PIXELS) AND


2)VECTOR OR RANDOM (COMPOSED OF PATHS).

•Raster images are more commonly called bitmap images.


•Bitmaps are composed of pixels
•Vector graphics use mathematical relationships between
points and the paths connecting them to describe an
image.
•Vector graphics are composed of paths.
RASTER AND RANDOM SCAN DISPLAYS
BITMAP IMAGE

RASTER AND RANDOM SCAN DISPLAYS


Vector Image
RASTER SYSTEMS
•Almost all current computer output devices, including

CRTs, LCDs, LEDs, and plasma screens,use


raster graphics.
•In this systems, an electron beam is swept across the
screen, one row at a time from top to bottom.
•As the electron beam moves across each row, the beam
intensity is turned on and off to create a pattern of
illuminated spots.
RASTER AND RANDOM SCAN DISPLAYS

Electron beam in raster display

•Picture definition is stored in a memory area called the


refresh buffer or frame buffer.
•This memory area holds the set of intensity values for all
the screen points.
•Stored intensity values are then retrieved from the refresh
buffer and "painted" on the screen one row (scan line) at
a time
•The refreshing rate, called the frame rate, is normally 60
to 80 frames per second, or described as 60 Hz to 80 Hz

RANDOM-SCAN DISPLAYS
•Here The CRT's electron beam is directed only to the
parts of the screen where a picture is to be drawn.
•Random scan monitors draw a picture one line at a time
and for this reason are also referred to as vector displays
(or stroke-writing or calligraphic displays or line drawing
displays)

RASTER AND RANDOM SCAN DISPLAYS


Electron beam in Random scan display
•The picture definition is stored as a set of line-drawing
commands in a refresh display file or a refresh buffer in
memory.
•Random-scan displays are designed to draw all the
component lines of a picture 30 to 60 times each second
•A pen plotter operates in a similar way and is an
example of a random-scan device.
PROS AND CONS
•Raster systems
+ It is well suited for realistic display of scenes containing
colors and shaded patterns
- It produces jagged lines that are plotted as discrete
point sets
•Random systems(Vector)
+ They produce smooth line drawings because the CRT
beam directly follows the line path.
+ Used by both analog and digital computers
+ Vector displays generally have higher resolution than
raster systems
- Expensive
- Designed for line drawing applications and cannot
display realistic shaded scenes
Refresh cathode ray tube(CRT)
Most of the video monitors are based on the working
of Cathode Ray Tube. This lesson explains the working
of CRT and Components of CRT. Major Components
include Electron gun, Phosphor coated screen,
focusing and deflection systems. Malayalam
Tutorial of this topic is also included.
•The primary output device in a graphics system is a video
monitor.
•The operation of most video monitors is based on the
standard cathode-ray tube (CRT) design.
Important parts of CRT
•Phosphor screen
•Electron gun
•Heated metal cathode
•Control grid
•Accelerating anode
•Focusing system
•Deflection system
Working of CRT
•A beam of electrons (cathode rays), emitted by an electron
gun, passes through focusing and deflection systems that
direct the beam toward specified positions on the
phosphor coated screen.
•The phosphor then emits a small spot of light at each
position contacted by the electron beam
•Light emitted by the phosphor fades very rapidly, redraw the
picture repeatedly by quickly directing the electron beam
back over the same points. This type of display is called
a refresh CRT(Frequency at which picture is redrawn on
the screen:-Refresh Rate)

Refresh cathode ray tube(CRT)


Structure of CRT
Electron Gun

•Major elements are the heated metal cathode and the


control grid

•Heat is supplied to the cathode by directing a current


through filament
•This causes electrons to be ‘boiled off’ the hot cathode
surface
•Intensity of the electron beam is controlled by setting voltage
levels on the control grid
•A high positive voltage accelerates the free, negatively
charged electrons towards the phosphor coating
•A high negative voltage applied to the control grid will shut
off the beam by repelling electrons
•A smaller negative voltage on the control grid simply
decreases the no of electrons passing through.
•We control the brightness of a display by varying the
voltage on the control grid.
The accelerating anode

\
•The accelerating voltage can be generated with an
accelerating anode
•Sometimes the electron gun is built to contain the
accelerating anode and focusing system within the same
unit.

The focusing system

•Used to force the electron beam to converge into a small


spot as it strikes the phosphor.
• Focusing is accomplished with either electric fields or
magnetic fields
•Electrostatic focusing is commonly used in TV and computer
graphics monitors.
•With electrostatic focusing , the electron beam passes
through a positively charged metal cylinder that forms an
electrostatic lens.
•The action of the electrostatic lens focuses the electron
beam at the center of the screen.
•Magnetic lens focusing produces the smallest spot size on
the screen and is used in special purpose devices.

The deflection system


•The system is used to control the deflection
•When electrostatic deflection is used, two pairs of parallel
plates are mounted inside the CRT envelope.
•One pair of plates is mounted horizontally, to control the
vertical deflection, and the other pair is mounted vertically,
to control horizontal deflection

Phosphor screen
•Different kinds of phosphors are available for use in a CRT.
•Besides color, a major difference between phosphors is
their persistence:
•How long they continue to emit after the CRT beam is
removed.
•Persistence is defined as the time it takes the emitted
light from the screen to decay to one-tenth of its
original intensity.
•Lower persistence phosphors require higher refresh rates to
maintain a picture on the screen without flicker.
•A phosphor with low persistence is useful for animation;
•A high-persistence phosphor is useful for displaying
highly complex, static pictures
•Another important properties of phosphor
includes Resolution and Aspect Ratio
•The maximum number of points that can be displayed
without overlap on a CRT is referred to as the resolution.
•Number of pixels per square inch
•The ratio of vertical points to horizontal points necessary to
produce equal-length lines in both directions on the
screen is known as Aspect Ratio.
•An aspect ratio of ¾ means that a vertical line plotted with 3
points has the same length as a horizontal line plotted
with 4 points

Refresh cathode ray tube(CRT)

Color CRT monitors (Beam Penetration


Method)
Color CRT monitors are familiar to everyone. There are
different methods for producing Color CRT monitors.
One such method called Beam Penetration Method is
explained here. Beam Penetration Method is an important
topic in Computer Graphics. You can also
access Malayalam tutorial of this topic here
• A CRT monitor displays color pictures by using a
combination of phosphors that emit different-colored light
• By combining the emitted light from the different phosphors,
a range of colors can be generated
•The two basic techniques for producing color displays with a
CRT are
•The beam-penetration method
•The shadow-mask method

THE BEAM-PENETRATION METHOD


•The beam-penetration method for displaying color pictures
has been used with random-scan monitors.
•Two layers of phosphor, usually red and green, are coated
onto the inside of the CRT screen
•Displayed color depends on how far the electron beam
penetrates into the phosphor layers.
Color CRT monitors (Beam Penetration Method)
•A beam of slow electrons excites only the outer red layer.
•A beam of very fast electrons penetrates through the red layer
and excites the inner green layer.
•At intermediate beam speeds, combinations of red and green
light are emitted to show two additional colors, orange and
yellow.
•The speed of the electrons, and hence the screen color at any
point, is controlled by the beam-acceleration voltage.
•Beam penetration has been an inexpensive way to produce color in random-
scan monitors
•But only four colors are possible
•The quality of pictures is not as good as with other methods

Color CRT monitors (Beam Penetration Method)


Color CRT Monitors(Shadow Mask Method)
There are two methods for producing colors in CRT
monitors.They are beam penetration
method and shadow mask method. Both are important
topics in computer graphics. shadow mask method is
explained here .Malayalam Tutorial video is also
included
Shadow Mask Method
They are commonly used in raster scan systems
(including colorTV)
Because they produce a much wider range of colors than the
beam- penetration method.
A shadow-mask CRT has three phosphor color dots at each
pixel
position.
 One phosphor dot emits a red light, another emits a green
light,
and the third emits a blue light.
This type of CRT has three electron guns, one for each color
dot,and a shadow-mask grid which is pierced with small round
holes in a triangular pattern just behind the phosphor-coated
screen.

2 types of arrangements are possible


 In-line Method and delta delta method(Triad arrangement)
Delta- Delta method
Delta- Delta method is commonly used in color CRT systems

A shadow mask is often used to ensure that the electron


beams from the guns fall on the correct phosphors
The three electron beams are deflected and focused as a group
onto the shadow mask
When the three beams pass through a hole in the shadow mask,
they activate a dot triangle, which appears as a small color spot
on the screen.
The phosphor dots in the triangles are arranged so that each
electron beam can activate only its corresponding color dot when
it passes through the shadow mask.
 Color variations in a shadow-mask CRT are obtained by
varying the intensity levels of the three electron beams
A white (or gray) area is the result of activating all three dots
with equal intensity
A black is produced with zero intensity of all colors
Yellow=Red+ Green
Magenta=Red+Blue
Cyan= Blue +Green
This produce 8 colors

Inline arrangement
3 electron guns and the corresponding red-green-blue color
dots on the screen, are aligned along one scan line rather of in a
triangular pattern.
This inline arrangement of electron guns is easier to keep in
alignment and is commonly used in high-resolution color
CRT’s

In some low-cost systems, the electron beam can only be set
to on or off, limiting displays to eight colors.
 More sophisticated systems can set intermediate intensity
levels for the electron beams, allowing several million different
colors to be generated
Color CRTs in graphics systems are designed as RGB
monitors.
These monitors use shadow mask method and take the
intensity level for each gun.
 A RGB color system with 24 bits of storage per pixel is
known as full color system or true color system.

Pros & Cons of shadow mask method

Advantages

Produce realistic images


Million different colors to be generated
Shadow scenes are possible

Disadvantages
low resolution
expensive
COMPARISON BETWEEN SHADOW MASK AND BEAM
PENETRATION METHOD
Flat panel displays
Flat panel displays are class of a class of video devices
that have reduced volume,weight,and power requirements
compared to a CRT. This post explains about flat panel
displays and explains types of displays like plasma
panel, working of LCD,LED etc. Malayalam tutorial is also
included

◦A class of video devices that have reduced volume, weight,


and power requirements compared to a CRT.

◦A significant feature of flat-panel displays is that they are thinner


than CRTs, and we can hang them on walls or wear them on
our wrists.
◦Current uses for flat-panel displays include small TV monitors,
calculators, pocket video games, laptop computers etc

◦Flat-panel displays are divided into two categories:


◦ Emissive displays and
◦ Non emissive displays

◦The emissive displays (or emitters) are devices that convert


electrical energy into light. Ex: PLASMA PANEL,LED

◦Non emissive displays (or non emitters) use optical effects to


convert sunlight or light from some other source into graphics
patterns
EX: LCD

PLASMA PANEL DISPLAYS

•Plasma panels, also called gas-discharge displays,


are constructed by filling the region between two glass plates
with a mixture of gases that usually includes neon.
•Firing voltages applied to a pair of horizontal and vertical
conductors cause the gas at the intersection of the two
conductors to break down into a glowing plasma of electrons
and ions.
•Picture definition is stored in a refresh buffer, and the firing
voltages are applied to refresh the pixel positions 60 times per
second.
•Major advantage of gas plasma is that it produces Flicker free
display
•Disadvantage: Relatively poor resolution(60 dots /inch)
LIGHT EMITTING DIODES(LED)
◦A matrix of diodes is arranged to form the pixel positions in the
display, and picture definition is stored in a refresh buffer.
◦Information is read from the refresh buffer and converted to
voltage levels that are applied to the diodes to produce the light
patterns in the display

LIQUID CRYSTAL DISPLAY(LCD)


◦They are commonly used in small systems, such as
calculators,TVs and portable laptop computers.
◦These non emissive devices produce a picture by
passingpolarized light from the surroundings or from an
internal light source through a liquid-crystal material that can
be aligned to either block or transmit the light.
◦The term liquid crystal refers to the fact that these
compoundshave a crystalline arrangement of molecules, yet
they flow like a liquid.
◦Flat-panel displays commonly use nematic (threadlike) liquid-
crystal compounds that tend to keep the long axes of the rod-
shaped molecules aligned.
STRUCTURE OF LCD

•Two glass plates, each containing a light polarizer at right


angles to the-other plate,sandwich the liquid-crystal material.
• Rows of horizontal transparent conductors are built into one
glass plate, and columns of vertical conductors are put into the
other plate.
• The intersection of two conductors defines a pixel position.
WORKING OF LCD

• Polarized light passing through the material is twisted so that it


will pass through the opposite polarizer.
• The light is then reflected back to the viewer.
• To turn off the pixel, we apply a voltage to the two intersecting
conductors to align the molecules so that the light is not twisted.
• This type of flat-panel device is referred to as a passive-matrix
LCD.
•Colors can be displayed by using different materials or dyes and by
placing a triad of color pixels at each screen location.
•Another method for constructing colors is to place a transistor
at each pixel location, using thin-film transistor technology.
•The transistors are used to control the voltage at pixel locations
and to prevent charge from gradually leaking out of the liquid-
crystal cells.
•These devices are called active-matrix displays.

MODULE 2
DIGITAL DIFFERNTIAL ANALYZER
ALGORITHM(DDA)
Output Primitives
•Basic geometric structures from which an image can be formed
•Point
•Line
•Circle
•Conic Sections
•Primitive operations
•putpixel ( x, y, color)
•getpixel (x, y )

Scan conversion
•Process of converting basic low level objects into their
corresponding pixel map representations
•Scan Conversion of line- DDA line Drawing Algorithm

•Scan Conversion of circle – Bresenham’s Circle


generatingAlgorithm

DIGITAL DIFFERENTIAL
ANALYZER(DDA)
•It is a line drawing algorithm which uses cartesian slope intercept
equation of straight line
•Line drawing is accomplished by calculating intermediate point
coordinates along the line path between two given end points.
•Disadvantage is the use of round off operations and round off
errors

BASIC CONCEPTS OF DDA

•The Cartesian slope-intercept equation for a straight line is


Y=m.x+b --------->1
•with m representing the slope of the line and
• b as the intercept.
•Given that the two endpoints of a line segment are specified at
positions (x1, y1) and (x2, y2)
•Slope m= (y2-y1)/(x2-x1)
Line path between endpoint positions (x1, y1) and (x2, y2).

•There are 3 cases based on value of m


Case 1:m<1
•X changes with unit interval
•x =x +1
k+1 k

•Y changes with deviation


•y =y +m
k+1 k

•New point is

(x , y )=(x +1, y +m)


k+1 k+1 k k

Case 2:m>1

•X changes with deviation


•x =x +1/m
k+1 k

•Y changes with unit interval


•y =y +1
k+1 k
•New point is

(x , y )=(x +1/m, y +1)


k+1 k+1 k k

Case 3:m=1

•x changes with unit interval


•x =x +1
k+1 k

•y changes with unit interval


•y =y +1
k+1 k

•New point is
(x , y )=(x +1, y +1)
k+1 k+1 k k

DIGITAL DIFFERNTIAL ANALYZER


ALGORITHM(DDA)
Step1: Read the end points of line and store them in(x1,y1)
and (x2,y2)
Step2: Calculate slope m=(y2-y1)/(x2-x1)
Step3:Repeat step 4 until endpoint reaches
Step4: Based on value of m there are 3 cases
Step 4.1: if m<1
Step4.1.1 : X changes with unit interval x =x +1 k+1 k

Step4.1.2 : Y changes with deviation y =y +m k+1 k

Step4.1.3 : Call putpixel(Round((x +1, y +m)))


k k

Step 4.2: if m>1


Step4.2.1 : X changes with deviation x =x +1/m
k+1 k
Step4.2.2 : Y changes with unit interval y =y k+1 k+1

Step4.2.3 : Call putpixel(Round(( x +1/m, y +1))


k k

Step 4.3: if m=1


Step4.3.1 : X changes with unit interval x =x k+1 k+1

Step4.3.2 : Y changes with unit interval y =y k+1 k+1

Step4.3.3 : Call putpixel(Round(( x +1, y +1))


k k

Example : (10,10) &(15,16)


•X1=10 x2=15 & y1=10 y2=16
•M= (y2-y1)/(x2-x1) --> (16-10)/(15-10)= 6/5= 1.2 --> m=1.2
•M<1 --> y changes with unit interval and x changes with
deviation 1/m =1/1.2=0.83
Bresenham’s Circle Generating Algorithm
Basics

–Bresenham’s circle generating algorithm is used for scan


conversion of circles
–It uses the symmetric property of circle
–3600circle can be divided in to 8 octants each of 450
–we use the algorithm to draw pixels for the first octant only
–Then using symmetry all others pixel positions are drawn
Bresenham’s Circle Generating Algorithm

Algorithm
Bresenham's Circle Generating Algorithm
Example
Draw a circle with center (0,0 and radius=3
Xc=0,Yc=0, r=3,Assign X=0, y=r⇒y=3
Initial value of p=3-2r →3-2*3 =-3_p=-3)
POLYGON FI LLI NG
•Given vertices of a polygon and a colour , our aim is to
fill the polygon with the particular colour
•2 methods
–Boundary method
•Intersect polygon with horizontal lines and
fills the polygon between pairs of intersection
•Used with simple objects
– Fill method
•Start from an interior position and paint until
the boundary condition reached
•Complex objects, Interactive paintings
SCANLI NE POL YGO N FILLING
AL GO RITH M
•Filling up of polygons using horizontal lines or scanlines
•Purpose is to fill the interior pixels of a polygon , given only
vertices and edges of the figure
•Algorithm works by intersecting scanline with the polygon edges
and fill the polygon between pairs of intersection
BASIC CONCEPTS

•There are 3 steps to perform in order


–Find the intersections of the scanline with all edges of the
polygon
–Sort the intersections by increasing x coordinates, ie. from
left to right
–Make pairs of intersections and fill in colour within all the
pixels inside the pair

Simple example

•List of intersection points --> 8,12,16,20


•Sorted order will be -->8,12,16,20
•Make pairs of intersection -->(8,12),(16,20)
•Fill in all the pixels with the given colour inside the pixel

SPECIAL CASES
•Some scan line intersections at polygon vertices requires
special handling
•A scan line passing through vertex intersects two
polygon edges at that position adding two points to the
list of intersections for the scanline

•2 cases
–If both lines intersecting at the vertex are on the same side of the

scanline , consider it as two points

–If lines intersecting at the vertex are on the opposite side of the

scan line consider it as a single point

Special case in polygon filling


•Scan line y’ is intersecting with 4 edges and passing
through a vertex
•Here edges at vertex are on same side of the scanline . So
count the vertex twice
•The pairs of intersection points are (8,12),(12,14)
* Scanline y is intersecting with 5 edges and also passing through a
vertex
*The edges are on opposite side of the vertex. So count the vertex
as single intersection point
*The pairs of intersection points are (6,16),(20,22)

MODULE 3
Basic GeometricTransformations
Basic geometric transformations include Translation,
Rotation and Scaling. Transformation means to change
the size, shape or orientation of an object.
• Transform=change some attributes/primitives of
graphic objects• changes can be in size, shape,
orientation...

•Basic Transformations

• Translation (change in position - linear)


• Rotation (change in orientation - circular)
• Scaling (change in size)
•Other Transformations...
• Reflection (mirror image)
• Shearing (distortion)
Translation (change in position)
* Rigid body transformation
* movement of the obj from one point to another
* specify the (Tx, Ty)
[translation factor or translation vector or shift vector]
Point (x,y) translation vector (Tx,Ty)
new values x ‘ = x + Tx
y ‘ = y + Ty
In general if we have point P, by applying translation
new value of P as P ‘ = P + T
MATRIX REPRESENTATION

Scaling (changing size of the object)


* supply the scaling factor (Sx, Sy)
Point (x,y) & Scaling factor (Sx, Sy)
new values x ‘ = x * Sx
y ‘ = y * Sy
Sx, Sy takes +ve values only
(Sx,Sy) > 1 enlarge the object size
(Sx,Sy) < 1 reduce the object size
Scaling
Uniform Scaling (Sx=Sy)
Differential Scaling (Sx!=Sy)
MATRIX REPRESENTATION

•P’ = P * S

Scaling wrt a fixed point (Xf,Yf)


x ‘ = Xf + (x - Xf) * Sx
y ‘ = Yf + (y – Yf) * Sy

Rotation (Change in orientation)


Transforming the object points along a circular path
defining parameter is 𝛉
* It is a rigid body transformation
𝛉 +ve value means anti-clockwise rotation
-ve value means clockwise rotation
pivot point – a point about which the object is rotated
Rotation wrt origin (0,0)

using trigonometric eqns

x ‘ = r cos (f + q ) = r cos f cos q - r sin f sin q

y ‘ = r sin (f + q ) = r sin f cos q + r cos f sin q

Polar coordinates of Point (x,y)

x = r cos f and y = r sin f

Sub the values

x ‘ = x cos q - y sin q

y ‘ = x sin q + y cos q
MATRIX REPRESENTATION

Rotation wrt a Fixed Point (Xr, Yr)


x’ = Xr + (x - Xr) cos  – (y - Yr) sin 
y’ = Yr + (x - Xr) sin  + (y – Yr) cos 

Homogenous Coordinate Representation


of Geometric Transformations
PREREQUISITES
Matrix representations of basic geometric transformations
are given below

TRANSLATION
SCALING

ROTATION

BASICS
• Basic geometric transformations can be represented in general
matrix form
P’=M1*P+M2
•P’ and P are coordinate positions represented as column
vectors
•M1 is a 2x2 matrix containing multiplicative terms
•M2 is a 2 element column vector containing
translational terms
•For translation M1 is the identity matrix

•For rotation and scaling M2 contains translational terms

associated with pivot point or scaling fixed point


HOMOGENOUS COORDINATE REPRESENTATION OF
GEOMETRIC TRANSFORMATION

•To represent any 2D transformation as matrix multiplication,


we represent each coordinate position (x,y) with homogenous
coordinate tuple(xh,yh,h)
• Xh =x/h
•Yh=y/h
•A convenient choice is to set h=1
•Each 2D position is then represented with
homogenous coordinates
•Allows us to represent all geometric transformation equation as a
matrix multiplication
•Homogenous coordinate representations of basic

geometric transformations are given below

TRANSLATION

•P’ = P * T(TX. TY)


ROTATION
 P' = P * R(

SCALING
P’ = P * T(Sx,Sy)

Reflection in Computer Graphics


Geometric transformations are an important concept
in Computer Graphics. Basic Geometric
transformations include translation , Rotation and
scaling. Reflection and shear are other 2 important
transformations. Reflection rotates the object in 180 0
gives mirror image of the object wrt the axis of
reflection.
Reflection wrt X axis

Matrix
no change in X values
Change in Y values only

Position of reflected point can be calculated


from the equation
Reflection wrt Y axis

Matrix
no change in Y values
Change in X values only

Position of reflected point can be


calculated from the equation
Reflection wrt XY plane

Matrix
X’ = -X
Y’ = -Y

Position of reflected point can be calculated from the


equation
Reflection wrt Y = X diagonal\

Matrix
X’ = Y
Y’ = X
Position of reflected point can be calculated
from the equation

2D Transformation SHEAR
*A Transformation that distorts the shape of an object

such that the transformed shape appears as if the

object was composed of multiple internal layers that

are caused to slide over each other


–2 types
X directional shear
Y directional shear
X D Shear matrix

EXAMPLE OF X-DIRECTIONAL SHEAR


Y Directional Shear
No change in X values
Change in Y values
Shear factor Shy determines the Y displacement in Y D Shear

EXAMPLE OF Y-DIRECTIONAL SHEAR


MODULE 4
WINDOW TO VIEWPORT TRANSFORMATION
The Viewing Pipeline
(rectangular area is the standard)

Window
´ area where image is viewed in real world (in real world coordinates)
´world coordinate area
´ defines what is to be displayed

View Port
´ area where image is viewed in o/p device (in device coordinates)
´ display device coordinate area
´ defines where it is to be displayed

WINDOW TO VIEWPORT TRANSFORMATION

Window to View port Transformation or Windowing


Transformation or Viewing Transformation
WINDOW ------------------------------------- VIEWPORT
*For every point (Xw,Yw) in the window there is
a corresponding or equivalent or relative point (Xv, Yv) in
view port
So, window to view port transformation involves
SCALING AND TRANSLATION

What Is Clipping?

The process of eliminating the portions outside


the window
2 types

* w.r.t. window

clip while selecting the window

* w.r.t. view port

clip after saving the image to the view port

Clipping
is an inside-outside procedure
It includes
Define the window area
Discarding portions outside window

before clipping
after clipping

Classifications
*Point Clipping
* Line Clipping
* Polygon Clipping

Point Clipping

Decide whether a point (x,y) is inside/outside


the window
Conditions
x should fall between Xwmin & Xwmax
y should fall between Ywmin & Ywmax
Xwmin <= x <= Xwmax
Ywmax <= y <=Ywmax
means 4 inequalities
x >= Xwmin
x <= Xwmax
and
y >= Ywmin
y <=Ywmax
If point(x,y) satisfy all 4 inequalities then
save the point
else
clip the point
COHEN SUTHERLAND LINE CLIPPING
ALGORITHM
Cohen Sutherland algorithm is a line clipping algorithm used
in Computer Graphics .
Clipping is done using a 9 region code. Algorithm is
explained in detail with example.
BASICS

With respect to a window ,the line can be


* perfectly inside (L1)
* perfectly outside (L2)
* partial inside (L3)
* endpoints outside, line segment inside (L4)
If the line is...

...perfectly inside (L1) --- accept the line


...perfectly outside (L2) --- reject the line
...crosses window boundary --- clip the line
Region Code Generation

Cohen-Sutherland Line Clipping


Algorithm

*uses a coding scheme where each endpoint


is assigned a region code
*will specify the endpoint w.r.t. to each
window boundary
*region code = 0 if inside boundary
*region code = 1 if outside boundary
Example
consider the figure

*line L1
ENDPOINTS
0000
0000
-----------AND
0000
Completely inside
*line L2
ENDPOINTS
0100
0100
-----------AND
0100
Completely inside
LINES AFTER CLIPPING

SUTHERLAND AND
HODGEMAN POLYGON CLIPPING

•Polygon is a set of lines joined together


•Polygon clipping has 4 stages
•Left clip
•Right clip
•Top clip
•Bottom clip
•For each stage there are 4 cases to be checked for

Case1:if moving from... outside to inside Reject the start


point & save the intersection point on window boundary and
the vertex
Case2:if moving from…inside to inside save second vertex

Case 3:if moving from..inside to outside save intersection point


&reject the end point
Case 4:if moving from.. outside to outside save none

EXAMPLE
DISADVANTAGE
•This algorithm will not clip the concave
polygon properly
•A line is created through the window boundary

MODULE 5
RGB COLOR MODEL

Here we discuss about an important color model RGB. RGB is


an additive color model For computer displays uses
light to display color , Colors result
from transmitted light.
◦RGB is an additive color model For computer displays
uses light to display color , Colors result from
transmitted light

◦Red+Green+Blue = White

•Unit Cube defined on R, G & B axes.

•The Origin (0,0,0) represents black and the diagonally


opposite vertex (1,1,1) is White.

•Vertices of the cube on the axes represent


primary colors, and the remaining vertices are the
complementary color points for each of the primary
colors.

•Shades of gray are represented along the main


diagonal.
YIQ Color Model
YIQ model is used for US TV broadcast.
•This model was designed to separate chrominance (I and Q)
from luminance (Y).
•This was a requirement in the early days of color television
when black-and-white sets still were expected to pick up and
display what were originally color pictures
•The Y-channel contains luminance information (sufficient
forblack-and-white television sets) while the I and Q channels
carried the color information.
◦A color television set would take these three channels, Y, I, and
Q, and map the information back to R, G, and B levels for
display on a screen.
◦The advantage of this model is that more bandwidth can be
assigned to the Y-component (luminance) because the human
visual system is more sensitive to changes in luminance than to
changes in hue or saturation
Convert From RGB To YIQ

Convert From YIQ To RGB

DIRECT VIEW STORAGE TUBE [DVST]


 It is a CRT with a long persistence phosphor.
 Provides flicker free display.
 An alternative method for maintaining a screen image is to
store the picture information inside the CRT instead of
refreshing the screen.
 A direct-view storage tube (DVST) stores the picture
information as a charge distribution just behind the phosphor-
coated screen.(ie. On storage grid)
 Two electron guns are used in a DVST.
 One, the primary gun(storage grid), is used to store the picture
pattern;
 the second, the flood gun, maintains the picture display.
 Advantages:- Because no refreshing is needed, very complex
pictures can be displayed at very high resolutions without
flicker.
 Disadvantages:-they ordinarily do not display color and that
selected parts of a picture cannot he erased.
 To eliminate a picture section, the entire screen must be
erased and the modified picture redrawn

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

Graphics Software
 A graphics software is an intermediary between an
application program & the graphics hardware.
 The output primitives & interaction devices that a
graphics package supports can range from rudimentary
to extremely rich.
 There are two general classifications for graphics
software:
 General Programming packages: provides an
extensive set of graphics functions that can be used in a
high-level programming language, such as C or
FORTRAN.
 Basic functions in a general package include those for
generating picture components (straight line, circle,
polygon etc),setting color and intensity values, &
applying transformations.
 Special-purpose applications packages: Designed for
nonprogrammers, so that users can generate displays
without worrying about how graphics operations work.
 Example of such application packages are the artist’s
painting programs and various business,medical and
CAD systems.
 Graphics Functions
 These packages provides users with a variety of
functions for creating & manipulating pictures.
  Output primitives: basic building blocks.
  Attributes: properties of the output primitives.
  Geometric transformations: changing size, position
& orientation.
 Modeling transformations: construct scene using
object descriptions.
  Viewing transformations: are used to specify the
view that is to be presented.
  Input Functions: used to control & process the data
flow from the interactive devices such as mouse, tablet
or joystick.
 Control operations: contains no. of housekeeping
tasks such as clearing a display screen & initializing
parameters.
 Software Standards
 A standard graphics package such as GKS(Graphical
kernal system) & PHIGS (Programmers Hierarchical
Interactive graphics system) implements a specification
designated as standard by an official national or
international standard bodies by ISO and
ANSI(American National Standard Institute).
 The main purpose of such standards is to promote
portability of application programs & of programmers.
 Non-official standards are also developed, promoted &
licensed by individual companies or by consortia of
companies eg Adobe’s Post script & MIT’s X window
system are two industry standards.

 GKS originally designed as a 2-D graphics


packages, a 3-D GKS extension was subsequently
developed

 PHIGS is a extension of GKS having increased


capabilities for object modeling, color specification,
surface rendering etc.

 Extension of PHIGS called PHIGS+ provide 3-D


surface shading capabilities.

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

You might also like