1. Gyanastra
  2. Computer Graphics
  3. 2D Transformations and Viewing
  4. Composite Transformations and Coordinate Systems
Free lesson, no account needed 9 min read 23 practice questions after it
Asked in past papers6 times
  • UGC NET201820172016201520142013

Computer Graphics · 2D Transformations and Viewing

Composite Transformations and Coordinate Systems

Overview

A composite transformation combines several elementary 2D transformations into one matrix, so an object can be translated, rotated, scaled, reflected or sheared in a chosen order.
The same ideas explain coordinate systems: model/object, world, viewing, normalized device and physical device coordinates.
UGC NET tests this area through arbitrary-pivot rotations, matrix order, homogeneous coordinates, window-to-viewport mapping, and identification of a matrix from before/after figures.
Before reading, know basic matrix multiplication, the trigonometric values at 0∘,90∘,180∘0^\circ,90^\circ,180^\circ, and the representation of a point as (x,y)(x,y).
Unless stated otherwise, the notes use column vectors and counterclockwise positive angles in the standard right-handed xyxy-plane with xx right and yy up.

Key concepts

  • A transformation matrix maps a point to a new point. In homogeneous column-vector form, a 2D point is [x  y  1]T[x\;y\;1]^T and every affine transformation is a 3×33\times3 matrix.
  • Composite transformation: if transformation AA is applied first and BB second, then p′=B(Ap)=(BA)pp'=B(Ap)=(BA)p. Thus the composite matrix is BABA; the rightmost matrix acts first.
  • Composite transformations are generally non-commutative: translation then rotation is not the same as rotation then translation.
  • Homogeneous coordinates allow translation to be represented as matrix multiplication: (x,y)↔[x  y  1]T(x,y)\leftrightarrow[x\;y\;1]^T. A general 2D homogeneous point is (x,y,w)(x,y,w); finite Cartesian point is (x/w,y/w)(x/w,y/w), and w=0w=0 represents a point at infinity or direction.
  • An affine transformation has matrix
    [abcdef001]\begin{bmatrix}a&b&c\\ d&e&f\\ 0&0&1\end{bmatrix}.
    Its last row is [0  0  1][0\;0\;1]. Translation, rotation, scaling, reflection and shear are affine.
  • A homography or projective transformation is a general homogeneous matrix with a bottom row not necessarily [0  0  1][0\;0\;1].
    It maps lines to lines but need not preserve parallelism. “Steganography” is data hiding, not a graphics transformation.
  • Rotation about an arbitrary pivot (a,b)(a,b) is done by: translate pivot to origin, rotate about origin, translate pivot back. In column-vector form:
    T(a,b) Rθ T(−a,−b)T(a,b)\,R_\theta\,T(-a,-b).
  • Scaling about a fixed point (a,b)(a,b) is similarly:
    T(a,b) S(sx,sy) T(−a,−b)T(a,b)\,S(s_x,s_y)\,T(-a,-b).
  • Model/object/local coordinates describe one object. A modeling transformation places it in world coordinates, the common scene coordinate system.
  • A viewing transformation maps world coordinates to viewing or normalized coordinates; in UGC/NET convention it maps world coordinates to Normalized Device Coordinates (NDC), not directly to physical screen pixels.
  • A window is the rectangular region selected in world coordinates. A viewport is the rectangular display area, usually in NDC or device coordinates, where the window is mapped.
  • Normalization transformation is the window-to-viewport mapping. A workstation transformation or device transformation maps NDC to actual physical device/screen pixels.
  • Aspect ratio is width divided by height. If window and viewport aspect ratios are equal, the mapping is uniform; otherwise the image is stretched.
  • A reflection matrix has determinant −1-1, so it is not a rotation matrix. A rotation matrix has determinant +1+1.

