computer-nec-license
  • NEC-Computer
  • 1. Concept of Basic Electrical and Electronics Engineering
    • 1.1 Basic Concepts
    • 1.2 Network Theorems
    • 1.3 Alternating Current Fundamentals
    • 1.4 Semiconductor Device
    • 1.5 Signal Generator
    • 1.6 Amplifiers
    • MCQs
      • MCQs On Basic Electrical
        • set-1
        • set-2
      • MCQs On Basic Electronics
        • set-1
        • set-2
  • 2. Digital Logic and Microprocessor
    • 2.1 Digital Logic
    • 2.2 Combinational & Arithmetic Circuit
    • 2.3 Sequential Logic Circuits
    • 2.4 Microprocessor
    • 2.5 Microprocessor System
    • 2.6 Interrupt Operations
    • MCQs
      • MCQs On Digital Logic
        • set-1
        • set-2
        • set-3
        • set-4
        • set-5
        • set-6
        • set-7
        • set-8
        • set-9
        • set-10
        • set-11
        • set-12
      • MCQs On Microprocessor
        • set-1
        • set-2
        • set-3
        • set-4
        • set-5
        • set-6
        • set-7
        • set-8
        • set-9
  • 3. Programming Language and Its Applications
    • 3.1 Introduction to C Programming
    • 3.2 Pointers, Structures, and Data Files
    • 3.3 C++ Language Constructs with Objects and Classes
    • 3.4 Features of Object-Oriented Programming
    • 3.5 Pure Virtual Functions and File Handling
    • 3.6 Generic Programming and Exception Handling
    • MCQs
      • set-1
      • set-2
      • set-3
      • set-4
      • set-5
  • 4. Computer Organization and Embedded System
    • 4.1 Control and CPU
    • 4.2 Computer Arithmetic and Memory System
    • 4.3 I/O Organization and Multiprocessor
    • 4.4 Embedded System Design
    • 4.5 Real-Time Operating and Control Systems
    • 4.6 Hardware Description Language (VHDL) and IC Technology
    • MCQs
      • set-1
      • set-2
      • set-3
      • set-4
      • set-5
      • set-6
      • set-7
      • set-8
      • set-9
      • set-10
      • set-11
  • 5. Concept of Computer Network and Network Security System
    • 5.1 Introduction to Computer Networks
    • 5.2 Data Link Layer
    • 5.3 Network Layer
    • 5.4 Transport Layer
    • 5.5 Application Layer
    • 5.6 Network Security
    • MCQs
      • Basic Networking
        • set-1
        • set-2
      • Advanced Networking
        • set-1
        • set-2
        • set-3
        • set-4
        • set-5
        • set-6
  • 6. Theory of Computation and Computer Graphics
    • 6.1 Introduction to Finite Automata
    • 6.2 Introduction to Context-Free Languages (CFL)
    • 6.3 Turing Machines (TM)
    • 6.4 Introduction to Computer Graphics
    • 6.5 Two-Dimensional Transformation
    • 6.6 Three-Dimensional Transformation
    • MCQs
      • MCQs on Theory of Computation
        • set-1
        • set-2
        • set-3
      • MCQs On Computer Graphics
        • set-1
        • set-2
        • set-3
        • set-4
        • set-5
        • set-6
  • 7. Data Structures and Algorithm, Database System and Operating System
    • 7.1 Introduction to Data Structures, Lists, Linked Lists, and Trees
    • 7.2 Sorting, Searching, Hashing and Graphs
    • 7.3 Introduction to Data Models, Normalization, and SQL
    • 7.4 Transaction Processing, Concurrency Control, and Crash Recovery
    • 7.5 Introduction to Operating System and Process Management
    • 7.6 Memory Management, File Systems, and System Administration
    • MCQs
      • MCQs ON DSA
        • set-1
        • set-2
        • set-3
        • set-4
        • set-5
        • set-6
      • MCQs On DBMS
        • set-1
        • set-2
      • MCQs On Operating System
        • set-1
        • set-2
        • set-3
        • set-4
        • set-5
        • set-6
        • set-7
        • set-8
        • set-9
        • set-10
        • set-11
        • set-12
  • 8. Software Engineering and Object-Oriented Analysis & Design
    • 8.1 Software Process and Requirements
    • 8.2 Software Design
    • 8.3 Software Testing, Cost Estimation, Quality Management, and Configuration Management
    • 8.4 Object-Oriented Fundamentals and Analysis
    • 8.5 Object-Oriented Design
    • 8.6 Object-Oriented Design Implementation
    • MCQs
      • set-1
      • set-2
      • set-3
      • set-4
      • set-5
      • set-6
      • set-7
      • set-8
      • set-9
  • 9. Artificial Intelligence and Neural Networks
    • 9.1 Introduction to AI and Intelligent Agents
    • 9.2 Problem Solving and Searching Techniques
    • 9.3 Knowledge Representation
    • 9.4 Expert System and Natural Language Processing
    • 9.5 Machine Learning
    • 9.6 Neural Networks
    • MCQs
      • set-1
      • set-2
      • set-3
      • set-4
      • set-5
      • set-6
      • set-7
      • set-8
      • set-9
  • 10. Project Planning, Design and Implementation
    • 10.1 Engineering Drawings and Its Concepts
    • 10.2 Engineering Economics
    • 10.3 Project Planning and Scheduling
    • 10.4 Project Management
    • 10.5 Engineering Professional Practice
    • 10.6 Engineering Regulatory Body
    • MCQs
      • MCQs On Engineering Drawing
        • set-1
        • set-2
      • MCQs On Engineering Economics
      • MCQs On Project Planning & Scheduling
      • MCQs On Project Mangement
      • MCQs On Engineering Professional Practice
      • MCQs On Engineering Regulatory Body
  • Questions Sets
    • Set 1 (Chaitra, 2080)
      • Short Questions (60*1=60 Marks)
      • Long Questions (20*2=40 Marks)
    • Set 2 (Aasadh, 2081)
      • Short Questions (60*1=60 Marks)
      • Long Questions (20*2=40 Marks)
    • Set 3 (Asojh, 2080)
      • Short Questions (60*1=60 Marks)
      • Long Questions (20*2=40 Marks)
    • Model Set - Computer Engineering By NEC
      • Short Questions (60*1=60 Marks)
      • Long Questions (20*2=40 Marks)
    • Model Set - Software Engineering By NEC
      • Short Questions (60*1=60 Marks)
      • Long Questions (20*2=40 Marks)
  • Tips & Tricks
