Computer Graphics Unit 4

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

BCA414: COMPUTER GRAPHICS 1

UNIT IV

TOPICS COVERED:

Geometric Transformations: Matrices. Translation, Scaling,


Rotation Transformations. Homogeneous Co-ordinates. Composite
Transformation. Rotation and scaling about an arbitrary point.
Other transformations: reflection and shearing. Inverse
Transformations.

Geometric Transformations

Geometric transformations refer to operations that modify the position, size, orientation, or shape of
geometric objects, such as points, lines, curves, or polygons. These transformations preserve certain
properties of the original objects, allowing us to apply familiar reasoning and analysis techniques to
transformed counterparts. We will consider 5 main types of geometric transformations: translations,
rotations, scaling, shearing, and reflections.

1. Translation: A translation moves each point of an object by a fixed distance in a specified direction
parallel to some axis, preserving relative positions between points and overall shape. Mathematically,
it can be represented as a vector addition operation applied to each coordinate component.

2. Rotation: A rotation pivots an object around a given center point through a specific angle measured
in radians or degrees, maintaining distances between points and changing orientations accordingly.
Two primary axes – x-axis and y-axis – are commonly considered, giving rise to rotations about those
respective axes.

3. Scaling: Scaling alters the size of an object by expanding or contracting it along one or more axes
proportionately, keeping shapes intact and preserving parallelism among corresponding lines.
Uniform scaling scales equally along all directions, while non-uniform scaling varies stretching rates
according to chosen axes.

4. Shearing: Also known as skewing, shearing slants an object along one or more axes, distorting
shapes while retaining collinearity between initial and final configurations. Horizontal and vertical
shears are frequently studied, producing rectangular hyperbolas under certain conditions.

TS
BCA414: COMPUTER GRAPHICS 2
UNIT IV

5. Reflection: A reflection flips an object about a designated mirror line or plane, preserving distances
between symmetric points and altering orientations accordingly. Common examples include
horizontal (left-right), vertical (top-bottom), and diagonal (corner-opposite corner) reflections, which
flip objects horizontally, vertically, or diagonally, respectively. Arbitrary oblique reflections also exist,
reflecting objects across user-specified planes.

Translation

A translation moves an object to a different position on the screen.


You can translate a point in 2D by adding translation coordinate (tx,
ty) to the original coordinate X,YX,Y to get the new coordinate
X′,Y′X′,Y′.

TS
BCA414: COMPUTER GRAPHICS 3
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 4
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 5
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 6
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 7
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 8
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 9
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 10
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 11
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 12
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 13
UNIT IV

The rotation of a point, straight line or an entire image on the screen, about a point
other than origin, is achieved by first moving the image until the point of rotation
occupies the origin, then performing rotation, then finally moving the image to its
original position.

The moving of an image from one place to another in a straight line is called a
translation. A translation may be done by adding or subtracting to each point, the
amount, by which picture is required to be shifted.

Translation of point by the change of coordinate cannot be combined with other


transformation by using simple matrix application. Such a combination is essential if
we wish to rotate an image about a point other than origin by translation, rotation
again translation.

To combine these three transformations into a single transformation, homogeneous


coordinates are used. In homogeneous coordinate system, two-dimensional coordinate
positions (x, y) are represented by triple-coordinates.

Homogeneous coordinates are generally used in design and construction applications.


Here we perform translations, rotations, scaling to fit the picture into proper position.

Example of representing coordinates into a homogeneous coordinate system: For


two-dimensional geometric transformation, we can choose homogeneous parameter h
to any non-zero value. For our convenience take it as one. Each two-dimensional
position is then represented with homogeneous coordinates (x, y, 1).

TS
BCA414: COMPUTER GRAPHICS 14
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 15
UNIT IV

Rotation and scaling about an arbitrary point

If we want to rotate an object or point about an arbitrary point, first of all, we translate
the point about which we want to rotate to the origin. Then rotate point or object
about the origin, and at the end, we again translate it to the original place. We get
rotation about an arbitrary point.

Example: The point (x, y) is to be rotated

The (xc yc) is a point about which counterclockwise rotation is done

Step1: Translate point (xc yc) to origin

Step2: Rotation of (x, y) about the origin

TS
BCA414: COMPUTER GRAPHICS 16
UNIT IV

Step3: Translation of center of rotation back to its original position

Example1: Prove that 2D rotations about the origin are commutative i.e. R1 R2=R2 R1.

TS
BCA414: COMPUTER GRAPHICS 17
UNIT IV

Example2: Rotate a line CD whose endpoints are (3, 4) and (12, 15) about origin
through a 45° anticlockwise direction.

TS
BCA414: COMPUTER GRAPHICS 18
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 19
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 20
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 21
UNIT IV

TS
BCA414: COMPUTER GRAPHICS 22
UNIT IV

Inverse Transformation

These are also called as opposite transformations. If T is a translation matrix than inverse
translation is representing using T-1. The inverse matrix is achieved using the opposite sign.

Example1: Translation and its inverse matrix

Questions

1.

2.

TS

You might also like