How it works

  1. Convert every point to homogeneous column form: (x,y)→[x  y  1]T(x,y)\to[x\;y\;1]^T.
  2. Write each elementary transformation as a 3×33\times3 matrix.
  3. Decide the order of transformations. For column vectors, if M1M_1 acts first, then M2M_2, then M3M_3, the composite is
    M=M3M2M1M=M_3M_2M_1.
  4. Apply the composite to a point: p′=Mpp'=Mp.
  5. For rotation about pivot (a,b)(a,b): translate by (−a,−b)(-a,-b), rotate by θ\theta, translate by (a,b)(a,b).
    So M=T(a,b)RθT(−a,−b)M=T(a,b)R_\theta T(-a,-b).
  6. For scaling about fixed point (a,b)(a,b): translate by (−a,−b)(-a,-b), scale by (sx,sy)(s_x,s_y), translate by (a,b)(a,b).
    So M=T(a,b)S(sx,sy)T(−a,−b)M=T(a,b)S(s_x,s_y)T(-a,-b).
  7. For window-to-viewport mapping: scale the window size to the viewport size, then translate the window lower-left corner to the viewport lower-left corner.
    M=T(vxmin,vymin) S(vxmax−vxminwxmax−wxmin,vymax−vyminwymax−wymin) T(−wxmin,−wymin)M=T(v_{xmin},v_{ymin})\,S\left(\frac{v_{xmax}-v_{xmin}}{w_{xmax}-w_{xmin}},\frac{v_{ymax}-v_{ymin}}{w_{ymax}-w_{ymin}}\right)\,T(-w_{xmin},-w_{ymin}).
  8. Coordinate pipeline: model coordinates are transformed to world coordinates; the world window is mapped to a viewport in NDC; NDC is mapped to physical device coordinates.

For matrix order, remember:

Figure. Model coordinates are transformed to world coordinates, then viewing coordinates, then normalized device coordinates, and finally device coordinates. Notice the left-to-right sequence of the coordinate pipeline.
Figure. For matrix order, the rightmost matrix acts first on point p, then the next matrix, leading to the final point. Notice the left-to-right flow in the diagram despite rightmost acting first.