Powered by GitBook
On this page
  • 1. Two-Dimensional Translation
  • 2. Two-Dimensional Rotation
  • 3. Two-Dimensional Scaling
  • 4. Two-Dimensional Reflection
  • 5. Two-Dimensional Shear Transformation
  • 6. Two-Dimensional Composite Transformation
  • 7. 2D Viewing Pipeline
  • 8. Clipping
  • Conclusion
  1. 6. Theory of Computation and Computer Graphics

6.5 Two-Dimensional Transformation

Previous6.4 Introduction to Computer GraphicsNext6.6 Three-Dimensional Transformation

Last updated 3 months ago

Two-dimensional (2D) transformations are fundamental operations used to manipulate and modify graphical objects in a 2D coordinate system. These transformations are applied to shapes, images, or objects to change their position, orientation, size, or other properties. They form the basis for rendering graphics in computer systems and are commonly used in applications such as gaming, CAD, and computer graphics.


1. Two-Dimensional Translation

Translation is the process of moving an object from one location to another within the 2D coordinate plane without changing its shape, size, or orientation. The object is shifted by a specified distance along the X and Y axes.

  • Mathematical Representation:

    • If (x,y)(x, y)(x,y) is the original point, and (tx,ty)(t_x, t_y)(tx​,ty​) is the translation vector, then the new point (x′,y′)(x', y') (x′,y′) after translation is given by:

      • x′=x+txx' = x + t_xx′=x+tx​

      • y′=y+tyy' = y + t_yy′=y+ty​

  • Transformation Matrix:

    T=[10tx01ty001]T = \begin{bmatrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{bmatrix}T=​100​010​tx​ty​1​​


2. Two-Dimensional Rotation

Rotation involves turning an object around a fixed point (typically the origin of the coordinate system) by a specified angle. Positive angles correspond to counterclockwise rotation, and negative angles correspond to clockwise rotation.

  • Mathematical Representation: If the point (x,y)(x, y)(x,y) is rotated by an angle ( θ\thetaθ ), the new point (x′,y′)(x', y') (x′,y′) is given by:

    • x′=xcos⁡θ−ysin⁡θx' = x \cos \theta - y \sin \thetax′=xcosθ−ysinθ

    • y′=xsin⁡θ+ycos⁡θy' = x \sin \theta + y \cos \thetay′=xsinθ+ycosθ

  • Transformation Matrix:

    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}R(θ)=​cosθsinθ0​−sinθcosθ0​001​​


3. Two-Dimensional Scaling

Scaling alters the size of an object by a scale factor along the X and Y axes. Scaling can be uniform (the same factor for both axes) or non-uniform (different factors for X and Y axes).

  • Transformation Matrix:


4. Two-Dimensional Reflection

