Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
14 views68 pages

Viewing Part 2 & 3d

The document discusses various aspects of computer graphics, focusing on polygon clipping techniques such as the Sutherland-Hodgeman algorithm, which processes polygon vertices against clipping window boundaries to produce clipped polygon outputs. It also covers 3D object representation, geometric transformations, and viewing in three dimensions, as well as color models and applications of computer-generated animation. Techniques for text clipping and the handling of both convex and concave polygons are also addressed.

Uploaded by

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

Viewing Part 2 & 3d

The document discusses various aspects of computer graphics, focusing on polygon clipping techniques such as the Sutherland-Hodgeman algorithm, which processes polygon vertices against clipping window boundaries to produce clipped polygon outputs. It also covers 3D object representation, geometric transformations, and viewing in three dimensions, as well as color models and applications of computer-generated animation. Techniques for text clipping and the handling of both convex and concave polygons are also addressed.

Uploaded by

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

COMPUTER GRAPHICS

SIDDHARTHA BANERJEE

RAMAKRISHNA MISSION RESIDENTIAL


COLLEGE (AUTONOMOUS), NARENDRAPUR
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING
To clip polygons, we need to modify the line-clipping
procedures.

A polygon boundary processed with a line clipper may be


displayed as a series of disconnected line segments depending
on the orientation of the polygon to the clipping window.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING
To clip polygons, we need to modify the line-clipping
procedures.

A polygon boundary processed with a line clipper may be


displayed as a series of disconnected line segments depending
on the orientation of the polygon to the clipping window.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING
What we really want to display is a bounded area after
clipping.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING
What we really want to display is a bounded area after
clipping.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING
For polygon clipping, we require an algorithm that will
generate one or more closed areas that are then scan
converted for the appropriate area fill.

The output of a polygon clipper should be a sequence of


vertices that defines the clipped polygon boundaries.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
We can correctly clip a polygon by processing the polygon
boundary as a whole against each window edge.

This could be accomplished by processing all polygon


vertices against each clip rectangle boundary in turn.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
Beginning with the initial set of polygon vertices, we could
first clip the polygon against the left rectangle boundary to
produce a new sequence of vertices.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
Beginning with the initial set of polygon vertices, we could
first clip the polygon against the left rectangle boundary to
produce a new sequence of vertices.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
The new set of vertices could then be successively passed to
a right boundary clipper, a bottom boundary clipper, and a
top boundary clipper.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
The new set of vertices could then be successively passed to
a right boundary clipper, a bottom boundary clipper, and a
top boundary clipper.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
The new set of vertices could then be successively passed to
a right boundary clipper, a bottom boundary clipper, and a
top boundary clipper.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
There are four possible cases when processing vertices in
sequence around the perimeter of a polygon.
As each pair of adjacent polygon vertices is passed to a
window boundary clipper, we make the following tests:
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
(1) If the first vertex is outside the window boundary and the
second vertex is inside, both the intersection point of the
polygon edge with the window boundary and the second
vertex are added to the output vertex list.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
(2) If both input vertices are inside the window boundary,
only the second vertex is added to the output vertex list.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
(3) If the first vertex is inside the window boundary and the
second vertex is outside, only the edge intersection with
the window boundary is added to the output vertex list.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
(4) If both input vertices are outside the window boundary,
nothing is added to the output list.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
Once all vertices have been processed for one clip window
boundary, the output 1ist of vertices is clipped against the
next window boundary.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

3
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

3
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

3
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

3
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

3
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

3
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

3
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

3
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

3
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

3
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

Convex polygons are correctly clipped by the Sutherland-


Hodgeman algorithm, but concave polygons may be
displayed with extraneous lines.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

This occurs when the clipped polygon should have two or


more separate sections.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

 Since there is only one output vertex list, the last vertex in
the list is always joined to the first vertex.
VIEWING
3. CLIPPING OPERATION
3.3 POLYGON CLIPPING (SUTHERLAND-HODGEMAN)

 There are several things we could do to correctly display


concave polygons.
For one, we could split the concave polygon into two or
more convex polygons and process each convex polygon
separately.

Another possibility is to modify the Sutherland-Hodgeman


approach to check the final vertex list for multiple vertex
points along any clip window boundary and correctly join
pairs of vertices.
VIEWING
3. CLIPPING OPERATION
3.4 TEXT CLIPPING

There are several techniques that can be used to provide text


clipping in a graphics package.

The clipping technique used will depend on the methods


used to generate characters and the requirements of a
particular application.
VIEWING
3. CLIPPING OPERATION
3.4 TEXT CLIPPING

The simplest method for processing character strings


relative to a window boundary is to use the all-or-none string-
clipping strategy..
VIEWING
3. CLIPPING OPERATION
3.4 TEXT CLIPPING

If all of the string is inside a clip window, we keep it.


Otherwise, the string is discarded.
This procedure is implemented by considering a bounding
rectangle around the text pattern.
VIEWING
3. CLIPPING OPERATION
3.4 TEXT CLIPPING

The boundary positions of the rectangle are then compared


to the window boundaries, and the string is rejected if there is
any overlap.
This method produces the fastest text clipping.
VIEWING
3. CLIPPING OPERATION
3.4 TEXT CLIPPING

An alternative to rejecting an entire character string that


overlaps a window boundary is to use the all-or-none
character-clipping strategy.
VIEWING
3. CLIPPING OPERATION
3.4 TEXT CLIPPING

Here we discard only those characters that are not


