Lovely Professional University Home Work: #2 Course No: CSE405 Course Title: Computer Graphics School: LST Submitted To:ms. Taranpreet Kaur
Lovely Professional University Home Work: #2 Course No: CSE405 Course Title: Computer Graphics School: LST Submitted To:ms. Taranpreet Kaur
Lovely Professional University Home Work: #2 Course No: CSE405 Course Title: Computer Graphics School: LST Submitted To:ms. Taranpreet Kaur
HOME WORK: #2
Regno: 10803435
1.
what do you understand by composite transformation .perform a general fixed point scaling with an
example.
Ans: A composite transformation matrix is a product of two individual transformation matrices.
This method of multiplying two matrix is also called concatenation.Through this method we can set
up a matrix for any sequence of transformations .This is basically done by finding out the product of
individual transformations.
where
1. Translate object so that the fixed point coincides with the coordinate origin
Concatenating the matrices for these three operations produces the required scaling matrix.
2.
Prove that if two successive translation vectors T1(4, -2) and T2(-3, 5) are applied to an object then the
output will equivalent to the single additive translation by T3(1, 3).
Ans :
Let p be the required point after successive translation is carried out on T1(4, -2) and T2(-3, 5) :
composite transformation matrix for the given sequence T1(4, -2) and T2(-3, 5) is give by product of
the two individual transformations
hence, we have
T1(4, -2) .T2(-3, 5)=T(4-3,-2+5)
3.Derive the transformation that rotates an object point Q(x,y), degree about a fixed center of rotation
P(h,k).
Ans
We know ,
We replace and
R=
:
4. Scale a triangle bounded by A(30, 10), B(20, 30) and C(10, 20) to double its height and half its
width.
Ans:
We have,
Since the triangle is scaled to double its height and half its width ,we have scaling factor in the x
direction to be ½ and in the y direction it is 2 .
We know :
X’=X*Sx
Y’=Y*Sy
Point A(10,10):
(X,Y) = (10,10)
X’=10*(1/2)
X’=5
Y’= 10*2 = 20
Point B(20,10):
X’=20*(1/2) = 10
Y’=10*2 = 20
Point C(10,20):
X’=10*(1/2) =5
Y’=20*2 = 40
5.
Ans >>
The boundary fill algorithm fills a region with the given fill color until the given boundary
color is found. We can have either 8 point or 4-point technique to color a region. The
procedure uses a recurssive function. The function return when the pixel to be colored is the
boundary color or is already the fill color.
The boundary-fill method requires the coordinates of a starting point, a fill color, and a
boundary color as arguments.
The pseudo code for Boundary fill algorithm can be written as:
6. Generate the homogeneous matrix for the composite transformation by applying the translation
(tx,ty), followed by uniform scaling (s), and then followed by rotation (θ), on the object (x,y) in a 2D
homogeneous coordinate system. Further, apply the transformation taking x=5, y=3, tx=7, ty=3, s=2,
and θ=-30.
Ans:
Here ,we are required to first apply translation and then scaling and then we need to rotate by
angle θ .hence the reqd matrix will be a composite matrix .
The reqd homogeneous matrix for the composite transformation will be the product of four
matrices and is given by
Here , we have :
X’ cos -sin 0 s 0 0 1 0 tx X
Y’ = sin cos 0 0 s 0 0 1 ty Y
1 0 0 1 0 0 1 0 0 1 1
0 0 1 0 0 1 1
s.cos -s.sin s.tx.cos -s.ty.sin X
0 0 1 1
1 1
1 1