ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP3145Affine Transformations
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3145

    HCI & Computer Graphics

    Progress0 / 73 done
    Topics73
    1Input-output channels2Human memory3Thinking, Reasoning, Problem solving4Emotions and Individual differences5Psychology and design of interacting systems
    6Text entry devices7Positioning, Pointing, and drawing devices8Display devices9Devices for virtual reality and 3D interaction10Physical controls, Sensors and special devices11Paper printing and scanning12Memory, Processing and networks
    13Models of interaction14Frameworks and HCI15Ergonomics16Interaction styles17Elements of the WIMP interfaces18Interactivity and Context of interaction
    19Introduction20Paradigms for interaction
    21What is design22Process of design and User focus23Navigation design24Screen design and layout25Iteration and prototyping
    26Software life cycle27Usability engineering28Iterative design and prototyping29Design rationale30Design rules and Guidelines31Golden rules and heuristics32HCI patterns33Evaluation techniques and methods34Task analysis35Universal design36User support systems37Computer Supported Cooperative Work38Groupware systems39Implementation of synchronous groupware40Ubiquitous computing41History of Computer Graphics42Graphics architectures and software
    43Pinhole camera, Human vision, Synthetic camera44Modeling vs. rendering45OpenGL Architecture46Displaying simple two-dimensional geometric objects47Positioning systems and windowed environment48Color perception and models49RGB, CMY, HLS color models50Color transformations
    51RGB and indexed color
    52Network environment and client-server computing
    53event, sample and request input54Using callbacks and picking
    55translation, rotation, scaling, shear56Homogeneous coordinates and concatenation57Current transformation and matrix stacks
    58Classical viewing59Specifying views in 3D60Affine transformation in 3D61Projective transformations62Ray tracing
    63Illumination and surface modeling64Phong shading model65Polygon shading
    66Line drawing via Bresenham's algorithm67Clipping and polygonal fill68BitBlt operations69Hidden surface removal (z buffer)
    70Buffers71Reading and writing bitmaps and pixel maps72Texture mapping73Compositing
    8 min read
    Topic 55 of 73
    Topic Study Note Illustration
    55

    Affine transformations: translation, rotation, scaling, shear

    Definition: An affine transformation is a geometric transformation that preserves:

    1. Affine Transformations – Definition

    Definition: An affine transformation is a geometric transformation that preserves:

    • Points, straight lines, and planes
    • Parallelism of lines (parallel lines remain parallel)

    Affine transformations are widely used in 2D and 3D computer graphics for moving, rotating, resizing, or skewing objects.

    Mathematically, in 2D, an affine transformation can be represented as:

    [x′ y′]=[ab cd][x y]+[tx ty]\begin{bmatrix} x' \ y' \end{bmatrix} = \begin{bmatrix} a & b \ c & d \end{bmatrix} \begin{bmatrix} x \ y \end{bmatrix} + \begin{bmatrix} tx \ ty \end{bmatrix}[x′ y′​]=[a​b c​d​][x y​]+[tx ty​]

    Or in homogeneous coordinates (common in graphics):

    [x′ y′ 1]=[abtx cdty 001][x y 1]\begin{bmatrix} x' \ y' \ 1 \end{bmatrix} = \begin{bmatrix} a & b & tx \ c & d & ty \ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \ y \ 1 \end{bmatrix}[x′ y′ 1​]=[a​b​tx c​d​ty 0​0​1​][x y 1​]

    Where (tx,ty)(tx, ty)(tx,ty) are translation components, and the 2×2 matrix defines rotation, scaling, or shear.


    2. Types of Affine Transformations

    A. Translation

    Definition:

    • Moving an object from one position to another without changing its shape, size, or orientation.

    Formula in 2D:

    x′=x+tx,y′=y+tyx' = x + tx, \quad y' = y + tyx′=x+tx,y′=y+ty

    Matrix Form (homogeneous coordinates):

    T=[10tx 01ty 001]T = \begin{bmatrix} 1 & 0 & tx \ 0 & 1 & ty \ 0 & 0 & 1 \end{bmatrix}T=[1​0​tx 0​1​ty 0​0​1​]

    Example:

    • Moving a triangle 5 units right and 3 units up.

    B. Rotation

    Definition:

    • Rotating an object around the origin or a pivot point by an angle θ.

    Formula in 2D (around origin):

    x′=xcos⁡θ−ysin⁡θ,y′=xsin⁡θ+ycos⁡θx' = x \cos \theta - y \sin \theta, \quad y' = x \sin \theta + y \cos \thetax′=xcosθ−ysinθ,y′=xsinθ+ycosθ

    Matrix Form:

    R=[cos⁡θ−sin⁡θ0 sin⁡θcos⁡θ0 001]R = \begin{bmatrix} \cos\theta & -\sin\theta & 0 \ \sin\theta & \cos\theta & 0 \ 0 & 0 & 1 \end{bmatrix}R=[cosθ​−sinθ​0 sinθ​cosθ​0 0​0​1​]

    Note: To rotate around a point (px,py)(px, py)(px,py), first translate to origin, rotate, then translate back.


    C. Scaling

    Definition:

    • Changing the size of an object in the x and/or y direction.

    Formula in 2D:

    x′=sx⋅x,y′=sy⋅yx' = sx \cdot x, \quad y' = sy \cdot yx′=sx⋅x,y′=sy⋅y

    Matrix Form:

    S=[sx00 0sy0 001]S = \begin{bmatrix} sx & 0 & 0 \ 0 & sy & 0 \ 0 & 0 & 1 \end{bmatrix}S=[sx​0​0 0​sy​0 0​0​1​]

    Notes:

    • Uniform scaling: sx=sysx = sysx=sy → preserves shape
    • Non-uniform scaling: sx≠sysx \neq sysx=sy → may stretch/compress

    D. Shear

    Definition:

    • Shifting one coordinate proportionally to another, effectively slanting the shape.

    Formulas in 2D:

    • X-shear: x′=x+shx⋅y,y′=yx' = x + sh_x \cdot y, \quad y' = yx′=x+shx​⋅y,y′=y
    • Y-shear: x′=x,y′=y+shy⋅xx' = x, \quad y' = y + sh_y \cdot xx′=x,y′=y+shy​⋅x

    Matrix Forms:

    X-shear: Hx=[1shx0 010 001],Y-shear: Hy=[100 shy10 001]\text{X-shear: } H_x = \begin{bmatrix} 1 & sh_x & 0 \ 0 & 1 & 0 \ 0 & 0 & 1 \end{bmatrix}, \quad \text{Y-shear: } H_y = \begin{bmatrix} 1 & 0 & 0 \ sh_y & 1 & 0 \ 0 & 0 & 1 \end{bmatrix}X-shear: Hx​=[1​shx​​0 0​1​0 0​0​1​],Y-shear: Hy​=[1​0​0 shy​​1​0 0​0​1​]

    Example:

    • Slanting a rectangle so that its top edge moves more than the bottom edge.

    3. Key Properties of Affine Transformations

    • Straight lines remain straight
    • Parallel lines remain parallel
    • Ratios of distances along a line are preserved
    • Shapes may change size or orientation but basic collinearity is preserved

    4. Summary Table

    Transformation Effect Matrix Form (2D Homogeneous)
    Translation Move object [10tx 01ty 001]\begin{bmatrix}1 & 0 & tx \ 0 & 1 & ty \ 0 & 0 & 1\end{bmatrix}[1​0​tx 0​1​ty 0​0​1​]
    Rotation Rotate object [cos⁡θ−sin⁡θ0 sin⁡θcos⁡θ0 001]\begin{bmatrix}\cosθ & -\sinθ & 0 \ \sinθ & \cosθ & 0 \ 0 & 0 & 1\end{bmatrix}[cosθ​−sinθ​0 sinθ​cosθ​0 0​0​1​]
    Scaling Resize object [sx00 0sy0 001]\begin{bmatrix}sx & 0 & 0 \ 0 & sy & 0 \ 0 & 0 & 1\end{bmatrix}[sx​0​0 0​sy​0 0​0​1​]
    Shear Slant object X-shear: [1shx0 010 001]\begin{bmatrix}1 & sh_x & 0 \ 0 & 1 & 0 \ 0 & 0 & 1\end{bmatrix}[1​shx​​0 0​1​0 0​0​1​]Y-shear: [100 shy10 001]\begin{bmatrix}1 & 0 & 0 \ sh_y & 1 & 0 \ 0 & 0 & 1\end{bmatrix}[1​0​0 shy​​1​0 0​0​1​]
    ← Previous topic 54
    Using callbacks and picking
    Next topic 56 →
    Homogeneous coordinates and concatenation

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    8mremaining
    1.3kwords
    Intermediatelevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    HCI & Computer Graphics