Formulas

  • Let θ\theta be counterclockwise rotation, (tx,ty)(t_x,t_y) translation, (sx,sy)(s_x,s_y) scale factors, and (a,b)(a,b) the fixed pivot.

  • Homogeneous point:
    (x,y)↔[x  y  1]T.(x,y)\leftrightarrow [x\;y\;1]^T.

  • Translation:
    T(tx,ty)=[10tx01ty001].T(t_x,t_y)= \begin{bmatrix} 1&0&t_x\\ 0&1&t_y\\ 0&0&1 \end{bmatrix}.

  • Rotation about origin:
    Rθ=[cos⁡θ−sin⁡θ0sin⁡θcos⁡θ0001].R_\theta= \begin{bmatrix} \cos\theta&-\sin\theta&0\\ \sin\theta&\cos\theta&0\\ 0&0&1 \end{bmatrix}.

  • Scaling about origin:
    S(sx,sy)=[sx000sy0001].S(s_x,s_y)= \begin{bmatrix} s_x&0&0\\ 0&s_y&0\\ 0&0&1 \end{bmatrix}.

  • Composite rule for column vectors: if M1M_1 is first and MkM_k is last,
    p′=Mk⋯M2M1p.p'=M_k\cdots M_2M_1p.

  • Inverse: if M=Mk⋯M1M=M_k\cdots M_1, then
    M−1=M1−1⋯Mk−1.M^{-1}=M_1^{-1}\cdots M_k^{-1}.

  • Rotation about pivot (a,b)(a,b):
    Rθ,(a,b)=T(a,b)RθT(−a,−b)=[cos⁡θ−sin⁡θa(1−cos⁡θ)+bsin⁡θsin⁡θcos⁡θb(1−cos⁡θ)−asin⁡θ001].R_{\theta,(a,b)}=T(a,b)R_\theta T(-a,-b) = \begin{bmatrix} \cos\theta&-\sin\theta&a(1-\cos\theta)+b\sin\theta\\ \sin\theta&\cos\theta&b(1-\cos\theta)-a\sin\theta\\ 0&0&1 \end{bmatrix}.

  • Scaling about fixed point (a,b)(a,b):
    S(a,b)(sx,sy)=T(a,b)S(sx,sy)T(−a,−b)=[sx0a(1−sx)0syb(1−sy)001].S_{(a,b)}(s_x,s_y)=T(a,b)S(s_x,s_y)T(-a,-b) = \begin{bmatrix} s_x&0&a(1-s_x)\\ 0&s_y&b(1-s_y)\\ 0&0&1 \end{bmatrix}.

  • Reflection matrices:

  • About xx-axis: [1000−10001]\begin{bmatrix}1&0&0\\0&-1&0\\0&0&1\end{bmatrix}.

  • About yy-axis: [−100010001]\begin{bmatrix}-1&0&0\\0&1&0\\0&0&1\end{bmatrix}.

  • About origin: [−1000−10001]\begin{bmatrix}-1&0&0\\0&-1&0\\0&0&1\end{bmatrix}.

  • About line y=xy=x: [010100001]\begin{bmatrix}0&1&0\\1&0&0\\0&0&1\end{bmatrix}.

  • Shear:

  • xx-shear by ShxSh_x: x′=x+Shx y,  y′=yx'=x+Sh_x\,y,\;y'=y.

  • yy-shear by ShySh_y: x′=x,  y′=Shy x+yx'=x,\;y'=Sh_y\,x+y.

  • yy-shear relative to line x=xrefx=x_{ref}:
    x′=x,y′=Shy(x−xref)+y.x'=x,\qquad y'=Sh_y(x-x_{ref})+y.

  • Window-to-viewport mapping:
    sx=vxmax−vxminwxmax−wxmin,tx=vxmin−sxwxmin,s_x=\frac{v_{xmax}-v_{xmin}}{w_{xmax}-w_{xmin}},\qquad t_x=v_{xmin}-s_x w_{xmin}, sy=vymax−vyminwymax−wymin,ty=vymin−sywymin.s_y=\frac{v_{ymax}-v_{ymin}}{w_{ymax}-w_{ymin}},\qquad t_y=v_{ymin}-s_y w_{ymin}. MWV=[sx0tx0syty001].M_{WV}= \begin{bmatrix} s_x&0&t_x\\ 0&s_y&t_y\\ 0&0&1 \end{bmatrix}.

  • Homography in 2D:
    [x′  y′  w′]T=H[x  y  1]T,(x,y)↦(x′/w′,y′/w′).[x'\;y'\;w']^T=H[x\;y\;1]^T,\qquad (x,y)\mapsto(x'/w',y'/w').

  • If w′=0w'=0, the point is at infinity.

  • Aspect ratio:
    aspect ratio=widthheight.\text{aspect ratio}=\frac{\text{width}}{\text{height}}.

Worked examples

Example 1: rotation about an arbitrary point. Rotate P(4,2)P(4,2) by 90∘90^\circ counterclockwise about (1,1)(1,1).

Translate pivot to origin:
(4,2)−(1,1)=(3,1).(4,2)-(1,1)=(3,1). Rotate 90∘90^\circ: (x,y)→(−y,x)(x,y)\to(-y,x), so (3,1)→(−1,3)(3,1)\to(-1,3).
Translate back: (−1,3)+(1,1)=(0,4)(-1,3)+(1,1)=(0,4).
Matrix check: M=[0−12100001],M[4  2  1]T=[0  4  1]T.M= \begin{bmatrix} 0&-1&2\\ 1&0&0\\ 0&0&1 \end{bmatrix},\quad M[4\;2\;1]^T=[0\;4\;1]^T. Answer: (0,4)(0,4).

Example 2: composite order. A point (2,3)(2,3) is scaled by (2,2)(2,2) about the origin, then translated by (1,−1)(1,-1).

Scale first: (2,3)→(4,6)(2,3)\to(4,6).
Translate second: (4,6)+(1,−1)=(5,5)(4,6)+(1,-1)=(5,5).
Composite matrix: M=T(1,−1)S(2,2)=[20102−1001],M[2  3  1]T=[5  5  1]T.M=T(1,-1)S(2,2)= \begin{bmatrix} 2&0&1\\ 0&2&-1\\ 0&0&1 \end{bmatrix}, \quad M[2\;3\;1]^T=[5\;5\;1]^T. Answer: (5,5)(5,5). If the order were reversed, the result would be (6,4)(6,4), so order matters.

Example 3: find the affine matrix from point correspondences. A transformation maps (0,0)→(1,1)(0,0)\to(1,1), (1,0)→(3,1)(1,0)\to(3,1), (0,1)→(1,4)(0,1)\to(1,4). Find its homogeneous matrix.

Let M=[abcdef001].M=\begin{bmatrix}a&b&c\\d&e&f\\0&0&1\end{bmatrix}. From (0,0)→(1,1)(0,0)\to(1,1): c=1,  f=1c=1,\;f=1.
From (1,0)→(3,1)(1,0)\to(3,1): a+c=3⇒a=2a+c=3\Rightarrow a=2, and d+f=1⇒d=0d+f=1\Rightarrow d=0.
From (0,1)→(1,4)(0,1)\to(1,4): b+c=1⇒b=0b+c=1\Rightarrow b=0, and e+f=4⇒e=3e+f=4\Rightarrow e=3.
Thus M=[201031001].M=\begin{bmatrix}2&0&1\\0&3&1\\0&0&1\end{bmatrix}. Answer: the matrix is [201031001]\begin{bmatrix}2&0&1\\0&3&1\\0&0&1\end{bmatrix}.

Example 4: window-to-viewport mapping. Map window lower-left (1,1)(1,1), upper-right (5,3)(5,3) onto viewport lower-left (0,0)(0,0), upper-right (2,1)(2,1). Find the matrix and map point (3,2)(3,2).

sx=2−05−1=12,tx=0−12(1)=−12,s_x=\frac{2-0}{5-1}=\frac12,\quad t_x=0-\frac12(1)=-\frac12, sy=1−03−1=12,ty=0−12(1)=−12.s_y=\frac{1-0}{3-1}=\frac12,\quad t_y=0-\frac12(1)=-\frac12. M=[120−12012−12001].M= \begin{bmatrix} \frac12&0&-\frac12\\ 0&\frac12&-\frac12\\ 0&0&1 \end{bmatrix}. For (3,2)(3,2): x′=12(3)−12=1,y′=12(2)−12=12.x'=\frac12(3)-\frac12=1,\qquad y'=\frac12(2)-\frac12=\frac12. Answer: (1,12)(1,\frac12).

Example 5: statement type. Statement I: In column-vector notation, the rightmost matrix in a product acts first. Statement II: Reflection about the xx-axis is a rotation matrix because its determinant is −1-1.
Statement I is true: BApBAp applies AA first. Statement II is false: a rotation matrix has determinant +1+1; reflection has determinant −1-1.
Answer: only Statement I is true.

Comparison

TransformationCoordinate ruleDeterminantExam note
Translationx′=x+tx,  y′=y+tyx'=x+t_x,\;y'=y+t_y11Needs 3×33\times3 homogeneous matrix; translation is in third column
Rotation about originx′=xcos⁡θ−ysin⁡θ,  y′=xsin⁡θ+ycos⁡θx'=x\cos\theta-y\sin\theta,\;y'=x\sin\theta+y\cos\theta11Positive angle is CCW; preserves shape and size
Scaling about originx′=sxx,  y′=syyx'=s_xx,\;y'=s_yysxsys_xs_yNegative factor also reflects
Reflection about xx-axisx′=x,  y′=−yx'=x,\;y'=-y−1-1Not a rotation
xx-shearx′=x+Shxy,  y′=yx'=x+Sh_x y,\;y'=y11Shifts parallel to xx proportional to yy
yy-shearx′=x,  y′=Shyx+yx'=x,\;y'=Sh_y x+y11Shifts parallel to yy proportional to xx
Coordinate systemPurposeMain transform to next stage
Model/object/localDefines one objectModeling transformation to world
WorldCommon scene coordinatesViewing transformation to viewing/NDC
Viewing/camera/eyeCoordinates relative to cameraProjection/normalization to NDC
Normalized device coordinates, NDCDevice-independent display coordinatesWorkstation/device transformation to physical device
Physical deviceActual screen or workstation pixelsFinal display
Look-alike pairDifference
Window vs viewportWindow is in world coordinates; viewport is the display area where the window is mapped
Viewing transformation vs workstation transformationViewing maps world to viewing/NDC; workstation maps NDC to physical device
Object transformation vs coordinate transformationObject transformation moves the object; coordinate transformation changes the reference frame and is usually the inverse
Affine vs homographyAffine has bottom row [0  0  1][0\;0\;1]; homography has a general bottom row and may send parallel lines to intersecting lines
Rotation vs reflectionRotation determinant +1+1; reflection determinant −1-1

Revision summary

  • Column-vector rule: p′=Mpp'=Mp; the rightmost matrix acts first.
  • If AA then BB, composite is BABA, not ABAB.
  • Translate pivot to origin, apply transformation, translate back.
  • Translation cannot be represented by a 2×22\times2 matrix; use homogeneous 3×33\times3.
  • Rotation about pivot: T(a,b)RθT(−a,−b)T(a,b)R_\theta T(-a,-b).
  • Scaling about fixed point: T(a,b)S(sx,sy)T(−a,−b)T(a,b)S(s_x,s_y)T(-a,-b).
  • Homogeneous point (x,y,w)(x,y,w) gives Cartesian (x/w,y/w)(x/w,y/w); w=0w=0 is a point at infinity.
  • General homogeneous matrix is a homography; bottom row [0  0  1][0\;0\;1] means affine.
  • Window is in world coordinates; viewport is in NDC/device coordinates.
  • Window-to-viewport: scale by viewport size divided by window size, then translate.
  • Aspect ratio is width/height; equal aspect ratios avoid distortion.
  • Reflection has determinant −1-1; rotation has determinant +1+1.

Previous-year exam insights

  • Arbitrary-pivot rotation is asked directly: identify the sequence translate to origin, rotate, translate back, and apply it numerically.
  • Matrix matching questions give 3×33\times3 matrices and transformation diagrams; check the third column for translation and the diagonal/off-diagonal entries for scale, rotation, reflection or shear.
  • Numeric composite questions test order: with column vectors the rightmost matrix acts first; reversing order changes the answer.
  • Affine-matrix construction questions give before/after vertices; solve c,fc,f from the origin image, then a,da,d from the xx-unit image and b,eb,e from the yy-unit image.
  • Window-to-viewport questions ask for the normalization matrix or the mapped point; compute sx,sys_x,s_y first, then tx,tyt_x,t_y.
  • Coordinate-system questions test definitions: viewing transformation maps to NDC, not directly to physical device; workstation/device transformation maps NDC to screen pixels.
  • Homogeneous-coordinate traps: w=0w=0 is not a finite point; a general projective matrix is a homography, while affine is a special case.
  • Statement/assertion traps: composite translations remain translations; composite rotations about the same origin remain rotations; reflection is not rotation; inverse reverses order.

Practice at PARIKSHA

You are ready for the PARIKSHA tests of this sub-topic when you can:

  • write the 3×33\times3 homogeneous matrices for translation, rotation, scaling, reflection and shear;
  • derive and apply the composite matrix for rotation about an arbitrary pivot;
  • derive and apply the composite matrix for scaling about a fixed point;
  • decide the order of transformations from a matrix product and from a word problem;
  • construct an affine matrix from three point correspondences;
  • compute a window-to-viewport matrix and map a given point correctly;
  • explain model, world, viewing, NDC and physical device coordinates in order;
  • distinguish affine from homography and identify points at infinity using w=0w=0;
  • state the inverse of a composite transformation with the order reversed;
  • identify a transformation matrix from a before/after figure or a diagram.

Attempt the PARIKSHA sub-topic test first; then attempt the subject test.

Pages 1–2 of 2