0% found this document useful (0 votes)
142 views377 pages

Complete CG Full Notes (PPT & PDF

Computer graphics involves the creation and manipulation of images on a computer using programming. It uses data structures, graphics algorithms, and programming languages to generate and transform pictures. Computer graphics can be interactive, allowing user control, or non-interactive, where the images are static. It has many applications including computer-aided design, presentations, image processing, computer art, entertainment, education and training, and graphical user interfaces.

Uploaded by

Abhishek yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views377 pages

Complete CG Full Notes (PPT & PDF

Computer graphics involves the creation and manipulation of images on a computer using programming. It uses data structures, graphics algorithms, and programming languages to generate and transform pictures. Computer graphics can be interactive, allowing user control, or non-interactive, where the images are static. It has many applications including computer-aided design, presentations, image processing, computer art, entertainment, education and training, and graphical user interfaces.

Uploaded by

Abhishek yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 377

COMPUTER

GRAPHICS
(Mr. Gaurav Srivastava)
WHAT IS COMPUTER GRAPHICS ?
 Computer graphics is an art of drawing pictures on computer screens
with the help of programming. It involves computations, creation, and
manipulation of data.
 In other words, we can say that computer graphics is a rendering tool for
the generation and manipulation of images.
 Computer graphics are graphics created by computers and, more
generally, the representation and manipulation of pictorial data by a
Computer Graphics = Data Structures + Graphics Algorithm+ Languages
computer.

1. Data Structure means those data structure that are suitable for
computer graphics.
2. Graphics algorithm for picture generation & transformation.

3. Language i.e., higher-level languages for generation of graphics objects


& pictures.
CHARACTERISTICS OF COMPUTER GRAPHICS
 It has ability to show moving pictures and thus it is possible to produce
animations with computer graphics.

 With computer graphics user can also control the animation speed ,
portion of the view , the goniometric relationship the object in the scene
to one another, the amount of detail shown and on.

 The computer graphics provides tool called “motion dynamics”. With this
tool user can move & tumble objects with respect to a stationary
observer, or he can make objects stationary and the viewer moving
around them.
CHARACTERISTICS OF COMPUTER GRAIPHCS

 The computer graphics also provides facility called “update dynamics”.


With update dynamics it is possible to change the shape, color or other
properties of the objects being viewed.

 It provides tools for producing pictures not only of concrete, “real-world”


objects but also of abstract ,synthetic objects, such as mathematical
surfaces in 4D and of data that have no inherent geometry such as
survey result.
ADVANTAGES

Advantages Of Computer Graphics


1. Increases Usability
2. Product Development and Research
3. Employment Opportunities
4. Designing
5. Teaching Learning activities becomes easy
Disadvantages of Computer Graphics1. Complexity
2. Expensive
3. Limitations
4. Cost Ineffective
5. Increase Heat and Weight of system
1. .
TYPES OF COMPUTER GRAPHICS

 Computer graphics has been classified into two categories according to


the application domain and requirements.

1. Non-Interactive Computer Graphics OR


Passive Computer Graphics OR Offline Computer Graphics .

2. Interactive Computer Graphics OR Online Computer Graphics.


NON INTERACTIVE COMPUTER GRAPHICS

 It is also known as passive computer graphics.

 It is computer graphics in which user does not have any kind of control
over the image.

 Image is merely the product of static stored program and will work
according to the instructions given in the program linearly.

 The image is totally under the control of program instructions not under
the user.

 For Example : screen savers a static website, & a TV-monitor.


INTERACTIVE COMPUTER GRAPHICS
 It is also called as on-line graphics.

 The user can interact with the machine as per his requirements.

 In this, the user has control over picture.

 Interactive Computer Graphics involves a two way communication


between computer and user .

 For example: Videogames, Dynamic websites, special effects in movies ,


cartoons etc.
 Interactive computer graphics affects our lives in a number of indirect
ways.
 For example: It helps to train the pilots of our airplanes for this we can
create a flight simulator which may help the pilots to get trained not in a
real aircraft but on the grounds at the control of the flight simulator.
OTHER CATEGORIES OF COMPUTER GRAPHICS

1.BUSINESS/ PRESENTATION GRAPHICS:


It includes bar charts, pie charts , x-y charts etc. to present quantitative
information to users.

2. SCIENTIFIC GRAPHICS:
It includes x y- plots, curve fitting, contour plots, flowcharts etc.

3. SCALED DRAWING :
It includes drawing of buildings , bridges and machines.
APPLICATION OF COMPUTER GRAPHICS

1. COMPUTER-AIDED DESIGN

 A major use of computer graphics is in design processes, particularly for


engineering and architectural systems, but almost all products are now
computer designed. Generally referred to as CAD as Computer-Aided
Design.

 Its methods are routinely used design of Buildings, Automobiles, Aircraft,


Watercraft Spacecraft, Computers, Textiles and many, many other
products.

 Design applications object are first displayed in a wireframe outline form


that shows the overall shape and internal features of objects. Wireframe
displays also allow designers to quickly see the effects of interact the
adjustments to design shapes

 CAD is used in the design of tools and machinery and in the drafting &
design of all types of building, from small residential types (houses) to
the largest commercial and industrial structures(hospital & factories).
2. PRESENTATION GRAPHICS
 It is used to produce illustrations for reports or to generate 35-mm slides
or transparencies for use with projectors.
 It is commonly used to summarize financial, statistical, mathematical,
scientific, and economic data for research reports, managerial reports,
consumer information bulletins, and other types of reports.
 Workstation devices and service bureaus exist for converting screen
displays into 35-mm slides or overhead transparencies for use in
presentations.
Example:
 Bar charts
 Line graphs
 Pie charts
 Time charts

 Two-dimensional & three dimensions graphics combined with


geographical information.
 Time charts and task network layouts are used in project management
to schedule and monitor the progress of reports.
3. IMAGE PROCESSING
 Methods used in computer graphics and Image processing overlap, the
two areas are concerned with fundamentally different operations.
1. In computer graphics, a computer is used to create a picture.
2. Image processing, applies techniques to modify or interpret existing
pictures, such as photographs and TV scans.
 Two principal applications of image processing are:
1.Improving picture quality
2. Machine perception of visual information, as used in robotics.
To apply its methods:
1. Digitize a photograph or other picture into an image file.
2. Then digital methods can be applied to rearrange picture parts,
to enhance color separations, or to improve the quality of shading.

• These techniques are used extensively in commercial art applications


that involve the retouching and rearranging of sections of photographs
and
other artwork.
 Medical applications also make extensive use of it techniques for picture
enhancements, in tomography and in simulations of operations.
 Tomography is a technique of X-ray photography that allows cross-
sectional views of physiological systems to be displayed.
 X-rav tomography (CT) and position emission tomography (PET) uses
projection methods to reconstruct cross sections from digital data. These
techniques are also used to monitor internal functions and show cross
sections during surgery.

 Ultrasonic scanner is a high-frequency sound waves, instead of X-rays,


are used to generate digital data.

 Nuclear medicine scanner collects digital data from radiation emitted


from ingested radio nuclides and plot color coded images.
COMPUTER ART
• Computer graphics used in fine art & commercial art
• Includes artist’s paintbrush programs, paint packages, CAD packages and
animation packages
• These packages provides facilities for designing object shapes & specifying
object motions.
• Examples : Cartoon drawing, paintings, product advertisements, logo design
• Morphing
• A graphics method in which one object is transformed into another
ENTERTAINMENT

 Movie Industry
 Used in motion pictures, music
 videos, and television shows.
 Used in making of cartoon
 animation films

Slide information from Leonard McMillian's slides


http://www.cs.unc.edu/~mcmillan/comp136/Lecture1/compgraf.ht
ml
• Game Industry
• Focus on interactivity
• Cost effective solutions
• Avoiding computations and
other tricks
EDUCATION & TRAINING

• Computer generated models of physical, financial and economic systems are


used as educational aids.

• Models of physical systems, physiological systems, population trends, or


equipment such as color-coded diagram help trainees understand the operation
of the system.
 Specialized systems used for training applications:
 simulators for practice sessions or training of ship captains

 aircraft pilots

 heavy equipment operators

 air traffic-control personnel


GRAPHICAL USER INTERFACES
 It is common now for software packages to provide a graphical interface.
 A major component of a graphical interface is a window manager that
allows a user.
 To display multiple-window areas. Each window can contain a different
process that can contain graphical or non-graphical displays. To make a
particular window active, we simply click in that window using an
interactive pointing device.

 Interfaces also display menus and icons for fast selection of processing
options or parameter values.

 An icon is a graphical symbol that is designed to look like the processing


option it represents. The advantages of icons are that they take up less
screen space than corresponding textual descriptions and they can be
understood more quickly if well designed.

 Menus contain lists of textual descriptions and icons.


REPRESENTATIVE USES OF COMPUTER GRAPHICS
The use of computer graphics is wide spread. It is used in various areas
such as industry, business, government organizations, education,
entertainment and most recently the home.
Representative uses of computer graphics•
 User interfaces : GUI, etc.
 Business, science and technology: histograms, bar and pie charts, etc.
 Office automation and electronic publishing : text , tables, graphs,
hypermedia systems, etc.
 Computer-aided design (CAD): structures of building, automobile
bodies, etc.
 Simulation and animation for scientific visualization and entertainment:
flight simulation, games, movies, virtual reality, etc.
 Art and commerce : terminals in public places such as museums, etc.
 Cartography : map making
APPLICATION DEVELOPMENT OF
HARDWARE & SOFTWARE FOR
COMPUTER GRAPHICS

 Hardware can be categorized in form of


 Input Devices
 Output Devices
 Storage Devices
 Processing Devices
HARDWARE FOR COMPUTER GRAPHICS
• Hard Disk: It is a type of magnetic memory, which
stores data and instruction in bulk form
permanently.

• Digital Camera: It is used to take pictures and


videos, which later can be used by graphics software
for manipulation and editing.

• CPU: Central Processing Unit executes commands


that are given to it. It executes the instructions from
graphics software and provides the output,
• Printer: It is used to produce the printout (hard
copy) of outputs, produced by CPU.

• Scanner: It is used to produce digital copies of


images from real world hard copies of images.
Later these digital copies can be manipulated using
appropriate software.

• Graphic Tablet : It is used to navigate around


graphics software or to enhance, manipulate or
create digital images.
• Light Pens: It is a pen like device used to
digitally write in an graphics interface.

• Graph Plotter: It is a graphical device to plot and


produce hard copies of graphs from some graphics
software.

• Joystick : It is a pointer device which is used to


navigate in an graphic interface environment like
games etc.
SOFTWARE FOR COMPUTER GRAPHICS

 Adobe Photoshop(raster graphics): It is


used to enhance and manipulate photos and
create original digital art.

 Adobe Illustrator( Vector Graphics): It is


program used by both artists and graphic
designers to create vector images. These images
are then used for company logos, promotional .
DIFFERENCE BETWEEN VECTOR IMAGES &
RASTER IMAGES
Vector Images Raster Image

A vector graphic file is A raster graphic such as


composed of path or lines, .jpeg, or .gif is composed
that are either straight or of pixels, is an array of
curved pixels of various colours,
which together form an
image.

The data files for a vector Its data file contains the
image contains the points information about
from where a path start properties of pixels at
and ends. various locations of
image.
Conceptual Framework of
Computer Graphics
• Interactive Computer Graphics consists of two
major components at two levels:
 Hardware Level
 Software Level
• HARDWARE LEVEL:
 The computer receives input from the interactive
devices and show images on display devices.
• SOFTWARE LEVEL :
 Software level involves three components:
 Application Program.
 Application Model.
 Graphics System.
Application Model :

 It captures all the data and objects to be pictured


on the screen. It also captures the relationship
among them.

 These relationships are stored in the database


called application database, and referred by the
application programs.
Application Programs:
 It creates application model and
communicates with it to receive and store
data and information of object’s attribute.
 It also handles user input and produces views
by sending series of graphic output commands
to the graphics system.
 It is also responsible for interaction handling
by event handling loops.
Graphics Systems:
 It accept the series of graphics output
commands from application program.
 The output command contains both a detailed
geometric description of what is to be viewed
and the attributes, describing how the objects
should appear.
 The graphics system is responsible for actually
producing the picture from the detailed
description and for passing the user’s input to
application program for processing.
Application Development of Hardware &
Software For Computer Graphics
• There are following three types of technology
developed for computer graphics:
1. Input Technology :
• Keyboard
• Mouse
• Trackball and Space ball
• Joysticks
• Data Glove
• Digitizers
• Scanner
2. Output Technology:
• Film recorder
• Videotape
• Printer
• Plotter
• Cathode Ray Tube (CRT)
3. Output Technology:
• Photoshop
• Corel draw
• Maya 3D
PIXEL

• In computer graphics, pictures or graphics objects


are presented as a collection of discrete picture
elements called “ Pixels”.

• A pixel may be defined as the smallest size object or


color spot(dot) that can be displayed and addressed
on a monitor .

• Pixels are normally arranged in a rectangular 2D


grid ,and are often represented using dots or square.
• A point is represented by the integer part of x and
integer part of y i.e. pixel(int(x), int(y) ).
• For Example : P1(4.2,3.8) & P2(4.8,3.1)then P1& P2
are represented by one pixel (4,3).

• Each pixel has its own intensity ,name or address


by which we can control, it is a measure of screen
resolution.

• The intensity of each pixel is different. In color


systems, each pixel is made up of three basic color
RGB(RED, GREEN & BLUE), intensity control the
color of the pixel,
• The size of the pixel depends on the size of the
electron beam within the CRT, they are too fine &
close to each other to be perceptible by human eye.
IMAGE
• An image is a visual representation of something.
• An image is a picture that has been created or copied and
stored in electronic form.
• Image is also called as digital image, it is composed
of picture element(pixel ). These pixels are arranged
in form of a row and column to form a rectangular
picture. This set of pixels is known as a raster.
• An image stored in raster form is sometimes called a
bitmap.
• The total number of pixels in an image is a function
of the size of image and the number of pixels per unit
length in the horizontal as well as vertical direction.
The number of pixels per unit length is known as the “resolution
of the image”.
DIFFERENCE BETWEEN VECTOR IMAGES &
RASTER IMAGES
Vector Images Raster Image

A vector graphic file is A raster graphic such as


composed of path or lines, .jpeg, or .gif is composed
that are either straight or of pixels, is an array of
curved pixels of various colours,
which together form an
image.

The data files for a vector Its data file contains the
image contains the points information about
from where a path start properties of pixels at
and ends. various locations of
image.
Construction of Cathode Ray Tube
• The primary components are heated metal cathode
and a control grid.
• The heat is supplied to the cathode, by passing
electron through electron gun, through the
filament.
• This way, the electrons get heated up, and start
getting ejected out of cathode filament.
• This stream of negatively charged electron is
accelerated towards the phosphor screen by
supplying high positive voltage.
• This acceleration is produced by means of an
accelerating anode. Next component is Focussing
system.
• Focussing system is used to force the electron
beam to converge to small spot on the screen.
Without it, electrons will get scattered because of
their own repulsions, due to which we wont get a
sharp image.
• The focussing can be done either by means of
electrostatic means or magnetic fields.
• The deflection systems of the CRT consists of two
pairs of parallel plates , referred as vertical and
horizontal deflective plates.
• The voltage applied to vertical plates controls the
vertical deflection, of electron beam & voltage
applied to horizontal deflection plates control the
horizontal deflection of electron .
• As the electron beam strikes the positively charged
phosphorous screen at a specific position, it emits
light and enables screen to be visible.
Cathode-Ray Tubes

The basic operation of a 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. Fig.1.
The phosphor then emits a small spot of light at each position contacted by the electron beam.
Because the light emitted by the phosphor fades very rapidly, some method is needed for maintaining
the screen picture. One way to keep the phosphor glowing is to redraw the picture repeatedly by
quickly directing the electron beam back over the same points. This type of display is called a refresh
CRT.

Fig.3
The primary components of an electron gun in a CRT are the heated metal cathode and a control grid
Heat is supplied to the cathode by directing a current through a coil of wire, called the filament, inside
the cylindrical cathode structure. This causes electrons to be boiled off" the hot cathode surface. In the
vacuum inside the CRT envelope, the free, negatively charged electrons are then accelerated toward
the phosphor coating by a high positive voltage. The accelerating voltage can be generated with a
positively charged metal coating on the inside of the CRT envelope near the phosphor screen, or an
accelerating anode can be used, as in Fig.3.
Sometimes the electron gun is built to contain the accelerating anode and focusing system within the
same unit. Intensity of the electron beam is controlled by setting voltage levels on the control grid,
which is a metal cylinder that fits over the cathode. A high negative voltage applied to the control
grid will shut OFF the beam by repelling electrons and stopping them from passing through the small
hole at the end of the control grid structure. A smaller negative voltage on the control grid simply
decreases the number of electrons passing through. Since the amount of light emitted by the phosphor
coating depends on the number of electrons striking the screen,
The focusing system in a CRT is needed to force the electron beam to converge into a small spot as it
strikes the phosphor. Otherwise, the electrons would repel each other, and the beam would spread out
as it approaches the screen. Focusing is accomplished with either electric or magnetic fields.
The distance that the electron beam must travel to different points on the screen varies because the
radius of curvature for most CRTs is greater than the distance from the focusing system to the screen
center. Therefore, the electron beam will be focused properly only at the center to the screen.

As the beam moves to the outer edges of the screen, displayed images become blurred. To compensate
for this, the system can adjust the focusing according to the screen position of the beam.
As with focusing, deflection of the electron beam can be controlled either with electric fields or with
magnetic fields.
Magnetic deflection has two pairs of coils are used, with the coils in each pair mounted on opposite
sides of the neck of the CRT envelope. One pair is mounted on the top and bottom of the neck and the
other pair is mounted on opposite sides of the neck. The magnetic, field produced by each pair of coils
results in a transverse deflection force that is perpendicular both to the direction of the magnetic field
and to the direction of travel of the electron beam. Horizontal deflection is accomplished with one pair
of coils, and vertical deflection by the other pair. The proper deflection amounts are attained by
adjusting the current through the coils.

Electrostatic deflection has two pairs of parallel plates are mounted inside the CRT envelope. One
pair coil plates is mounted horizontally to control the vertical deflection, and the other pair is mounted
vertically to control horizontal deflection (Fig. 3). Spots of light are produced on the screen by the
transfer of the CRT beam energy to the phosphor. When the electrons in the beam collide with the
phosphor coating, they are stopped and then kinetic energy is absorbed by the phosphor. Part of the
beam energy is converted by friction into heat energy, and the remainder causes electrons in the
phosphor atoms to move up to higher quantum-energy levels. After a short time, the "excited
phosphor electrons begin dropping back to their stable ground state, giving up their extra energy as
small quantum’s of Light energy. The frequency (or color) of the light emitted
by the phosphor is proportional to the energy difference between the excited quantum state and the
ground state. Different kinds of phosphors are available for use in a CRT.

Besides color, a major difference between phosphors is their persistence.


Persistence: How long they continue to emit light (that is, have excited electrons returning to the
ground state) 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. It is useful for animation High-persistence phosphor is useful for
displaying highly complex, static pictures. Although some phosphors have persistence greater than 1
second, graphics monitors are usually constructed with persistence in the range from 10 to 60
microseconds.
Resolution: The maximum number of points that can be displayed without overlap on a CRT is
referred to as the resolution.

Resolution is the number of points per centimeter that can be plotted horizontally and vertically,
although it is often simply stated as the total number of points in each direction.
Spot intensity has a Gaussian distribution, so two adjacent spots will appear distinct as long as their
separation is greater than the diameter at which each spot has an intensity of about 60 percent of that
at the center of the spot.

Typical resolution on high-quality systems is 1280 by 1024, with higher resolutions available on many
systems. High resolution systems are often referred to as high-definition systems. The physical size of
a graphics monitor is given as the length of the screen diagonal, with sizes varying from about 12
inches to 27 inches or more.

Aspect Ratio: This number gives the ratio of vertical points to horizontal points necessary to produce
equal-length lines in both directions on the screen. (Sometimes aspect ratio is stated in terms of the
ratio of horizontal to vertical points.) An aspect ratio of 3/4 means that a vertical line plotted with
three points has the same length as a horizontal line plotted with four points.
INPUT DEVICES:
Various devices are available for data input on graphics workstations. Most
systems have a keyboardand one or more additional devices include a mouse,
trackball, spaceball, joystick, digitizers, dials, andbutton boxes. Some other input
devices used in particular applications are data gloves, touch panels, image
scanners, and voice systems.

Keyboards:

The Keyboard is an efficient device for inputtingnongraphic data as picture labels,


i.e., for entering text strings.Cursor-control keys, Numeric pad and function keys
are commonfeatures on general-purpose keyboards.Other types of cursor-
positioning devices, such as atrackball or joystick, are included on some
keyboards.For specialized applications, input to a graphics application may come
from a set of buttons, dials, orswitches that select data values or customized
graphics operations.Buttons and switches are often used to input predefined
functions, and dials are common devices forentering scalar values.Real numbers
within some defined range are selected for input with dial rotations. Potentiometers
areused to measure dial rotations, which are then converted to deflection voltages
for cursor movement.

Mouse:

A mouse is small hand-held box used to position the screen cursor.Wheels or


rollers on the bottom of the mouse can be used to record the amountand direction
of movement.Another method is the optical sensor, which detects movement
across thelines in the grid. One, two, or three buttons are usually included on the
top of themouse for signaling the execution of some operation, such as recording
cursorposition or invoking a function.

Trackball and Spaceball:

A Trackball is a ball that can be rotated withthe fingers or palm of the hand, to
produce screencursormovement. Trackballs are often mounted onkeyboards and it
is a two-dimensional positioning device.A Spaceball provides six degrees of
freedom. Unlike the trackball, a spaceball does not actually move. Spaceballs are
used for threedimensional positioning and selection operations in
virtual-reality systems, modeling, animation, CAD, and other applications.
Trackall Spaceball

Joysticks:

A Joystick consists of a small, vertical lever (called the stick)mounted on a base


that is used to steer the screen cursor around. Mostjoysticks select screen positions
with actual stick movement; othersrespond to pressure on the stick. Some are
mounted on a keyboard; othersfunction as stand-alone units.In another type of
movable joystick, 8 switches are arranged in a circle, so that the stick can select
any one of eight directions for cursor movement.Pressure-sensitive joysticks, also
called Isometric Joysticks, have a nonmovable stick. Pressure onthe stick is
measured with strain gauges and converted to movement of the cursor in the
direction specified.

Data Glove:

A Data Glove that can be used to grasp a "virtual" object.The glove is constructed
with a series of sensors that detect handand finger motions. Electromagnetic
coupling betweentransmitting antennas and receiving antennas is used to provide
information about the position and orientation of the hand. A twodimensional
projection of the scene can be viewed on a video monitor, or a three-dimensional
projection can be viewed with a headset.
Digitizers:

A common device for drawing, painting, or interactivelyselecting coordinate


positions on an object is a Digitizer. Thesedevices can be used to input coordinate
values in either a twodimensionalor a three-dimensional space.One type of
digitizer is the graphics tablet (data tablet),which is used to input two-dimensional
coordinates by activating ahand cursor or stylus at selected positions on a flat
surface. A handcursor contains cross hairs for sighting positions, while a stylus is a
pencil-shaped device that is pointed at positions on the tablet. Graphics tablets
provide a highly accurate method for selecting coordinate positions, with an
accuracy that varies from about 0.2 mm on desktop models to about 0.05 mm or
less on larger models.Many graphics tablets are constructed with a rectangular grid
of wires embedded in the tablet surface. Depending on the technology, either
signal strength, coded pulses, or phase shifts can be used to determine the position
on the tablet.

Three-dimensional digitizers use sonic or electromagnetic transmissions to record


positions. Resolution of this system is from 0.8 mm to 0.08 mm, depending on the
model.

Image Scanners:
Drawings, graphs, color and black-and-white photos, or text can be stored for
computer processingwith an Image Scanner by passing an optical scanning
mechanism over the information to be stored. Wecan also apply various
transformations, image-processing methods to modify the array representation of
the picture.

Touch Panels:

Touch Panels allow displayed objects or screen positions to be selected with the
touch of a finger. Atypical application of touch panels is for the selection of
processing options that are represented with graphical icons.
Touch input can be recorded using optical, electrical, or acoustical methods.

_ Optical Touch Panels employ a line of infrared light-emitting diodes (LEDs)


along one vertical edge andalong one horizontal edge of the frame. The opposite
vertical and horizontal edges contain lightdetectors. These detectors are used to
record which beams are interrupted when the panel is touched.

_ An Electrical Touch Panel is constructed with two transparent plates separated


by a small distance. One of the plates is coated with a conducting material, and the
other plate is coated with a resistive material.When the outer plate is touched, it is
forced into contact with the inner plate. This contact creates a voltage drop across
the resistive plate that is converted to the coordinate values of the selected screen
position.
_ In Acoustical Touch Panels, high-frequency sound waves are generated in the
horizontal and vertical
directions across a glass plate.

Light Pens

Light Pen is a pencil-shaped device used to select screen positions by detecting the
light coming from points on the CRT screen. Light Pens sometimes give false
readings due to background lighting in a room. The pen will send a pulse whenever
phosphor below it is illuminated. While the image on a refresh display may appear
to be stable, it is in fact blinking on and off faster than the eye can detect. This
blinking is not too fast, for the light pen. The light pen as easily determines the
time at which the phosphor is illuminated. Since there is only one electron beam on
the refresh display, only one line segment can be drawn at a time and no two
segments are drawn simultaneously.
Voice Systems

Speech recognizers are used in some graphics workstations as input devices to


accept voice commands. The Voice-System input can be used to initiate graphics
operations or to enter data. These systems operate by matching an input against a
predefined dictionary of words and phrase.

HARD-COPY DEVICES:

We can obtain hard-copy output for various images in several formats. The most
important output device is Printer or Plotter and many types are there.

_ Printers produce output by either Impact or Nonimpact methods.

_ Impact Printers press formed character faces against an inked ribbon onto the
paper. E.g. : Line Printer, with the typefaces mounted on bands, chains, drums, or
wheels.
_ Character impact printers often have a Dot-Matrix print head containing a
rectangular array of
protruding wire pins, with the number of pins depending on the quality of the
printer.
_ Nonimpact Printers and plotters use laser techniques, ink-jet sprays, xerographic
processes
(photocopying), electrostatic methods, and electrothermal methods to get images
onto Paper.
_ In a Laser Device, a laser beam mates a charge distribution on a rotating drum
coated with a
photoelectric material, such as selenium. Toner is applied to the drum and then
transferred to paper.
_ Ink-Jet methods produce output by squirting ink in horizontal rows across a roll
of paper wrapped on a drum. The electrically charged ink stream is deflected by an
electric field toproduce dot-matrix patterns.
Laser Printer Inkjet Printer

_ An Electrostatic Device places a negative charge on the paper, one complete row
at a time along the length of the paper. Then the paper is exposed to a toner. The
toner is positively charged and so is attracted to the negatively charged areas,
where it adheres to produce the specified output.

_ Electrothermal methods use heat in a dot-matrix print head to output patterns on


heat sensitive paper. We can get limited color output on an impact printer by using
different colored ribbons.

_ Nonimpact devices use various techniques to combine three color pigments


(cyan, magenta, and yellow) to produce a range of color patterns.
_ Laser and Xerographic devices deposit the three pigments on separate passes;
ink-jet methods shoot the three colors simultaneously on a single pass along each
print tine on the paper. Drafting layouts and other drawings are typically generated
with ink-jet or pen plotters.

_ A Pen Plotter has one or more pens mounted on a carriage, or crossbar, that
spans a sheet of paper.
Pens with varying colors and widths, wet-ink, ball-point, and felt-tip pens are all
possible choices for use with a pen plotter. Crossbars can be either moveable or
stationary, while the pen moves back and forth along the bar. E.g.: flatbed pen
plotter, rollfeed pen plotter.
Program for Cohen Sutherland Line Clipping Algorithm in C
#include<stdio.h>

#include<stdlib.h>

#include<math.h>

#include<graphics.h>

#include<dos.h>

typedef struct coordinate

int x,y;

char code[4];

}PT;

void drawwindow();

void drawline(PT p1,PT p2);

PT setcode(PT p);

int visibility(PT p1,PT p2);

PT resetendpt(PT p1,PT p2);

void main()

int gd=DETECT,v,gm;

PT p1,p2,p3,p4,ptemp;

printf("\nEnter x1 and y1\n");


scanf("%d %d",&p1.x,&p1.y);

printf("\nEnter x2 and y2\n");

scanf("%d %d",&p2.x,&p2.y);

initgraph(&gd,&gm,"c:\\turboc3\\bgi");

drawwindow();

delay(500);

drawline(p1,p2);

delay(500);

cleardevice();

delay(500);

p1=setcode(p1);

p2=setcode(p2);

v=visibility(p1,p2);

delay(500);

switch(v)

case 0: drawwindow();

delay(500);

drawline(p1,p2);

break;

case 1: drawwindow();
delay(500);

break;

case 2: p3=resetendpt(p1,p2);

p4=resetendpt(p2,p1);

drawwindow();

delay(500);

drawline(p3,p4);

break;

delay(5000);

closegraph();

void drawwindow()

line(150,100,450,100);

line(450,100,450,350);

line(450,350,150,350);

line(150,350,150,100);

}
void drawline(PT p1,PT p2)