Reflection involves flipping an object over a line (axis) such as the X-axis, Y-axis, or a diagonal line, producing a mirror image.

  • Reflection over the X-axis:

    • Mathmatical Representations

    • Transformation matrix:

  • Reflection over the Y-axis:

    • Mathmatical Representations

      • Transformation matrix:

  • Reflection over the line ( y = x ):

    • Mathmatical Representations

    • Transformation matrix:


5. Two-Dimensional Shear Transformation

Shear transformation distorts an object by shifting its points in one direction (horizontal or vertical) based on its position. It is often used in graphics for creating effects like slanting or skewing.

  • Mathematical Representation:

    • Horizontal shear (shifting X coordinates):

    • Vertical shear (shifting Y coordinates):

  • Transformation Matrix:

    • Horizontal shear:

    • Vertical shear:


6. Two-Dimensional Composite Transformation

A composite transformation involves applying multiple transformations to an object sequentially. This can include any combination of translation, rotation, scaling, and reflection.

The composite transformation matrix is the product of individual transformation matrices. For example, applying scaling, then rotation, and finally translation can be represented by the following:

This allows complex transformations to be represented as a single operation, simplifying computation and rendering.


7. 2D Viewing Pipeline

The 2D viewing pipeline is a process that converts a 3D scene or world coordinates into 2D screen coordinates, which can then be displayed on the screen. The pipeline typically involves:

  1. World-to-View Transformation: Converts the world coordinate system to the camera or view coordinate system.

  2. Projection Transformation: Projects the 3D scene onto a 2D plane.

  3. Clipping: Removes objects or parts of objects that fall outside the viewing area.

  4. Window-to-Viewport Transformation: Maps the 2D coordinates to screen coordinates.


8. Clipping

Clipping is the process of removing parts of an object that lie outside a specified region, often referred to as the clipping window. This is critical in computer graphics to ensure that only the visible portion of objects is rendered.

  1. Cohen-Sutherland Line Clipping Algorithm

The Cohen-Sutherland algorithm is used for line clipping. It divides the space into regions and assigns each endpoint a 4-bit code (outcode). Depending on the outcodes of the endpoints, the line can be:

  • Completely inside the clipping window.

  • Completely outside the clipping window.

  • Partially inside the clipping window (requiring further clipping).

  1. Liang-Barsky Line Clipping Algorithm

The Liang-Barsky algorithm is another line clipping algorithm that is more efficient than Cohen-Sutherland for axis-aligned rectangles. It works by testing the parameterized equation of the line against the clipping boundaries.


Conclusion

In 2D graphics, transformations are used to manipulate objects by changing their position, orientation, and size. The core transformations include translation, rotation, scaling, reflection, and shear. These transformations can be combined in a composite transformation to produce more complex effects. The 2D viewing pipeline allows 3D scenes to be converted into 2D representations for display on a screen. Clipping algorithms, such as Cohen-Sutherland and Liang-Barsky, are used to remove parts of objects that fall outside the defined view area.

Mathematical Representation: If (x,y)(x, y)(x,y) is the original point and (sx)( s_x )(sx​) and (sy)( s_y )(sy​) are the scaling factors along the X and Y axes, then the new point (x′,y′)(x', y') (x′,y′) is given by:

x′=x⋅sxx' = x \cdot s_xx′=x⋅sx​

y′=y⋅syy' = y \cdot s_yy′=y⋅sy​

S=[sx000sy0001]S = \begin{bmatrix} s_x & 0 & 0 \\ 0 & s_y & 0 \\ 0 & 0 & 1 \end{bmatrix}S=​sx​00​0sy​0​001​​

x′=xx' = xx′=x

y′=−yy' = -yy′=−y

Rx=[1000−10001]R_x = \begin{bmatrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 1 \end{bmatrix}Rx​=​100​0−10​001​​

x′=−xx' = -xx′=−x

y′=yy' = yy′=y

Ry=[−100010001]R_y = \begin{bmatrix} -1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}Ry​=​−100​010​001​​

x′=yx' = yx′=y

y′=xy' = xy′=x

Rxy=[010100001]R_{xy} = \begin{bmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}Rxy​=​010​100​001​​

x′=x+shx⋅yx' = x + sh_x \cdot yx′=x+shx​⋅y

y′=yy' = yy′=y

x′=xx' = xx′=x

y′=y+shy⋅xy' = y + sh_y \cdot xy′=y+shy​⋅x

Hshx=[1shx0010001]H_{sh_x} = \begin{bmatrix} 1 & sh_x & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}Hshx​​=​100​shx​10​001​​

Hshy=[100shy10001]H_{sh_y} = \begin{bmatrix} 1 & 0 & 0 \\ sh_y & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}Hshy​​=​1shy​0​010​001​​

Tcomposite=T⋅R⋅ST_{composite} = T \cdot R \cdot STcomposite​=T⋅R⋅S