3.a) What is the need for a Homogeneous Coordinate System? Explain Translation, Rotation, and Scaling in a 2D Homogeneous Coordinate System with matrix representations.
Answer:
Need Of Homogeneous Coordinates
Homogeneous Coordinates are ubiquitous in computer graphics because They allow common vector operations such as translation, rotation, scaling, and perspective projection to be represented as a matrix by the vector is multiplied.
Multiplicative and translational terms for a two-dimensional geometric transformation can be combined into a single matrix, if representations are expanded to 3 × 3 matrices. The third column of a transformation matrix can be used for the translation terms, and all transformation equations can be expressed as matrix multiplications.
2D Translation: –
Translation on single coordinate point is performed by adding offsets to its coordinates to generate a new coordinate position. The original point position is moved along a straight-line path to its new location.
To translate a two-dimensional position, we add translation distances tx and ty to the original coordinates (x,y) to obtain the new coordinate position (x¢,y¢)
x’=x+tx , y’=y+ty —- (1)
The translation distance pair (tx, ty) is called a translation vector or shift vector.
We can express Equations (1) as a single matrix equation by using the following column vectors to represent coordinate positions and the translation vector:
The two-dimensional translation equations can be written in matrix forms as:
The homogeneous-coordinate for translation is given by
This translation operation can be written in the abbreviated form
2D Rotation: –
Rotation transformation of an object is generated by specifying a rotation axis and a rotation angle. All points of the object are then transformed to new positions by rotating the points through the specified angle about the rotation axis.
A two-dimensional rotation of an object is obtained by repositioning the object along a circular path in the xy plane. Parameters for the two-dimensional rotation are the rotation angle θ and a position(xr,yr), called the rotation point (or pivot point), about which the object is to be rotated.
A positive value for the angle θ defines a counterclockwise rotation about the pivot point. A negative value for the angle θ rotates objects in the clockwise direction.
Figure: Rotation of an object through angle θ about the pivot point (xr,yr )
1) Determination of the transformation equations for rotation of a point position P when the pivot point is at the coordinate origin.
The angular and coordinate relationships of the original and transformed point positions are shown in Figure.
r is the constant distance of the point from the origin, angle f is the original angular position of the point from the horizontal, and θ is the rotation angle.
Using standard trigonometric identities, transformed coordinates can be expressed in terms of angles of q and f
x¢=rcos(f+θ) =rcosfcosθ-rsinfsinθ —– (1)
y¢=rsin(f+θ) =rcosfsinθ+rsinfcosθ
The original coordinates of the point in the polar coordinates are x=rcosf y=rsinf —— (2)
Substituting expressions (1) and (2) we obtain the transformation equations for rotating a point at position (x, y) through an angle θ about the origin.
x’=xcosq-ysinq
y’=xsinq+ycosq
The rotation equation in matrix form is written as P’=RP, where the rotation matrix is
2) Determination of the transformation equations for rotation of a point position P when the pivot point is at (xr,yr).
Rotation of a point about an arbitrary pivot position is illustrated in Figure.
Using the trigonometric relationships indicated by the two right triangles in this figure, we can generalize Equations 6 to obtain the transformation equations for rotation of a point about any specified rotation position (xr,yr ):
x¢= xr +(x- xr)cosq – (y- yr)sinq
y¢= yr +(x- xr) sinq + (y- yr)cosq
Two-dimensional rotation transformation equations about the coordinate origin can be expressed in the matrix form as
2D Scaling: –
To alter the size of an object, scaling transformation is used. A two dimensional scaling operation is performed by multiplying object positions (x,y) by scaling factors Sx and Sy to produce the transformed coordinates(x’,y’).
x’=x.Sx, y’=y.Sy
Scaling factor Sx scales an object in the x direction, while scales Sy in the y direction. The basic two-dimensional scaling equations 10 can also be written in the following matrix form:
or
P’=S.P
where S is the 2 × 2 scaling matrix.
A scaling transformation relative to the coordinate origin can be expressed as the matrix multiplication.