completely inside the window.
In this case, the boundary limits of individual characters are
compared to the window.
VIEWING
3. CLIPPING OPERATION
3.4 TEXT CLIPPING

Any character that either overlaps or is outside a window


boundary is clipped.
VIEWING
3. CLIPPING OPERATION
3.4 TEXT CLIPPING

A final method for handling text clipping is to clip the


components of individual characters.
We now treat characters in much the same way that we
treated lines.
VIEWING
3. CLIPPING OPERATION
3.4 TEXT CLIPPING

If an individual character overlaps a clip window boundary,


we clip off the parts of the character that are outside the
window.
3D CONCEPT
1. THREE-DIMENSIONAL OBJECT REPRESENTATION

Graphics scenes can contain many different kinds of objects:


trees , flowers, clouds, rocks, water, bricks, wood paneling,
rubber, paper, marble, steel, glass, plastic, and cloth, just to
mention a few.

So it is probably not too surprising that there is no one


method that we can use to describe objects that will include all
characteristics of these different materials.

And to produce realistic displays of scenes, we need to use


representations that accurately model object characteristics.
3D CONCEPT
1. THREE-DIMENSIONAL OBJECT REPRESENTATION

Polygon and quadric surfaces provide precise descriptions


for simple Euclidean objects such as polyhedrons and
ellipsoids.

Spline surfaces and construction techniques are useful for


designing aircraft wings, gears, and other engineering
structures with curved surfaces.

Procedural methods, such as fractal constructions and


particle systems, allow us to give accurate representations for
clouds, clumps of grass, and other natural objects.
3D CONCEPT
1. THREE-DIMENSIONAL OBJECT REPRESENTATION

Physically based modeling methods using systems of


interacting forces can be used to describe the nonrigid
behavior of a piece of cloth or a glob of jello;

Octree encodings are used to represent internal features of


objects, such as those obtained from medical CT images; and
isosurface displays, volume renderings, and other
visualization techniques are applied to three-dimensional
discrete data sets to obtain visual representations of the data.
3D CONCEPT
2. 3D GEOMETRIC TRANSFORMATIONS

Methods for geometric transformations and object modeling


in three dimensions are extended from two-dimensional
methods by including considerations for the z coordinate.

We now translate an object by specifying a three-


dimensional translation vector, which determines how much
the object is to be moved in each of the three coordinate
directions.

Similarly, we scale an object with three coordinate scaling


factors.
3D CONCEPT
2. 3D GEOMETRIC TRANSFORMATIONS

The extension for three-dimensional rotation is less


straightforward.

When we discussed two-dimensional rotations in the xy


plane, we needed to consider only rotations about axes that
were perpendicular to the xy plane.

Most graphics packages handle three-dimensional rotation


as a composite of three rotations, one for each of the three
Cartesian axes.
3D CONCEPT
2. 3D GEOMETRIC TRANSFORMATIONS

As in the two-dimensional case, we express geometric


transformations in matrix form.

Any sequence of transformations is then represented as a


single matrix, formed by concatenating the matrices for the
individual transformations in the sequence.
3D CONCEPT
3. 3D VIEWING

In two-dimensional graphics applications, viewing


operations transfer positions from the world-coordinate plane
to pixel positions in the plane of the output device.

Using the rectangular boundaries for the world-coordinate


window and the device viewport, a two-dimensional package
maps the world scene to device coordinates and clips the
scene against the four boundaries of the viewport.

For three-dimensional graphics applications, the situation is


a bit more involved, since we now have more choices as to
how views are to be generated.
3D CONCEPT
3. 3D VIEWING

First of all, we can view an object from the front, from


above, or from the back.

Or we could generate a view of what we would see if we


were standing in the middle of a group of objects or inside a
single object, such as a building.

Additionally, three-dimensional descriptions of objects must


be projected onto the flat viewing surface of the output device.

And the clipping boundaries now enclose a volume of space,


whose shape depends on the type of projection we select.
COLOR MODEL
Our discussions of color up to this point have concentrated
on the mechanisms for generating color displays with
combinations of red, green, and blue light.

This model is helpful in understanding how color is


represented on a video monitor, but several other color models
are useful as well in graphics applications.

Some models are used to describe color output on printers


and plotters, and other models provide a more intuitive color-
parameter interface for the user.
COLOR MODEL
A color model is a method for explaining the properties or
behavior of color within some particular context.

No single color model can explain all aspects of color, so we


make use of different models to help describe the different
perceived characteristics of color.

 RGB COLOR MODEL


 YIQ COLOR MODEL
 CMY COLOR MODEL
 HSV COLOR MODEL
ANIMATION
Some typical applications of computer-generated animation
are entertainment (motion pictures and cartoons), advertising,
scientific and engineering studies, and training and education.

 Although we tend to think of animation as implying object


motions, the term computer animation generally refers to any
time sequence of visual changes in a scene.

In addition to changing object position with translations or


rotations, a computer-generated animation could display time
variations in object size, color, transparency, or surface
texture.
ANIMATION
Advertising animations often transition one object shape
into another: for example, transforming a can of motor oil into
an automobile engine.

Computer animations can also be generated by changing


camera parameters, such as position, orientation, and focal
length.

And we can produce computer animations by changing


lighting effects or other parameters and procedures associated
with illumination and rendering.
VIEWING
3. CLIPPING OPERATION
3.2 LINE CLIPPING (COHEN-SUTHERLAND ALGO)

1.

2. Apply Cohen Sutherland algorithm on following:


THANK YOU

You might also like