line(p1.x,p1.y,p2.x,p2.y);

PT setcode(PT p) //for setting the 4 bit code

PT ptemp;

if(p.y<100)

ptemp.code[0]='1'; //Top

else

ptemp.code[0]='0';

if(p.y>350)

ptemp.code[1]='1'; //Bottom

else

ptemp.code[1]='0';

if(p.x>450)

ptemp.code[2]='1'; //Right

else

ptemp.code[2]='0';
if(p.x<150)

ptemp.code[3]='1'; //Left

else

ptemp.code[3]='0';

ptemp.x=p.x;

ptemp.y=p.y;

return(ptemp);

int visibility(PT p1,PT p2)

int i,flag=0;

for(i=0;i<4;i++)

if((p1.code[i]!='0') || (p2.code[i]!='0'))

flag=1;

if(flag==0)

return(0);

for(i=0;i<4;i++)
{

if((p1.code[i]==p2.code[i]) && (p1.code[i]=='1'))

flag='0';

if(flag==0)

return(1);

return(2);

PT resetendpt(PT p1,PT p2)

PT temp;

int x,y,i;

float m,k;

if(p1.code[3]=='1')

x=150;

if(p1.code[2]=='1')

x=450;

if((p1.code[3]=='1') || (p1.code[2]=='1'))

{
m=(float)(p2.y-p1.y)/(p2.x-p1.x);

k=(p1.y+(m*(x-p1.x)));

temp.y=k;

temp.x=x;

for(i=0;i<4;i++)

temp.code[i]=p1.code[i];

if(temp.y<=350 && temp.y>=100)

return (temp);

if(p1.code[0]=='1')

y=100;

if(p1.code[1]=='1')

y=350;

if((p1.code[0]=='1') || (p1.code[1]=='1'))

m=(float)(p2.y-p1.y)/(p2.x-p1.x);

k=(float)p1.x+(float)(y-p1.y)/m;

temp.x=k;

temp.y=y;
for(i=0;i<4;i++)

temp.code[i]=p1.code[i];

return(temp);

else

return(p1);

Output
Before Clipping

After Clipping
Polygon Clipping (Sutherland Hodgman Algorithm)
A polygon can also be clipped by specifying the clipping window. Sutherland Hodgeman
polygon clipping algorithm is used for polygon clipping. In this algorithm, all the vertices of the
polygon are clipped against each edge of the clipping window.

First the polygon is clipped against the left edge of the polygon window to get new vertices of
the polygon. These new vertices are used to clip the polygon against right edge, top edge, bottom
edge, of the clipping window as shown in the following figure.

While processing an edge of a polygon with clipping window, an intersection point is found if
edge is not completely inside clipping window and the a partial edge from the intersection point
to the outside edge is clipped. The following figures show left, right, top and bottom edge
clippings −
Text Clipping
Various techniques are used to provide text clipping in a computer graphics. It depends on the
methods used to generate characters and the requirements of a particular application. There are
three methods for text clipping which are listed below −

 All or none string clipping


 All or none character clipping
 Text clipping

The following figure shows all or none string clipping −


In all or none string clipping method, either we keep the entire string or we reject entire string
based on the clipping window. As shown in the above figure, STRING2 is entirely inside the
clipping window so we keep it and STRING1 being only partially inside the window, we reject.

The following figure shows all or none character clipping −

This clipping method is based on characters rather than entire string. In this method if the string
is entirely inside the clipping window, then we keep it. If it is partially outside the window, then

 You reject only the portion of the string being outside


 If the character is on the boundary of the clipping window, then we discard that entire
character and keep the rest string.

The following figure shows text clipping −


This clipping method is based on characters rather than the entire string. In this method if the
string is entirely inside the clipping window, then we keep it. If it is partially outside the window,
then

 You reject only the portion of string being outside.


 If the character is on the boundary of the clipping window, then we discard only that
portion of character that is outside of the clipping window.
Sutherland –Hodgeman Polygon Clipping Algorithm:
Step 1. Start

Step 2. Read coordinates of all vertices of the polygon.

Step 3. Read coordinates of the clipping window.

Step 4. Consider the left edge of the window

Step 5. Compare the vertices of each edge of the polygon, individually with the
clipping plane.

Step 6. Save the resulting intersections and vertices in the new list of vertices
according to four possible relationships between the edge and the clipping
boundary discussed earlier .

Step 7. Repeat the steps 5 and 6 for remaining edges of the clipping window. Each
time the resultant list of vertices is successively passed to process the next edge
of the clipping window.
ALGORITHM TO CLIP A LINE.

1. Start.
2. Initialize the graphic system using initgraph function.
3. Get the input of window co ordinates from the user and draw a window.
4. Get the input of line co ordinates from user and draw the line.
5. Calculate the region code of each end point of line using relation given in steps 6 to step
6. Let (x,y) be the co ordinates of end point of line and (xmin,ymin), (xmax,ymax) be co
ordinates of world window
7. If y –ymax = +ve
8. MSB region code = 1.
9. Else MSB region code = 0.
10. If ymin – y = +ve
11. Region code = 1.
12. Else Region code = 0.
13. If x – xmax = +ve
14. Region code = 1.
15. Else Region code = 0.
16. If xmin – x = +ve
17. LSB Region code = 1.
18. Else LSB Region code = 0.
19. Calculate region code of both end points.
20. Logically and both region code.
21. If Logically anded result is = 0
22. Line is not a clipping candidate.
23. Else.
24. Line is a clipping candidate.
25. Calculate slope of line using formula slope=(y2-y1)/(x2-x1).
26. If line is to be horizontally clipped.
27. New y = ymin or ymax.
28. New x = x1 + ((new y - y1)/slope).
29. If line is to be vertically clipped.
30. New x = xmin or xmax.
31. New y = y1+slope*(new x –x1).
32. Clip the lines from these intersection points.
33. Display the new line.
34. Close the graphic system.
35. Stop.
WAP TO SHOW LINE CLIPPING.

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void storepoints(int,int,int,int,int,int,int[]);
void main()
{
int gdriver=DETECT,gmode;
int x1,x2,y1,y2,xmax,ymax,xmin,ymin,a[10],b[10],xi1,xi2,yi1,yi2,flag=0; float m;
int i;
clrscr();

printf("output");
printf("\n");
printf("enter the value of x1,y1,x2,y2: >");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2); printf("enter the
value of xmax,ymax,xmin,ymin:");
scanf("%d%d%d%d",&xmax,&ymax,&xmin,&ymin);
storepoints(x2,y2,ymin,ymax,xmax,xmin,b);
for(i=1;i<=4;i++)
{
if(a[i]*b[i]==0)
flag=1;
else
flag=0;
}
if(flag==1)
{
m=(y2-y1)/(x2-x1);
xi1=x1;
yi1=y1;
}
if(a[1]==1)
{
yi1=ymax;
xi1=x1+((1/m)*(yi1-y1));
}
else
{
if(a[2]==1)
{
yi1=ymin;
xi1=x1+((1/m)*(yi1-y1));
}
}
if(a[3]==1)
{
xi1=xmax;
yi1=y1+(m*(xi1-x1));
}
if(a[4]==1)
{
xi1=xmin;
yi1=y1+(m*(xi1-x1));
}
else

if(b[1]==1)
{
yi2=ymax;
xi2=x2+((1/m)*(yi2-y2));
}
else
if(b[2]==1)
{
yi2=ymin;
xi2=x2+((1/m)*(yi2-y2));
}
else

if(b[3]==1)
{
xi2=xmax;
yi2=y2+((1/m)*(xi2-x2));
}
else

if(b[4]==1)
{
xi2=xmin;
yi2=y2+(m*(xi2-x2));
}
clrscr();
initgraph(&gdriver,&gmode,"c://tc//bgi:");
rectangle(xmin,ymin,xmax,ymax);
line(x1,y1,x2,y2);
delay(5000);
closegraph();
clrscr();
initgraph(&gdriver,&gmode,"c://tc//bgi:");
line(xi1,yi1,xi2,yi2);
rectangle(xmin,ymin,xmax,ymax);
if(flag==0)
{
printf("\n no clipping is required");
}
getch();
closegraph();
}
void storepoints(int x1,int y1,int ymax,int xmax,int xmin,int ymin,int c[10])
{
if((y1-ymax)>0)
c[1]=1;
else
c[1]=0;
if((ymin-y1)>0)
c[2]=1;
else
c[2]=0;
if((x1-xmax)>0)
c[3]=1;
else
c[3]=0;
if((xmin-x1)>0)
c[4]=1;
else
c[4]=0;
}
OUTPUT

enter the value of


x1,y1,x2,y2: >10 10
100
100
enter the value of
xmax,ymax,xmin,ymin50 50
0
0

Before Clipping:

After Clipping
/* PROGRAM TO DRAW A LINE USING DDA ALGORITHM */

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

float round(float a);


void main( )
{
/* request auto detection */
int gdriver = DETECT, gmode ;
int x1,y1,x2,y2,steps,k;
float xincr,yincr,x,y,dx,dy;
clrscr( );

printf("Enter the coordinates of starting point:");


scanf("%d%d",&x1,&y1);
printf("Enter the coordinates of ending point:");
scanf("%d%d",&x2,&y2);

/* initialize graphics mode */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

dx = x2-x1;
dy = y2-y1;
if(abs(dx) > abs(dy))
steps = abs(dx);
else
steps = abs(dy);
xincr = dx/steps;
yincr = dy/steps;
x = x1;
y = y1;
putpixel(x,y,WHITE);
for(k=1;k<=steps;k++)
{
delay(100);
x = x+xincr;
y = y+yincr;
putpixel(round(x),round(y),WHITE);
}
outtextxy(200,20,"ILLUSTRATION OF DDA ALGORITHM");
outtextxy(x1+5,y1-5,"(x1,y1)");
outtextxy(x2+5,y2+5,"(x2,y2)");
getch( );
closegraph( );
restorecrtmode( );
}
float round(float a)
{
int b = a+0.5;
return(floor(b));
}

OUTPUT :

Enter the coordinates of starting point:200


100
Enter the coordinates of ending point:300
100
/* PROGRAM TO DRAW LINE : BRESENHAM'S ALGORITHM */

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main( )
{
/* request auto detection */
int gdriver = DETECT, gmode ;
int x1,y1,x2,y2,dx,dy,p,k,x,y;
clrscr( );

printf("Enter the coordinates of starting point:");


scanf("%d%d",&x1,&y1);
printf("Enter the coordinates of ending point:");
scanf("%d%d",&x2,&y2);

/* initialize graphics mode */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

dx = x2-x1;
dy = y2-y1;
p = 2*dy-dx;
x = x1;
y = y1;

putpixel(x,y,15);
for(k=1;k<=dx;k++)
{
if(p<0)
{
x = x+1;
putpixel(x,y,15);
p = p+2*dy;
}
else
{
x = x+1;
y = y+1;
putpixel(x,y,15);
p = p+2*dy-2*dx;
}
}
outtextxy(200,10,"ILLUSTRATION OF BRESENHAM'S ALGORITHM");
outtextxy(x1+5,y1-5,"(x1,y1)");
outtextxy(x2+5,y2+5,"(x2,y2)");
getch( );
closegraph( );
restorecrtmode( );
}

OUTPUT :

Enter the coordinates of starting point:200


100
Enter the coordinates of ending point:300
180
/* PROGRAM TO DRAW A CIRCLE : MIDPOINT CIRCLE*/
/* ALGORITHM */

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

void symmetry(int xc,int yc,int x,int y);


void main( )
{
/* request auto detection */
int gdriver = DETECT, gmode ;
int xc,yc,r,p,x,y;
clrscr( );

printf("Enter the coordinates of center of circle:");


scanf("%d%d",&xc,&yc);
printf("Enter the radius of circle:");
scanf("%d",&r);

/* initialize graphics mode */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

x = 0;
y = r;
symmetry(xc,yc,x,y);
p = 1-r;
while(x<=y)
{
if(p<0)
{
x = x+1;
p = p+2*x+1;
}
else
{
x = x+1;
y = y-1;
p = p+2*x+1-2*y;
}
symmetry(xc,yc,x,y);
}
outtextxy(120,20,"ILLUSTRATION OF MIDPOINT CIRCLE ALGORITHM");
outtextxy(xc-25,yc,"(xc,yc)");
getch( );
closegraph( );
restorecrtmode( );
}
void symmetry(int xc,int yc,int x,int y)
{
putpixel(xc+x,yc+y,WHITE);
putpixel(xc-x,yc+y,WHITE);
putpixel(xc+x,yc-y,WHITE);
putpixel(xc-x,yc-y,WHITE);
putpixel(xc+y,yc+x,WHITE);
putpixel(xc-y,yc+x,WHITE);
putpixel(xc+y,yc-x,WHITE);
putpixel(xc-y,yc-x,WHITE);
}
OUTPUT:

Enter the coordinates of center of circle:320


240
Enter the radius of circle:100
/* PROGRAM TO DRAW CIRCLE : BRESENHAM'S CIRCLE*/
/*ALGORITHM */

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

void symmetry(int xc,int yc,int x,int y);


void main( )
{
/* request auto detection */
int gdriver = DETECT, gmode ;
int xc,yc,r,s,x,y;
clrscr( );

printf("Enter the coordinates of center of circle:");


scanf("%d%d",&xc,&yc);
printf("Enter the radius of circle:");
scanf("%d",&r);

/* initialize graphics mode */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

x = 0;
y = r;
symmetry(xc,yc,x,y);
s = 3-2*r;
while(x<=y)
{
if(s<0)
{
x = x+1;
s = s+4*x+6;
}
else
{
x = x+1;
y = y-1;
s = s+4*(x-y)+10;
}
symmetry(xc,yc,x,y);
}
outtextxy(120,20,"ILLUSTRATION OF BRESENHAM'S CIRCLE
ALGORITHM");
outtextxy(xc-25,yc,"(xc,yc)");
getch( );
closegraph( );
restorecrtmode( );
}
void symmetry(int xc,int yc,int x,int y)
{
putpixel(xc+x,yc+y,WHITE);
putpixel(xc-x,yc+y,WHITE);
putpixel(xc+x,yc-y,WHITE);
putpixel(xc-x,yc-y,WHITE);
putpixel(xc+y,yc+x,WHITE);
putpixel(xc-y,yc+x,WHITE);
putpixel(xc+y,yc-x,WHITE);
putpixel(xc-y,yc-x,WHITE);
}
OUTPUT :

Enter the coordinates of center of circle:300


200
Enter the radius of circle:80
/* PROGRAM TO DRAW AN ELLIPSE: MIDPOINT ELLIPSE*/
/*ALGORITHM */

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

void symmetry(int xc,int yc,int x,int y);


void main( )
{
/* request auto detection */
int gdriver = DETECT, gmode ;
int xc,yc,a,b,x,y,fx,fy,p;
int aa = a*a,bb = b*b,aa2 = aa*2,bb2 = bb*2;
clrscr( );

printf("Enter the coordinates of center of ellipse:");


scanf("%d%d",&xc,&yc);
printf("Enter the x-radius and y-radius of ellipse:");
scanf("%d%d",&a,&b);

/* initialize graphics mode */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

x = 0; /*starting point*/
y = b;
symmetry(xc,yc,x,y);
fx = 0; /*initial partial derivatives*/
fy = aa2*y;
p = bb-aa*b+(0.25*aa); /*compute and round off p1*/

while(fx < fy) /* |slope|<1 */


{
x++;
fx = fx+bb2;
if(p<0)
p = p+fx+bb;
else
{
y--;
fy = fy-aa2;
p = p+fx+bb-fy;
}
symmetry(xc,yc,x,y);
}
p = bb*(x+0.5)*(x+0.5)+aa*(y-1)*(y-1)-aa*bb;
while(y>0)
{
y--;
fy = fy-aa2;
if(p>=0)
p = p-fy+aa;
else
{
x++;
fx = fx+bb2;
p=p+fx-fy+aa;
}
symmetry(xc,yc,x,y);
}
outtextxy(120,20,"ILLUSTRATION OF MIDPOINT ELLIPSE ALGORITHM");
outtextxy(xc-25,yc,"(xc,yc)");
getch( );
closegraph( );
restorecrtmode( );
}
void symmetry(int xc,int yc,int x,int y)
{
putpixel(xc+x,yc+y,WHITE);
putpixel(xc-x,yc+y,WHITE);
putpixel(xc+x,yc-y,WHITE);
putpixel(xc-x,yc-y,WHITE);
}
OUTPUT:

Enter the coordinates of center of ellipse:320


240
Enter the x-radius and y-radius of ellipse:100
80
/*ROTATION OF LINE ABOUT ORIGIN AND FIXED POINT*/

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main( )
{
/* request auto detection */
int gdriver = DETECT, gmode,ch ;
float x1,y1,x2,y2,a,x,y;

/* initialize graphics and local variables */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
do
{
printf("\n######### MAIN MENU #########\n");
printf("\n1.Rotation about origin\n");
printf("2.Rotation about fixed point\n");
printf("Enter your choice:0 for exit\n");
scanf("%d",&ch);
if(ch= =0)
{
getch( );
exit(1);
}
printf("Enter the value of line coordinates:");
scanf("%f%f%f%f",&x1,&y1,&x2,&y2);
printf("Enter the value of angle of rotation:");
scanf("%f",&a);

switch(ch)
{
case 1: cleardevice( );
/* draw the original line */
outtextxy(250,20,"LINE BEFORE ROTATION");
line(x1,y1,x2,y2);
a = a*(3.14/180);
x1 = x1*cos(a)-y1*sin(a);
y1 = x1*sin(a)+y1*cos(a);
x2 = x2*cos(a)-y2*sin(a);
y2 = x2*sin(a)+y2*cos(a);
getch( );
cleardevice( );
outtextxy(250,20,"LINE AFTER ROTATION");
line(x1,y1,x2,y2);
getch( );
cleardevice( );
break;

case 2: printf("Enter the fixed point:");


scanf("%f%f",&x,&y);
cleardevice( );
/* draw the original line */
outtextxy(250,20,"LINE BEFORE ROTATION");
line(x1,y1,x2,y2);
a = a*(3.14/180);
x1 = x1*cos(a)-y1*sin(a)-x*cos(a)+y*sin(a)+x;
y1 = x1*sin(a)+y1*cos(a)-x*sin(a)-y*cos(a)+y;
x2 = x2*cos(a)-y2*sin(a)-x*cos(a)+y*sin(a)+x;
y2 = x2*sin(a)+y2*cos(a)-x*sin(a)-y*cos(a)+y;
getch( );
cleardevice( );
outtextxy(250,20,"LINE AFTER ROTATION");
line(x1,y1,x2,y2);
getch( );
cleardevice( );
break;

default:printf("Invalid choice");
cleardevice( );
}
}while(ch!=0);
getch( );
closegraph( );
restorecrtmode( );
}
OUTPUT:
######### MAIN MENU #########

1.Rotation about origin


2.Rotation about fixed point
Enter your choice:0 for exit :1
Enter the value of line coordinates:200
100
320
220
Enter the value of angle of rotation:20
######### MAIN MENU #########

1.Rotation about origin


2.Rotation about fixed point
Enter your choice:0 for exit :2
Enter the value of line coordinates:220
80
350
160
Enter the value of angle of rotation:20
Enter the fixed point:220
80
/* SCALING OF LINE ABOUT ORIGIN AND FIXED POINT */

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main( )
{
/* request auto detection */
int gdriver = DETECT, gmode ;
int x1,y1,x2,y2,a,b,h,k,ch;

/* initialize graphics and local variables */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
do
{
printf("\n######### MAIN MENU #########\n");
printf("\n1.Scaling about origin\n");
printf("2.Scaling about fixed point\n");
printf("Enter your choice:0 for exit\n");
scanf("%d",&ch);
if(ch= =0)
{
getch( );
exit(1);
}
printf("Enter the value of line coordinates:");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
printf("Enter the value of x-scaling factor:");
scanf("%d",&a);
printf("Enter the value of y-scaling factor:");
scanf("%d",&b);

switch(ch)
{
case 1: cleardevice( );
/* draw the original line */
outtextxy(200,20,"LINE BEFORE SCALING");
line(x1,y1,x2,y2);
x1 = x1*a;
y1 = y1*b;
x2 = x2*a;
y2 = y2*b;
getch( );
cleardevice( );
outtextxy(200,20,"LINE AFTER SCALING");
line(x1,y1,x2,y2);
getch( );
cleardevice( );
break;

case 2: printf("Enter the fixed point:");


scanf("%d%d",&h,&k);
cleardevice( );
/* draw the original line */
outtextxy(200,20,"LINE BEFORE SCALING");
line(x1,y1,x2,y2);
x1 = x1*a-h*a+h;
y1 = y1*b-k*b+k;
x2 = x2*a-h*a+h;
y2 = y2*b-k*b+k;
getch( );
cleardevice( );
outtextxy(200,20,"LINE AFTER SCALING");
line(x1,y1,x2,y2);
getch( );
cleardevice( );
break;

default:printf("Invalid choice");
cleardevice( );
}
}while(ch!=0);
getch( );
closegraph( );
restorecrtmode( );
}
OUTPUT:
######### MAIN MENU #########

1.Scaling about origin


2.Scaling about fixed point
Enter your choice:0 for exit
1
Enter the value of line coordinates:
100
100
180
180
Enter the value of x-scaling factor:2
Enter the value of y-scaling factor:1
######### MAIN MENU #########

1.Scaling about origin


2.Scaling about fixed point
Enter your choice:0 for exit
1
Enter the value of line coordinates:
100
300
200
200
Enter the value of x-scaling factor:2
Enter the value of y-scaling factor:2
Enter the fixed point:100
300
######### MAIN MENU #########

1.Scaling about origin


2.Scaling about fixed point
Enter your choice:0 for exit
0
/*TRANSLATION OF LINE */

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main( )
{
/* request auto detection */
int gdriver = DETECT, gmode ;
int x1,y1,x2,y2,a,b;

/* initialize graphics and local variables */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

printf("Enter the value of line coordinates:");


scanf("%d%d%d%d",&x1,&y1,&x2,&y2);

printf("Enter the value of x-translation factor:");


scanf("%d",&a);
printf("Enter the value of y-translation factor:");
scanf("%d",&b);
cleardevice( );
outtextxy(200,20,"LINE BEFORE TRANSLATION");
line(x1,y1,x2,y2);
x1 = x1+a;
y1 = y1+b;
x2 = x2+a;
y2 = y2+b;
getch( );
cleardevice( );
outtextxy(200,20,"LINE AFTER TRANSLATION");
line(x1,y1,x2,y2);

getch( );
closegraph( );
restorecrtmode( );
}
OUTPUT:

Enter the value of line coordinates:


200
100
350
100
Enter the value of x-translation factor:50
Enter the value of y-translation factor:100
/* SHEARING OF LINE */

#include <graphics.h>
#include <stdio.h>
#include <conio.h>

void main( )
{
/* request auto detection */
int gdriver = DETECT, gmode;
int x1,y1,x2,y2,a,b;

/* initialize graphics and local variables */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

printf("Enter the value of line coordinates:");


scanf("%d%d%d%d",&x1,&y1,&x2,&y2);

printf("Enter the value of x-shearing factor:");


scanf("%d",&a);
printf("Enter the value of y-shearing factor:");
scanf("%d",&b);
cleardevice( );
outtextxy(200,20,"LINE BEFORE SHEARING");
line(x1,y1,x2,y2);
x1 = x1+a*y1;
y1 = b*x1+y1;
x2 = x2+a*y2;
y2 = b*x2+y2;
getch( );
cleardevice( );
outtextxy(200,20,"LINE AFTER SHEARING");
line(x1,y1,x2,y2);

getch( );
closegraph( );
restorecrtmode( );
}
OUTPUT:

Enter the value of line coordinates:


20
20
100
100
Enter the value of x-shearing factor:1
Enter the value of y-shearing:1
/*REFLECTION OF LINE ABOUT X-AXIS, Y-AXIS AND*/
/*ARBITARY LINE*/

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main( )
{
/* request auto detection */
int gdriver = DETECT, gmode ;
float x1,y1,x2,y2,x3,y3,x4,y4,m,n,b;
int ch,x,y;

/* initialize graphics and local variables */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

do
{
printf("\n######### MAIN MENU #########\n");
printf("\n1.Reflection about x-axis\n");
printf("2.Reflection about y-axis\n");
printf("3.Reflection about arbitary line\n");
printf("Enter your choice:0 for exit\n");
scanf("%d",&ch);
if(ch==0)
{
getch( );
exit(1);
}

printf("Enter the value of line coordinates:");


scanf("%f%f%f%f",&x1,&y1,&x2,&y2);

switch(ch)
{
case 1: cleardevice( );
/* draw the original line */
outtextxy(250,10,"LINE BEFORE REFLECTION");
x = getmaxx( );
y = getmaxy( );
line(0,y/2,x,y/2);
line(x/2,0,x/2,y);
line(x1+x/2,y1+y/2,x2+x/2,y2+y/2);
x1 = x1+x/2;
y1 = y1+y/2-2*y1;
x2 = x2+x/2;
y2 = y2+y/2-2*y2;
getch( );
cleardevice( );
outtextxy(200,10,"LINE AFTER REFLECTION");
line(x1,y1,x2,y2);
line(0,y/2,x,y/2);
line(x/2,0,x/2,y);
getch( );
cleardevice( );
break;

case 2: cleardevice( );
/* draw the original line */
outtextxy(200,10,"LINE BEFORE REFLECTION");
x = getmaxx( );
y = getmaxy( );
line(0,y/2,x,y/2);
line(x/2,0,x/2,y);
line(x1+x/2,y1+y/2,x2+x/2,y2+y/2);
x1 = x1+x/2-2*x1;
y1 = y1+y/2;
x2 = x2+x/2-2*x2;
y2 = y2+y/2;
getch( );
cleardevice( );
outtextxy(200,10,"LINE AFTER REFLECTION");
line(x1,y1,x2,y2);
line(0,y/2,x,y/2);
line(x/2,0,x/2,y);
getch( );
cleardevice( );
break;

case 3: printf("Enter the arbitary line:");


scanf("%f%f%f%f",&x3,&y3,&x4,&y4);
cleardevice( );
/* draw the original line */
outtextxy(200,10,"LINE BEFORE REFLECTION");
line(x1,y1,x2,y2);
line(x3,y3,x4,y4);
m = (y4-y3)/(x4-x3);
b = y3-m*x3;
n = m*m+1;
x1 = (1-m*m)*x1/n+2*m*y1/n-2*b*m/n;
y1 = (m*m-1)*y1/n+2*m*x1/n+2*b/n;
x2 = (1-m*m)*x2/n+2*m*y2/n-2*b*m/n;
y2 = (m*m-1)*y2/n+2*m*x2/n+2*b/n;
getch( );
cleardevice( );
outtextxy(200,10,"LINE AFTER REFLECTION");
line(x1,y1,x2,y2);
line(x3,y3,x4,y4);
getch( );
cleardevice( );
break;

default:printf("Invalid choice");
cleardevice( );
}
}while(ch!=0);
getch( );
closegraph( );
restorecrtmode( );

}
OUTPUT:

######### MAIN MENU #########

1.Reflection about x-axis


2.Reflection about y-axis
3.Reflection about arbitary line
Enter your choice:0 for exit
1
Enter the value of line coordinates:
10
10
100
100
######### MAIN MENU #########

1.Reflection about x-axis


2.Reflection about y-axis
3.Reflection about arbitary line
Enter your choice:0 for exit
0
/*COHEN SUTHERLAND LINE CLIPPING*/

#include <stdio.h>
#include <graphics.h>
#include <conio.h>
#include <math.h>

#define TRUE 1
#define FALSE 0
typedef unsigned int outcode;
outcode CompOutCode(float x,float y);

enum { TOP = 0x1,


BOTTOM = 0x2,
RIGHT = 0x4,
LEFT = 0x8
};
float xmin,xmax,ymin,ymax;
void clip(float x0,float y0,float x1,float y1)
{
outcode outcode0,outcode1,outcodeOut;
int accept = FALSE,done = FALSE;
outcode0 = CompOutCode(x0,y0);
outcode1 = CompOutCode(x1,y1);
do
{
if(!(outcode0|outcode1))
{
accept = TRUE;
done = TRUE;
}
else
if(outcode0 & outcode1)
done = TRUE;
else
{
float x,y;
outcodeOut = outcode0?outcode0:outcode1;
if(outcodeOut & TOP)
{
x = x0+(x1-x0)*(ymax-y0)/(y1-y0);
y = ymax;
}
else
if(outcodeOut & BOTTOM)
{
x = x0+(x1-x0)*(ymin-y0)/(y1-y0);
y = ymin;
}
else
if(outcodeOut & RIGHT)
{
y = y0+(y1-y0)*(xmax-x0)/(x1-x0);
x = xmax;
}
else
{
y = y0+(y1-y0)*(xmin-x0)/(x1-x0);
x = xmin;
}
if(outcodeOut==outcode0)
{
x0 = x;
y0 = y;
outcode0 = CompOutCode(x0,y0);
}
else
{
x1 = x;
y1 = y;
outcode1 = CompOutCode(x1,y1);
}
}
}while(done==FALSE);
if(accept)
line(x0,y0,x1,y1);
outtextxy(200,20,"LINE AFTER CLIPPING");
rectangle(xmin,ymin,xmax,ymax);
}
outcode CompOutCode(float x,float y)
{
outcode code = 0;
if(y>ymax)
code|=TOP;
else
if(y<ymin)
code|=BOTTOM;
if(x>xmax)
code|=RIGHT;
else
if(x<xmin)
code|=LEFT;
return code;
}

void main( )
{
float x1,y1,x2,y2;
int gdriver = DETECT, gmode ;

printf("\nEnter the endpoints of line\n");


scanf("%f%f%f%f",&x1,&y1,&x2,&y2);
printf("Enter the rectangular coordinates of clipping window\n");
scanf("%f%f%f%f",&xmin,&ymin,&xmax,&ymax);

/* initialize graphics and local variables */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

outtextxy(200,20,"LINE BEFORE CLIPPING");


line(x1,y1,x2,y2);
rectangle(xmin,ymin,xmax,ymax);
getch( );
cleardevice( );
clip(x1,y1,x2,y2);
getch( );
restorecrtmode( );
}
OUTPUT:

Enter the endpoints of line


100
80
470
340
Enter the rectangular coordinates of clipping window
180
150
300
280
/* WINDOW TO VIEWPORT TRANSFORMATION */

#include <stdio.h>
#include <conio.h>
#include <graphics.h>

void main( )
{
int wxmin,wymin,wxmax,wymax,vxmin,vymin,vxmax,vymax ;
/* request auto detection */
int gdriver = DETECT, gmode , i , n, poly[14],poly1[14];
float sx,sy;

/* initialize graphics and local variables */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

printf("Enter the coordinates of window\nwxmin = ");


scanf("%d",&wxmin);
printf("\nwymin = ");
scanf("%d",&wymin);
printf("\nwxmax = ");
scanf("%d",&wxmax);
printf("\nwymax = ");
scanf("%d",&wymax);
printf("Enter the coordinates of viewport\nvxmin = ");
scanf("%d",&vxmin);
printf("\nvymin = ");
scanf("%d",&vymin);
printf("\nvxmax = ");
scanf("%d",&vxmax);
printf("\nvymax = ");
scanf("%d",&vymax);
printf("\nEnter the no of sides of polygon:");
scanf("%d",&n);
printf("Enter the coordinates of polygon:\n");
for(i=0;i<2*n;i++)
{
scanf("%d",&poly[i]);
}
cleardevice( );

poly[2*n] = poly[0];
poly[2*n+1] = poly[1];
/* draw the polygon */
drawpoly(n+1, poly);
rectangle(wxmin,wymin,wxmax,wymax);

sx = (vxmax-vxmin)/(wxmax-wxmin);
sy = (vymax-vymin)/(wymax-wymin);

for(i=0;i<n;i++)
{
poly1[2*i] = sx*(poly[2*i]-wxmin)+vxmin;
poly1[2*i+1] = sx*(poly[2*i+1]-wymin)+vymin;
}
poly1[2*n] = poly1[0];
poly1[2*n+1] = poly1[1];
rectangle(vxmin,vymin,vxmax,vymax);
outtextxt(150,10,” WINDOW TO VIEWPORT TRANSFORMATION”);
drawpoly(n+1,poly1);
/* clean up */
getch( );
closegraph( );
return 0;
}

OUTPUT:

Enter the coordinates of window


wxmin = 30
wymin = 30
wxmax = 150
wymax = 150
Enter the coordinates of viewport
vxmin = 160
vymin = 160
vxmax = 450
vymax = 450
Enter the no of sides of polygon:3
Enter the coordinates of polygon:
100
100
130
120
50
140
/*SUTHERLAND-HODGEMAN POLYGON CLIPPING*/

#include <stdio.h>
#include <graphics.h>
#include <conio.h>
#include <math.h>
#include <process.h>

#define TRUE 1
#define FALSE 0

typedef unsigned int outcode;


outcode CompOutCode(float x,float y);

enum { TOP = 0x1,


BOTTOM = 0x2,
RIGHT = 0x4,
LEFT = 0x8
};
float xmin,xmax,ymin,ymax;

void clip(float x0,float y0,float x1,float y1)


{
outcode outcode0,outcode1,outcodeOut;
int accept = FALSE,done = FALSE;
outcode0 = CompOutCode(x0,y0);
outcode1 = CompOutCode(x1,y1);
do
{
if(!(outcode0|outcode1))
{
accept = TRUE;
done = TRUE;
}
else
if(outcode0 & outcode1)
done = TRUE;
else
{
float x,y;
outcodeOut = outcode0?outcode0:outcode1;
if(outcodeOut & TOP)
{
x = x0+(x1-x0)*(ymax-y0)/(y1-y0);
y = ymax;
}
else
if(outcodeOut & BOTTOM)
{
x = x0+(x1-x0)*(ymin-y0)/(y1-y0);
y = ymin;
}
else
if(outcodeOut & RIGHT)
{
y = y0+(y1-y0)*(xmax-x0)/(x1-x0);
x = xmax;
}
else
{
y = y0+(y1-y0)*(xmin-x0)/(x1-x0);
x = xmin;
}
if(outcodeOut==outcode0)
{
x0 = x;
y0 = y;
outcode0 = CompOutCode(x0,y0);
}
else
{
x1 = x;
y1 = y;
outcode1 = CompOutCode(x1,y1);
}
}
}while(done==FALSE);
if(accept)
line(x0,y0,x1,y1);
outtextxy(150,20,"POLYGON AFTER CLIPPING");
rectangle(xmin,ymin,xmax,ymax);

outcode CompOutCode(float x,float y)


{
outcode code = 0;
if(y>ymax)
code|=TOP;
else
if(y<ymin)
code|=BOTTOM;
if(x>xmax)
code|=RIGHT;
else
if(x<xmin)
code|=LEFT;
return code;
}

void main( )
{
float x1,y1,x2,y2;
/* request auto detection */
int gdriver = DETECT, gmode, n,poly[14],i;
clrscr( );
printf("Enter the no of sides of polygon:");
scanf("%d",&n);
printf("\nEnter the coordinates of polygon\n");
for(i=0;i<2*n;i++)
{
scanf("%d",&poly[i]);
}
poly[2*n]=poly[0];
poly[2*n+1]=poly[1];
printf("Enter the rectangular coordinates of clipping window\n");
scanf("%f%f%f%f",&xmin,&ymin,&xmax,&ymax);

/* initialize graphics and local variables */


initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
outtextxy(150,20,"POLYGON BEFORE CLIPPING");
drawpoly(n+1,poly);
rectangle(xmin,ymin,xmax,ymax);
getch( );
cleardevice( );
for(i=0;i<n;i++)
clip(poly[2*i],poly[(2*i)+1],poly[(2*i)+2],poly[(2*i)+3]);
getch( );
restorecrtmode( );
}

OUTPUT:
Enter the no of sides of polygon:5
Enter the coordinates of polygon
50
50
200
100
350
350
80
200
40
80
Enter the rectangular coordinates of clipping window
150
150
300
300
INDEX
1. Program to draw a line : DDA Algorithm.
2. Program to draw a line : Bresenham’s Algorithm.
3. Program to draw a circle : Midpoint Circle Algorithm.
4. Program to draw a circle : Bresenham’s Circle Algorithm.
5. Program to draw an ellipse : Midpoint Ellipse Algorithm.
6. Rotation of line about origin and fixed point.
7. Scaling of line about origin and fixed point.
8. Translation of line.
9. Shearing of line.
10. Reflection of line about X-axis,Y-axis and arbitary line.
11. Program to clip a line : Cohen Sutherland Algorithm.
12. Window to Viewport transformation.
Computer Graphics Curves

In computer graphics, we often need to draw different types of


objects onto the screen. Objects are not flat all the time and we
need to draw curves many times to draw an object.
Types of Curves
A curve is an infinitely large set of points. Each point has two
neighbors except endpoints. Curves can be broadly classified into
three categories − explicit, implicit, and parametric curves.
Implicit Curves
Implicit curve representations define the set of points on a curve
by employing a procedure that can test to see if a point in on the
curve. Usually, an implicit curve is defined by an implicit
function of the form −
f(x, y) = 0
It can represent multivalued curves (multiple y values for an x
value). A common example is the circle, whose implicit
representation is
x2 + y2 - R2 = 0
Explicit Curves
A mathematical function y = f(x) can be plotted as a curve. Such
a function is the explicit representation of the curve. The explicit
representation is not general, since it cannot represent vertical
lines and is also single-valued. For each value of x, only a single
value of y is normally computed by the function.
Parametric Curves
Curves having parametric form are called parametric curves. The
explicit and implicit curve representations can be used only when
the function is known. In practice the parametric curves are used.
A two-dimensional parametric curve has the following form −
P(t) = f(t), g(t) or P(t) = x(t), y(t)
The functions f and g become the (x, y) coordinates of any point
on the curve, and the points are obtained when the parameter t is
varied over a certain interval [a, b], normally [0, 1].
Polygon Surfaces
Objects are represented as a collection of surfaces. 3D object
representation is divided into two categories.
 Boundary Representations (B-reps) − It describes a 3D
object as a set of surfaces that separates the object interior
from the environment.
 Space–partitioning representations − It is used to describe
interior properties, by partitioning the spatial region
containing an object into a set of small, non-overlapping,
contiguous solids (usually cubes).
The most commonly used boundary representation for a 3D
graphics object is a set of surface polygons that enclose the object
interior. Many graphics system use this method. Set of polygons
are stored for object description. This simplifies and speeds up
the surface rendering and display of object since all surfaces can
be described with linear equations.
The polygon surfaces are common in design and solid-modeling
applications, since their wireframe display can be done quickly
to give general indication of surface structure. Then realistic
scenes are produced by interpolating shading patterns across
polygon surface to illuminate.

Polygon Tables
In this method, the surface is specified by the set of vertex
coordinates and associated attributes. As shown in the following
figure, there are five vertices, from v1 to v5.
 Each vertex stores x, y, and z coordinate information which
is represented in the table as v1: x1, y1, z1.
 The Edge table is used to store the edge information of
polygon. In the following figure, edge E1 lies between vertex
v1 and v2 which is represented in the table as E1: v1, v2.
 Polygon surface table stores the number of surfaces present
in the polygon. From the following figure, surface S1 is
covered by edges E1, E2 and E3 which can be represented in
the polygon surface table as S1: E1, E2, and E3.
Plane Equations
The equation for plane surface can be expressed as −
Ax + By + Cz + D = 0
Where (x, y, z) is any point on the plane, and the coefficients A,
B, C, and D are constants describing the spatial properties of the
plane. We can obtain the values of A, B, C, and D by solving a
set of three plane equations using the coordinate values for three
non collinear points in the plane. Let us assume that three vertices
of the plane are (x1, y1, z1), (x2, y2, z2) and (x3, y3, z3).
Let us solve the following simultaneous equations for ratios A/D,
B/D, and C/D. You get the values of A, B, C, and D.
(A/D) x1 + (B/D) y1 + (C/D) z1 = -1
(A/D) x2 + (B/D) y2 + (C/D) z2 = -1
(A/D) x3 + (B/D) y3 + (C/D) z3 = -1
To obtain the above equations in determinant form, apply
Cramer’s rule to the above equations.
For any point (x, y, z) with parameters A, B, C, and D, we can
say that −
 Ax + By + Cz + D ≠ 0 means the point is not on the plane.
 Ax + By + Cz + D < 0 means the point is inside the surface.
 Ax + By + Cz + D > 0 means the point is outside the surface.
3D Modelling System
 3D modeling is a technique in computer graphics for producing a 3D digital
representation of any object or surface.
 An artist uses special software to manipulate points in virtual space(called
vertices) to form a mesh: a collection of vertices that form an object.
 These 3D objects can be generated automatically or created manually
by deforming the mesh, or otherwise manipulating vertices.
 3D models are used for a variety of mediums including video games, movies,
architecture, illustration, engineering, and commercial advertising.
 The 3D modeling process produces a digital object capable of being fully
animated, making it an essential process for character animation and special
effects.
 The core of a model is the mesh which is best described as a collection of points
in space.

 It is of three types

 Solid Modelling System


 Surface Modelling System
 Wireframe Models

NOTES BY Mr. GAURAV SRIVASTAVA


Solid Modelling System
What is Solid Modeling?
1. A way to represent, generates, and manipulates solid objects.

2. Necessary for many applications where objects must be maintained as solids. e.g. finite element analysis,
computer aided design and machining (CAD/CAM), mass property determination,refraction.

DETAIL INTRODUCTION:
Solid modeling is the unambiguous representation of the solid parts of an object, that
is, models of solid objects suitable for computer processing. Today, 3d solid modeling
is preferred over 2d modeling because of its flexibility, ease of rendering and accurate
photorealism.
Solid Modeling is the representation of solid parts of an object, that is, models of solid
objects suitable for computer processing. 3D solid modeling is used in computer-
aided design (CAD), engineering analysis, computer graphics, medical testing, product
visualization and scientific research.
There are many ways to create solid modeling. These include sweeping, boundary
representation, spatial occupancy enumeration, cellular decomposition, functional
representation, feature-based modeling, parametric modeling and facet modeling.
ADVANTAGES: 3D solid modeling has been replacing 2D modeling over the past
few years.
 The realistic depiction of objects is a big advantage for manufacturers, allowing
them to see how a product functions without actually spending time and
money actually creating it.
 The product design can be changed frequently to ensure that it’s flawless,
thereby improving efficiency.
 In a solid model, a group of features is added one at a time until the model is
complete. Engineering solid models are built mostly with sketcher-based
features — 2-D sketches that are swept along a path to become 3-D.
 Apart from the manufacturing sector, 3D Solid Modeling is also used in the
entertainment sector, for animation. Computer-generated characters, for
example, involve parametric modeling.

NOTES BY Mr. GAURAV SRIVASTAVA


 Solid modeling is also used in the medical sector. Computed axial tomography
and magnetic resonance imaging scanners can be used to create solid models
of internal body features. Optical 3D scanners can be used to create point
clouds or polygon mesh models of external body features.
 3D Solid Modeling is also used in the entertainment sector, for animation.
Computer-generated characters, for example, involve parametric modeling.
 Solid modeling is also used in the medical sector. Computed axial tomography
and magnetic resonance imaging scanners can be used to create solid models
of internal body features. Optical 3D scanners can be used to create point
clouds or polygon mesh models of external body features.
 Most geometric objects we see every day are solids. That is, they are geometric
objects with interior. Solids can be very simple like a cube or very complex like
a piston engine. To be processed by computers, solids must have some
representations that can describe the geometry and characteristics completely.
 A good representation should address the following issues, or we can say the
desired properties of solid modeling systems are given below :

1. Domain :
While no representation can describe all possible solids, a representation
should be able to represent a useful set of geometric objects.
2. Unambiguity :
When you see a representation of a solid, you will know what is being
represented without any doubt. An unambiguous representation is usually
referred to as a complete one.
3. Uniqueness :
That is, there is only one way to represent a particular solid. If a representation
is unique, then it is easy to determine if two solids are identical since one can
just compare their representations.
4. Accuracy :
A representation is said accurate if no approximation is required.
5. Validness :
This means a representation should not create any invalid or impossible solids.
More precisely, a representation will not represent an object that does not
correspond to a solid.
6. Closure :
Solids will be transformed and used with other operations such as union and

NOTES BY Mr. GAURAV SRIVASTAVA


intersection. "Closure" means that transforming a valid solid always yields a
valid solid.
7. Compactness and Efficiency :
A good representation should be compact enough for saving space and allow
for efficient algorithms to determine desired physical characteristics.

Sweep Representations:

 Sweep representations are useful for both surface modeling and solid
modeling.
 A large class of shapes (both surfaces and solid models) can be formed by
sweeping or extruding a 2D shape through space.
 Sweep representations are useful for constructing 3-D objects that posses
translational or rotational symmetries. We can represent such object by
specifying a 2D shape and a sweep that move the shape through a region of
space. A set of 2D primitives can be provided for a sweep representation as
menu options.
Types of Sweep Representations:
1. Translational sweep/Linear sweep .
2. Rotation sweep.

In Translational sweep, the shape is translated along a predefined translational


vector.

In Rotational sweep, the shape is rotated around a predefined rotational axis.

( a vertical prism)

sweep in Creates

top direction

/* TRANSLATION SWEEP */

Creates

(a cylinder)

NOTES BY Mr. GAURAV SRIVASTAVA


Sweep /* ROTATIONAL SWEEP*/

SOLID MODEL REPRESENTATION SCHEMES:

1. Constructive solid geometry (CSG)


2. Boundary representation (B-rep)

 Constructive solid geometry (CSG):

• Objects are represented as a combination of simpler solid objects (primitives).


• The primitives are such as cube, cylinder, cone, torus, sphere etc.
• Copies or “instances” of these primitive shapes are created and positioned.
• A complete solid model is constructed by combining these “instances” using set
specific, logic operations (Boolean)

• Boolean operation
• each primitive solid is assumed to be a set of points, a boolean operation
is performed on point sets and the result is a solid model.
• Boolean operation à union, intersection and difference
• The relative location and orientation of the two primitives have to be
defined before the boolean operation can be performed.
• Boolean operation can be applied to two solids other than the primitives.

NOTES BY Mr. GAURAV SRIVASTAVA


 Constructive solid geometry (CSG)- boolean operation

• Union
– The sum of all points in each of two defined sets. (logical “OR”)
– Also referred to as Add, Combine, Join, Merge

A B

AU B

• Difference:
– The points in a source set minus the points common to a second set.
(logical “NOT”)
– Set must share common volume
– Also referred to as subtraction, remove, cut

A B A-B

• Intersection
– Those points common to each of two defined sets (logical “AND”)
– Set must share common volume
– Also referred to as common, conjoin

A B AꓵB

NOTES BY Mr. GAURAV SRIVASTAVA


Some Imp Points:

• When using boolean operation, be careful to avoid situation that do not result in
a valid solid

A B AꓵB

 Boolean operation

 Are intuitive to user


 Are easy to use and understand
 Provide for the rapid manipulation of large amounts of data.

 Because of this, many non-CSG systems also use Boolean operations

 Constructive solid geometry (CSG)- CSG tree:

• CSG tree à stores the history of applying boolean operations on the primitives.
– Stores in a binary tree format
– The outer leaf nodes of tree represent the primitives
– The interior nodes represent the boolean operations performed.

NOTES BY Mr. GAURAV SRIVASTAVA


(CSG) - Advantage

• CSG is powerful with high level command.


• Easy to construct a solid model – minimum step.
• CSG modeling techniques lead to a concise databaseà less storage.

Complete history of model is retained and can be altered at any point.

• Can be converted to the corresponding boundary representation.

(CSG) - Disadvantage

• Only boolean operations are allowed in the modeling process à with boolean
operation alone, the range of shapes to be modeled is severely restricted à not
possible to construct unusual shape.

• Requires a great deal of computation to derive the information on the boundary,


faces and edges which is important for the interactive display/ manipulation of
solid.

NOTES BY Mr. GAURAV SRIVASTAVA


Boundary representation (B-Rep):

• A solid is bounded by its surface and it has its interior and ecxterior .The solid’s
surface consists of a set of well organized faces each of which is a piece of some
surface. These faces may share vertices and edges that are curve segments. So,

B-rep = Wireframe model + Face Information


 Solid model is defined by their enclosing surfaces or boundaries. This technique


consists of the geometric information about the faces, edges and vertices of an
object with the topological data on how these are connected.

Two Types of Information (in a B-rep):

1. Topological Information: It provides the relationship among vertices, edges


and faces similar to that used in a wireframe model.Not only connectivity,it
also includes the orientation of edges and faces.
2. Geometric Information: These are usually equations of the edges & faces.

Advantages:

• Capability to construct unusual shapes that would not be possible with the
available CSG a aircraft fuselages, swing shapes.
• Less computational time to reconstruct the image.

Disadvantages:

• Requires more storage


• More prone to validity failure than CSG
• Model display limited to planar faces and linear edges.
• complex curve and surfaces only approximated.

NOTES BY Mr. GAURAV SRIVASTAVA


What Does Surface Modeling Mean?

 Surface modeling is a mathematical method usually provided in computer-


aided design applications for displaying solid-appearing objects.
 Surface modeling makes it possible for users to look at the specific object at
specific angles with solid surfaces.
 Surface modeling is a popular technique for architectural designs and
renderings.
 Surface modeling has wide range of applications such as in consumer products,
marine vehicles, body panels of automobiles and aircraft structures.

TYPES OF SURFACES IN SURFACE MODELING:

 There are two types of surfaces that are commonly used in modeling systems:
 Explicit surface
 Impicit surface.
 Parametric surface
EXPLICIT SURFACE OF SURFACE MODELING:

NOTES BY Mr. GAURAV SRIVASTAVA


IMPICIT SURFACE OF SURFACE MODELING

It is defined by a polynomial of three variables : f(x,y,z ) =0

Example:
1. (X-X0)2 +(Y-Y0)2 + (Z-Z0 )2 - R2 =0

PARAMETRIC SURFACE OF SURFACE MODELING:

Parametric surfaces are defined by a set of three functions,oneforeach coordinate

X=f(u,v)

Y=f(u,v)

Z=f(u.v)

Where u & v are in certain domain in the range of 0 & 1.

Thus (u,v) is a point in the square defined by (0,0),(1,0),(0,1) & (1,1) in the uv
coordinate plane.

NOTES BY Mr. GAURAV SRIVASTAVA


PARAMETRIC SURFACE PATCH:

 A parametric surface patch can be considered as a union (infinite


number) of curves.
 Given a parametric surface(u,v), if u is fixed to a value ,and let v vary, this
generates a curve on the surface whose u coordinate is a constant . This
is the “isoparametric curve” in the v direction.
 Similarly,fixing v to a value and letting u vary , we obtain an
“isoparametric curve” whose v direction is a constant.

SURFACE OF REVOLUTION :

 A surface of revolution is a surface in three-dimensional space created by


rotating a curve, known as the generatrix, about a straight line in the same plane,
known as the axis.
 In many cases, this axis is the -axis or the -axis. ... Alternatively, select a
predefined curve or enter a formula in the box.
 A surface of revolution is obtained by revolving a curve (known as the base
curve or profile curve) about an axis.
 In other words, a surface of revolution is generated by a rotational sweep of a
2D curve.

NOTES BY Mr. GAURAV SRIVASTAVA


 The symmetry of the surface of revolution makes it a very useful object in
presentation graphics.

The three-dimensional surface obtained by revolving the curve y = f(x) about


the y-axis is obtained by replacing x with sqrt(x*x + z*z).
The surface of revolution is thus given by :

y f  x z 
2 2

SWEEP SURFACES:
 A three dimensional surface is also obtained by traversing an entity, e.g.
a line, polygon or curve, along a path in space. The resulting surfaces are
called “sweep surfaces”. Sweep surface generation is frequently used in
geometric modeling.

NOTES BY Mr. GAURAV SRIVASTAVA


 A sweep surface is obtained when a space curve C (u), termed the profile,
is transformed by a transformation rule T(w). The transformation must
include translation and /or rotation and may also include scaling and
shearing. We say that the surface is swept by the profile curve when
it(the curve) is transformed . The expression of the surface is simply the
product P(u,w),i.e.
P(u,w) = C(u) . T (w)

The transformation T is a 4x4 matrix ,so vector C should be written in


homogeneous coordinate , as the 4-tuple C(u) = (u,0,0,1) where 0≤ u ≤ 1 . This
segment is translated along the y axis by the transformation matrix.

T(w) = 1 0 0 0
0 1 0 0
0 0 1 0
0 w 0 1

where 0≤ w ≤ 1. The surface P(u,w) = C(u).T(w) = (u,w,0,1) swept by this


segment is (after dividing by the fourth element) P(u,w) = (u,w,0). This surface
is simply the square, on the xy plane ,whose opposite corners are the origin and
point (1, 1, 0) .

 The simplest sweep entity is a point. The result of sweeping a point along
a path is, of course, not a surface but a space curve. However, it serves to
illustrate the fundamental technique.
Consider the position vector P[x y z 1] swept along the path represented by the
sweep transformation [Ts]. The position vector Q(s) representing the resulting
curve is
Q(s) = P . [ TS ] s1 ≤ s < s2

The transformation [Ts] determines the shape of the curve.


EXAMPLE: If the path is a straight line of length n parallel to the z axis, then

[ TS] = 1 0 0 0
0 1 0 0
0 0 1 0
0 0 ns 1 0≤s≤1

NOTES BY Mr. GAURAV SRIVASTAVA


VOXEL REPRESENTATION:
In voxel representation,an object is decomposed into identical cells arranged in a
fixed rectangular grid. These cells are called voxels(volume elements),in analogy to
pixels.
Example:
A cylinder can be represented as follows by voxels. A ‘1’ may represented
Inside the cylinder while a ‘0’ may represent outside of the cylinder. Alternatively
we may use 8 bits to represent the transparency value. If a voxel has a value of ‘0’
it is a fully transparent cell . If a voxel has a value of ‘255’,it is a non –transparent
cell.

QUADTREE :
Quadtrees are a knowledge structure that encodes a two-dimensional space into
adaptable cells. Quadtrees are generated by successively dividing a 2-D region(usually
a square) into quadrants. Each node in the quad tree has 4 data elements, one for
each of the quadrants in the region.

If all the pixels within a quadrant have the same color (i.e. a homogeneous quadrant),
the corresponding data element in the node stores that color. Also ,a flag is set in the
data element to indicate that quadrant is homogeneous.

NOTES BY Mr. GAURAV SRIVASTAVA


Example: Suppose all pixels in the quadrant 2 are found to be green. The color code
for green is then placed in data element 2 of the node. Else the quadrant is said to be
a heterogeneous quadrant, that quadrant is itself divided into quadrants. The
corresponding data element in the node now flags the quadrant as heterogeneous
and stores the pointer to the next node in the quadtree. In simple words, for a
heterogeneous region of space, the successive divisions into quadrants continues
until all quadrants are homogeneous.

Quadrant Quadrant
0 1 2 3
0 1
Quadrant Quadrant
3 2
Data Elements in the Representative Quadtree Node
Region of 2D space

/* Region of a 2D space divided into numbered quadrants & associated


quadtree node with 4 data elements */

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

Region of 2 D space Quadtree Representation

/* Region of a 2D space with 2 levels of quadrant divisions & the associated


quadtree representation*/

NOTES BY Mr. GAURAV SRIVASTAVA


OCTREES:
 Octrees is a hierarchical tree structure that is so organized that each node
corresponds to a region of 3D space.
 Hierarchical tree structure, called Octrees, is used to represent solid objects in
some graphics system.
 Medical imaging and other applications that require displays of object cross
sections use octree representations. Octrees use quad tree encoding for
encoding a 3D space.
 An octree encoding scheme divide regions of 3-D space(usually a cube) in to
octants and stores 8 data elements in each node of the tree.
 Individual elements of a 3-D space are called “volume elements or voxels”
 When all voxels in an octant are of the same type, this type value is stored in
the corresponding data element of the node. Empty region of space are
represented by voxel type “void”.
 Any heterogeneous octant is subdivided into octants and the corresponding
data element in the node points to the next node in the octree. Procedures for
generating octrees continue until the region of spacecontains only
homogeneous octants. Each node in the octree can now have zero to eight
immediate descendants.

NOTES BY Mr. GAURAV SRIVASTAVA


QUADRIC SURFACE

A frequently used class of objects is the quadric surfaces, which are described with
second-degree equations (quadratics). They include spheres, ellipsoids,
tori,paraboloids, and hyperboloids. Quadric surfaces, particularly spheres and
ellipsoids, are common elements of graphics scenes, and they are often available in
graphics packages as primitives horn which more complex objects can be constructed.

Sphere:

In Cartesian coordinates, a spherical surface with radius r centered on the coordinate


origin is defined as the set of points (x, y, z) that satisfy the equation

X2 y2 z2 = r2

NOTES BY Mr. GAURAV SRIVASTAVA


We can also describe the spherical surface in parametric form, using latitude and
longitude angles (Fig. 10-8):

The parametric representation inEqs. 10-8 provides a symmetric range for the angular
parameters θand φ. alternatively, we could write the parametric colatitude (Fig. 10-
9). Then, φis defined over the range 0≤φ≤ π and θis often taken in the range 0 ≤θ≤ 2π.
We could also set up the representation using parameters u and v, defined over the
range from 0 to 1 by substituting φ= πu and θ= 2πv.

Ellipsoid: An ellipsoidal surface can be described as an extension of a spherical


surface, where the radii in three mutually perpendicular directions can have different
values (Fig. 10-10). The Cartesian representation for points over the surface of an
ellipsoid centered on the origin is

NOTES BY Mr. GAURAV SRIVASTAVA


And a parametric representation for the ellipsoid in terms of the latitude angle 4 and
the longitude angle 0 in Fig. 10-8 is

TORUS

Introduction: A torus is a doughnut-shaped object; it can be generated by rotating a


circle or other conic about a specified axisas shown in Fig. 10-11. The Cartesian
representation for points over the surface of a torus can be written in the form

where r is any given offset value. Parametric representations for a torus are similar to
those for an ellipse, except that angle d extends over 360". Using latitude and
longitude angles 4 and 8, we can describe the torus surface as the set of points that
satisfy

NOTES BY Mr. GAURAV SRIVASTAVA


SUPER QUADRICS

Introduction: This class of objects is a generalization of the quadric representations.


Superquadricsare formed by incorporating additional parameters into the quadric
equations to provide increased flexibility for adjusting object shapes. The number of
additional parameters used is equal to the dimension of the object: one parameter
for curves and two parameters for surfaces.

Superellipse: We obtain a Cartesian representation for a superellipse from the


corresponding equation for an ellipse by allowing the exponent on the x and y terms
to be variable. One way to do this is to write the Cartesian superellipse equation in,
the form

NOTES BY Mr. GAURAV SRIVASTAVA


……………………. 1

where parameter s can be assigned any real value. When s = 1, we get an ordinary
ellipse.

Corresponding parametric equations for the superellipse of Eq. 1 can be expressed as

…………….2

Figure 10-12 illustrates supercircle shapes that can be generated using various values
for parameters.

Superellipsoid:

A Cartesian representation for a superellipsoid is obtained from the equation for an


ellipsoid by incorporating two exponent parameters:

………………………….3

For s1 = s2 = 1, we have an ordinary ellipsoid.

We can then write the corresponding parametric representation for the


superellipsoid of Eq. 3 as

……….4

NOTES BY Mr. GAURAV SRIVASTAVA


Figure 10-12 illustrates supersphere shapes that can be generated using various values for
parameters s1 and s2. These and other superquadric shapes can be combined to create
more complex structures, such as furniture, threaded bolts, and other hardware.

NOTES BY Mr. GAURAV SRIVASTAVA


Bezier Surfaces
 This is a surface that approximates given input data. It is different from the many
surfaces in that it is a synthetic surface, it does not pass through all given data points.
 Two sets of orthogonal Bezier curves can be used to design an object surface by
specifying by an input mesh of control points. The parametric vector function for the
Bezier surface is formed as the Cartesian product of Bezier blending functions:

With pj,k, specifying the location of the (m 1) by (n I ) control points.

NOTES BY Mr. GAURAV SRIVASTAVA


Figure 10-39 illustrates two Bezier surface plots. The control points are connected by
dashed lines, and the solid lines show curves of constant u and constant v. Each curve
of constant u is plotted by varying v over the interval from 0 to 1, with u fixed at one
of the values in this unit interval. Curves of constant v are plotted similarly

Properties of Beizer Surface :

1. The surface does not pass through the control points except for the corners of
the control point grid.
2. The surface is contained within the convex hull of the control points.
3. Along the edges of the grid patch, the beizer surface matches that of a beizer
curve through the control points along that edge.
4. A cylinder/cone can be formed from a Bezier surface, it is not possible to form
a sphere.
5. Closed surfaces can be formed by setting the last control points equal to the
first .If the tangents also match between the first two and the last controlpoints
then the closed surface will have first order continuity.

NOTES BY Mr. GAURAV SRIVASTAVA


B-Spline Surface :
The surface analogue of the B-spline curve is the B-spline surface.
As with curve ,B-spline surfaces are a generalization of Bezier surfaces.
The surface approximates a control polygon.
B-spilne surface is defined by a topologically rectangular set of control points Pij ,
0 ≤ i ≤ m, 0 ≤ j ≤ n and two knot vectors U=(u0 ,u1 ,…….,u m + k ) and V=(v0 ,v1 ,….,vn+1)
Associated with each parameter u, v . The B-spline surface is defined by –

Where, Ni ,k and N j , l are Blending function

Parametric lines on a B-spline surface are obtained by letting u= const or v = const . A


parametric line with u = u0 is a B-spline curve in v with V as its knot vector and
vertices qj , 0≤ j ≤ n given by

Where, Ni ,m is a Blending function & Pij is control points.

NOTES BY Mr. GAURAV SRIVASTAVA


COMPARISON OF BEZIER CURVE & B-SPLINE CURVE :

BEIZER CURVE B-SPLINE CURVE


A change in a portion of a curve causes B-Spline has local control over the curve.
the whole of the curve to change So, whole of the curve need not change .
They interpolate their first and last They do not interpolate their first and
control points. last control points.
They are less flexible They are more flexible with large
number of control points.
They are not designed with sharp bend They are designed with sharp bend and
and cornered curves even corners.
They are special case of B-Spline curves. They are not special case of Beizer
curves.

Difference between Spline, B-Spline and Bezier Curves :

Spline B-Spline Bezier

A spline curve can be


specified by giving a
specified set of
coordinate positions, The B-Spline curves The Bezier curves can be
called control points are specified by specified with boundary
which indicate the Bernstein basis conditions, with a
general shape of the function that has characterizing matrix or
curve. limited flexibiity. with blending function.

These curves are a


result of the use of The curve generally follows
It follows the general open uniform basis the shape of a defining
shape of the curve. function. polygon.

Typical CAD application for


spline include the design
of automobile bodies, These curves can be These are found in painting
aircraft and spacecraft used to construct and drawing packages as
surfaces and ship hulls. blending curves. well as in CAD applications.

NOTES BY Mr. GAURAV SRIVASTAVA


The B-Spline allows
the order of the basis
It possess a high function and hence The degree of the
degree of smoothness the degree of the polynomial defining the
at the places where resulting curve is curve segment is one less
the polynomial pieces independent of than the number of defining
connect. number of vertices. polygon point.

A spline curve is a
mathematical
representation for which it
is easy to build
an interface that will In B-Spline, there is
allow a user to design and local control over the
control the shape of curve surface and the
complex shape of the curve is It is a parametric curve used in
curves and surfaces. affected by every vertex. related fields.

Difference Between Beizer Curve and Hermite Curve :

A Bezier curve is specified by four control points; a Hermite curve is specified


by two control points and two tangents. Actually, both of these curves are cubic
polynomials. The only difference is that they are expressed with respect to
different bases.

Wireframe Models: It has a lot of other names also i.e.

 Edge vertex models


 Stick figure model
 Polygonal net
 Polygonal mesh
 Visible line detection method

 Wireframe model consists of vertex, edge (line) and polygons. Edge is used to
join vertex. Polygon is a combination of edges and vertices. The edges can be

NOTES BY Mr. GAURAV SRIVASTAVA


straight or curved. This model is used to define computer models of parts,
especially for computer-assisted drafting systems.
 Wireframe models are Skelton of lines. Each line has two endpoints. The
visibility or appearance or look of the surface can be should using wireframe. If
any hidden section exists that will be removed or represented using dashed
lines. For determining hidden surface, hidden lines methods or visible line
methods are used.
 Advantage
 It is simple and easy to create.
 It requires little computer time for creation.
 It requires a short computer memory, so the cost is reduced.
 Wireframe provides accurate information about deficiencies of the surface.
 It is suitable for engineering models composed of straight lines.
 The clipping process in the wireframe model is also easy.
 For realistic models having curved objects, roundness, smoothness is achieved.
 Disadvantage
 It is given only information about the outlook if do not give any information
about the complex part.
 Due to the use of lines, the shape of the object lost in cluttering of lines.
 Each straight line will be represented as collections of four fold lines using data
points. So complexity will be increased.

NOTES BY Mr. GAURAV SRIVASTAVA



Polygon Meshes

3D surfaces and solids can be approximated by a set of polygonal and line elements.
Such surfaces are called polygonal meshes. In polygon mesh, each edge is shared by
at most two polygons. The set of polygons or faces, together form the “skin” of the
object.
This method can be used to represent a broad class of solids/surfaces in graphics. A
polygonal mesh can be rendered using hidden surface removal algorithms. The
polygon mesh can be represented by three ways −

 Explicit representation
 Pointers to a vertex list
 Pointers to an edge list

NOTES BY Mr. GAURAV SRIVASTAVA


Advantages

 It can be used to model almost any object.


 They are easy to represent as a collection of vertices.
 They are easy to transform.
 They are easy to draw on computer screen.

Disadvantages

 Curved surfaces can only be approximately described.


 It is difficult to simulate some type of objects like hair or liquid.

NOTES BY Mr. GAURAV SRIVASTAVA


NOTES BY Mr. GAURAV SRIVASTAVA
Generlized cone Representaion:

Definition 9.1 A surface generated by a straight line passing through a fixed


point and the intersecting a given curve is called as a cone.
The fixed point is called vertex of the cone and the given curve is called the
guiding curve. A line which generates the cone is called a generator.

NOTES BY Mr. GAURAV SRIVASTAVA


The surface in the Fig. is a cone with vertex V, The line V A as a generator. The lines V
B, V C are also generators. In fact every line joining V to any point of the guiding
curve is a generator of the cone.
Remark : If the guiding curve is a plane curve of degree n, then the equation of the
cone is also of degree n and we call it a cone of order n.

Equation of a cone
To find the equation of a cone with vertex V (α, β, γ) and whose guiding curve is the
conic
ax2 + 2hxy + by2 + 2gx + 2fy + c = 0, z = 0

GRAPHICS KERNEL SYSTEM (GKS):

Graphics Kernel System(GKS) is a document produced by International Standards


Organization (ISO),whch defines a common interface to interactive computer graphics
for application programs. It provides functional specifications for some 200
subroutines which perform graphical I/O. Thus, application program can move freely
between different graphical devices and different devices and different host
computers.
The primary purpose of GKS is :
1. To provide portability of graphics application programs.
2. To aid in understanding of graphics methods by application programmers.
3. To provide guidelines for manufacturers in describing useful graphics capabilities.

The second standard called the Graphics Kernal System(GKS) was developed in
Europe.
Another graphics standard is Programmer’s Hierarchical Interactive Graphics
Standard (PHIGS). It takes input and output functions and viewing model CORE and
GKS, but is ta a programmer’s toolbox, intended for programming graphics
applications .It contain enhanced program structuring features.
Two other graphics standard are the Computer Graphics Metafile (CGM) and the
Computer Graphics Interface (CGI). The CGM is a file formate for picture information
that allows device independent capture ,storage and transfer. CGI is a companion
standard which provides a procedural interface for CGM primitives.

NOTES BY Mr. GAURAV SRIVASTAVA

You might also like