0% found this document useful (0 votes)
52 views7 pages

Computer Graphics: Submitted To: Submitted By: Hardarshan Kaur Chandeep Arora RB1801B34 10804278

Computer graphics involves mapping images from a world coordinate system to an output display device using a series of transformations. This involves first projecting a 3D image down to 2D, then mapping the 2D image to the physical device. Common transformations include translation, rotation, scaling, and projection, which are performed by multiplying vertices and vectors by transformation matrices. Maintaining relative proportions requires the same scaling factors in the x and y directions when mapping from a window to a viewport.

Uploaded by

chandeeparora12
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views7 pages

Computer Graphics: Submitted To: Submitted By: Hardarshan Kaur Chandeep Arora RB1801B34 10804278

Computer graphics involves mapping images from a world coordinate system to an output display device using a series of transformations. This involves first projecting a 3D image down to 2D, then mapping the 2D image to the physical device. Common transformations include translation, rotation, scaling, and projection, which are performed by multiplying vertices and vectors by transformation matrices. Maintaining relative proportions requires the same scaling factors in the x and y directions when mapping from a window to a viewport.

Uploaded by

chandeeparora12
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

COMPUTER GRAPHICS

Submitted to: Submitted


By:

Hardarshan Kaur Chandeep Arora

RB1801B34

10804278
Ans 1:

Generally, any procedure that identifies those portions of a picture that are either
inside or outside of a specified region of space is referred to as a clipping algorithm
or simply clipping. The region against which an object is to clipped is called a clip
window.

Various types of clipping are:

1. Point clipping

2. Text clipping

3. Line clipping

4. Polygon clipping

Ans 2:

Cohen–Sutherland algorithm is a line clipping algorithm. The algorithm divides a 2D


space into 9 regions, of which only the middle part (viewport) is visible.

The algorithm includes, excludes or partially includes the line based on where:

Both endpoints are in the viewport region (bitwise OR of endpoints == 0): trivial
accept.

Both endpoints are on the same non-visible region (bitwise AND of endpoints != 0):
trivial reject.

Both endpoints are in different regions: In case of this non trivial situation the
algorithm finds one of the two points that are outside the viewport region (there will
be at least one point outside). The intersection of the outpoint and extended
viewport border is then calculated (i.e. with the parametric equation for the line)
and this new point replaces the outpoint. The algorithm repeats until a trivial accept
or reject occurs.

The numbers in the figure below are called outcodes. An outcode is computed for
each of the two points in the line. The first bit is set to 1 if the point is above the
viewport. The bits in the outcode represent: Top, Bottom, Right, Left. For example
the outcode 1010 represents a point that is top-right of the viewport. Note that the
outcodes for endpoints must be recalculated on each iteration after the clipping
occurs.

1001 1000 1010

0001 0000 0010

0101 0100 0110


Ans 3:

The Weiler–Atherton clipping algorithm is used in computer graphics. It allows


clipping of a subject polygon by an arbitrarily shaped clip polygon. It is generally
applicable only in 2D. However, it can be used in 3D through visible surface
determination and with improved efficiency through Z-ordering. The Sutherland–
Hodgman algorithm is used for clipping polygons. It works by extending each line of
the convex clip polygon in turn and selecting only vertices from the subject polygon
that are on the visible side.

In Sutherland-hodgman algorithm if the subject polygon is concave at vertices


outside the clipping polygon, the new polygon might have coincident (i.e.
overlapping) edges – this is acceptable for rendering, but not for other applications
such as computing shadows. The Weiler–Atherton algorithm overcomes this by
returning a set of divided polygons, but is more complex and computationally more
expensive, so Sutherland–Hodgman is used for many rendering applications.
Sutherland–Hodgman can also be extended into 3D space by clipping the polygon
paths based on the boundaries of planes defined by the viewing space.

Ans 4:

When we define an image in some world coordinate system, to display that image
we must somehow map the image to the physical output device. This is a two stage
process. For 3 dimensional images we must first project down to 2 dimensions,
since our display device is 2 dimensional. Next, we must map the 2 D
representation to the physical device.

In 3D graphics, transformation is often used to operate on vertices and vectors. It is


also used to convert them in one space to another. Transformation is performed via
multiplication with a matrix. There are typically three types of primitive
transformation that can be performed on vertices: translation (where it lies in space
relative to the origin), rotation (its direction in relation to the x, y, z frame), and
scaling (its distance from origin). In addition to those, projection transformation is
used to go from view space to projection space. The D3DX library contains APIs that
can conveniently construct a matrix for many purposes such as translation, rotation,
scaling, world-to-view transformation, view-to-projection transformation, etc. An
application can then use these matrices to transform vertices in its scene.

Ans 5: General fixed point rotation:

 Translate the object so that pivot-position is moved to the coordinate origin

 Rotate the object about the coordinate origin

 Translate the object so that the pivot point is returned to its original position
General Fixed Point scaling:

 Translate object so that the fixed point coincides with the coordinate origin

 Scale the object with respect to the coordinate origin

 Use the inverse translation of step 1 to return the object to its original
position
Ans 6:

A point at position(my,w) in the window 1s mapped into position (xv, yv) in the associated
viewport.

To maintain the same relative placement in the viewport as in the window we require that,
Solving these expressions for the viewport position (XU, yv), we have

Equations 6-3 can also be derived with a set of trnnsformtions that converts the window area into
the viewport area. This conversion is performed with the following sequence of transformations:
1. Perform a scaling transformation using a fixed-point position of (xw,yw,,,) that scales the
window area to the size of the viewpdrt.
2. Translate the scaled window area to the position of the viewport.
Relative proportions of objects are maintained if the scaling factors are the same (sx = sy).
Otherwise, world objects will be stretched or contracted in either the x or y direction when
displayed on the output device. Character strings can be handled in two ways when they are
mapped to a viewport. The simplest mapping maintains a constant character size, even though
the viewport area may be enlarged or reduced relative to the window is method would be
employed when text is formed with standard character fonts that cannot be changed. In systems
that allow for changes in character size, string definitions can be windowed the same as other
primitives. For characters formed with line segments, the mapping to the viewport can be carried
out as a sequence of line transformations. From normalized coordinates, object descriptions are
mapped to the various display devices. Any number of output devices can be open in a part'cular
application, and another window-to-viewport transformation can be performed for each open
output device. This mapping, called the workstation transforma- tion, IS accomplished by
selecting a window area in normalized space and a viewport area in the coordinates of the
display device. With the workstation transformation, we gain some additional control over the
positioning of parts of a scene on individual output devices. As illustrated, we can use
workstation transformations to partition a view so that different parts of normalized space can bc
displaycd on diffcrcnt output dcvices.

You might also like