Computer Graphics: Submitted To: Submitted By: Hardarshan Kaur Chandeep Arora RB1801B34 10804278
Computer Graphics: Submitted To: Submitted By: Hardarshan Kaur Chandeep Arora RB1801B34 10804278
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.
1. Point clipping
2. Text clipping
3. Line clipping
4. Polygon clipping
Ans 2:
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.
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.
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
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.