Geometric Transformation
79 / 100

Unit-3 Geometric Transformation-Computer Graphics | BCA

Unit-3 Geometric Transformation-Computer Graphics | BCA- Hello everyone welcome to the pencilchampions.com website. This website provide BCA 4th semester CCS University Notes. Thankyou for visiting.

Geometric Transformation

Unit-3

Geometric Transformation

  1. Translation: Imagine you have a shape, like a triangle, and you want to move it to a different location without changing its size or orientation. That’s a translation! You just slide the shape along a straight line without flipping or rotating it.
  2. Rotation: Now, let’s say you want to turn your shape around a fixed point. That’s a rotation! You can rotate it clockwise or counterclockwise by a certain angle. The fixed point is called the center of rotation.
  3. Reflection: A reflection is like looking at your shape in a mirror. You flip it across a line called the line of reflection. The shape stays the same size and shape, but it appears as a mirror image.
  4. Dilation: A dilation is a fancy word for changing the size of a shape. You can make it bigger or smaller, but the shape remains the same. You do this by multiplying or dividing the coordinates of the shape’s vertices by a scale factor.
  • These transformations are not only used in math but also in real-life applications like computer graphics, architecture, and even art! They help us create symmetrical designs, simulate movement, and more.

Read More- https://pencilchampions.com/unit-2-hardcopies-technologies-bca-4-sem/


2D Transformation

  1. Translation: Imagine you have a shape, like a square, and you want to move it from one location to another without changing its size or orientation. That’s where translation comes in! You can think of it as sliding the shape in a straight line without flipping or rotating it. This movement is determined by the distance and direction of the translation.
  2. Rotation: If you want to rotate a shape, like a triangle, around a fixed point, you’re using rotation. The fixed point is called the center of rotation. When you rotate a shape, it turns around this point either clockwise or counterclockwise by a certain angle. The angle of rotation determines how much the shape is turned.
  3. Reflection: Reflection involves flipping a shape over a line, just like looking at it in a mirror. This line is called the line of reflection. When you reflect a shape, it creates a mirror image of itself. The shape remains the same size and shape, but it appears as if it has been flipped.
  4. Scaling: Scaling involves changing the size of a shape. You can make it larger (enlargement) or smaller (reduction) while maintaining its proportions. Scaling is done by multiplying or dividing the coordinates of the shape’s vertices by a scale factor. The scale factor determines how much the shape is stretched or shrunk.
  • These 2D transformations are fundamental concepts in geometry and have various practical applications. For example, in computer graphics, 2D transformations are used to create animations, simulate movement, and manipulate objects on a screen. In architecture and design, transformations are used to create symmetrical patterns, adjust the size of objects, and more.

Wikipedia- https://en.wikipedia.org/wiki/Geometric_transformation


Homogeneous Co-ordinates

  • Homogeneous coordinates are a mathematical concept used in computer graphics and geometry to represent points and transformations in a higher-dimensional space.
  • In traditional Cartesian coordinates, we represent a point in 2D space with (x, y) coordinates. However, in homogeneous coordinates, we use a third coordinate, called the “w” coordinate, to represent the point as (x, y, w).
  • The key idea behind homogeneous coordinates is that multiple sets of (x, y, w) coordinates can represent the same point in 2D space. For example, (2, 4, 2) and (1, 2, 1) both represent the same point in Cartesian coordinates (2, 4).
  • Homogeneous coordinates allow us to perform various transformations, such as translation, rotation, and scaling, using matrix operations. These transformations can be represented by transformation matrices.

Let’s take a closer look at how homogeneous coordinates work with each transformation:

  1. Translation: To translate a point using homogeneous coordinates, we use a translation matrix. The translation matrix looks like this:

| 1  0  tx |

| 0  1  ty |

| 0  0   1 |

  • Here, tx and ty represent the translation amounts in the x and y directions, respectively. To apply the translation, we multiply the translation matrix by the homogeneous coordinate of the point.
  1. Rotation: Homogeneous coordinates can also represent rotation transformations. To rotate a point around the origin, we use a rotation matrix. The rotation matrix looks like this:

| cosθ  -sinθ  0 |

| sinθ   cosθ  0 |

|   0       0     1 |

  • Here, θ represents the angle of rotation. To apply the rotation, we multiply the rotation matrix by the homogeneous coordinate of the point.
  1. Scaling: Scaling transformations can also be represented using homogeneous coordinates. To scale a point, we use a scaling matrix. The scaling matrix looks like this:

| sx   0   0 |

|  0  sy   0 |

|  0   0   1 |

  • Here, sx and sy represent the scaling factors in the x and y directions, respectively. To apply the scaling, we multiply the scaling matrix by the homogeneous coordinate of the point.
  • The advantage of using homogeneous coordinates is that we can combine multiple transformations by multiplying their respective matrices. This allows us to perform complex transformations efficiently.

Matrix representation of 2D transformation

  • In computer graphics and geometry, we often use matrices to represent and apply various transformations to 2D objects, such as translation, rotation, scaling, and shearing.
  • Let’s start with translation. Translation involves moving an object from one location to another. To represent translation in a 2D space, we use a 3×3 matrix called a translation matrix. This matrix looks like this:

| 1  0  tx |

| 0  1  ty |

| 0  0   1 |

  • In this matrix, tx represents the translation amount in the x-axis, and ty represents the translation amount in the y-axis. To apply a translation to a point (x, y), we multiply the translation matrix by the homogeneous coordinates of the point:

| x’ |   | 1  0  tx |   | x |

| y’ | = | 0  1  ty | * | y |

| 1  |   | 0  0   1 |   | 1 |

  • The resulting point (x’, y’) represents the translated position of the original point.
  • Next, let’s talk about rotation. Rotation involves rotating an object around a fixed point or the origin. To represent rotation in a 2D space, we use a 3×3 matrix called a rotation matrix. The rotation matrix depends on the angle of rotation (θ) and looks like this:

| cosθ  -sinθ  0 |

| sinθ   cosθ  0 |

|   0       0     1 |

  • To apply a rotation transformation to a point (x, y), we multiply the rotation matrix by the homogeneous coordinates of the point:

| x’ |   | cosθ  -sinθ  0 |   | x |

| y’ | = | sinθ   cosθ  0 | * | y |

| 1  |   |   0       0     1 |   | 1 |

The resulting point (x’, y’) represents the rotated position of the original point.

  • Now, let’s discuss scaling. Scaling involves changing the size of an object. To represent scaling in a 2D space, we use a 3×3 matrix called a scaling matrix. The scaling matrix looks like this:

Composition of 2D transformation

  • When we talk about the composition of transformations, we mean combining multiple transformations together to create a new transformation.
  • In 2D graphics, we often use translation, rotation, scaling, and shearing transformations. To compose these transformations, we multiply their respective transformation matrices together.
  • Let’s say we have three transformations: translation, rotation, and scaling. We’ll call the translation matrix T, the rotation matrix R, and the scaling matrix S.
  • To compose these transformations, we multiply the matrices in the order we want the transformations to be applied. Let’s say we want to first translate, then rotate, and finally scale. The composed transformation matrix, denoted as M, would be:

M = S * R * T

  • To apply this composed transformation to a point (x, y), we multiply the composed transformation matrix by the homogeneous coordinates of the point:

| x’ |   | M11  M12  M13 |   | x |

| y’ | = | M21  M22  M23 | * | y |

| 1  |   |   0      0      1 |   | 1 |

  • The resulting point (x’, y’) represents the transformed position of the original point after applying all three transformations.
  • It’s important to note that when we multiply matrices, the order matters. Changing the order of transformations in the composition will yield different results.
  • By composing multiple transformations, we can create complex and interesting effects in computer graphics. For example, we can create a rotating and scaling animation by continuously applying the rotation and scaling matrices to a point.

The windows to viewport transformations

  • When we talk about windows to viewport transformations, we are referring to the process of mapping a region in a world coordinate system (window) to a corresponding region in a device coordinate system (viewport).
  • In computer graphics, we often work with a virtual world coordinate system that represents the scene we want to display. This world coordinate system has its own dimensions and units. On the other hand, the viewport represents the actual display area on our screen, with its own dimensions and pixel units.
  • The goal of the windows to viewport transformation is to map the coordinates of objects in the world coordinate system to their corresponding positions on the viewport. This allows us to accurately render the scene on the screen.
  • To achieve this, we use a combination of scaling, translation, and possibly rotation transformations. These transformations are applied to each vertex or point in the world coordinate system to determine its position in the viewport coordinate system.

Let’s break down the steps involved in the windows to viewport transformation:

  1. Define the window: The window represents the region in the world coordinate system that we want to display on the screen. It is defined by its minimum and maximum x and y values.
  2. Define the viewport: The viewport represents the actual display area on the screen. It is defined by its minimum and maximum x and y values as well.
  3. Calculate the scaling factors: To map the window to the viewport, we need to determine the scaling factors for the x and y axes. These scaling factors are calculated by dividing the width and height of the viewport by the width and height of the window, respectively.
  4. Calculate the translation factors: Next, we need to calculate the translation factors for the x and y axes. These factors determine the amount by which we need to shift the window in order to align it with the viewport. The translation factors are calculated by subtracting the minimum x and y values of the window from the minimum x and y values of the viewport, respectively.
  5. Apply the transformations: Once we have the scaling and translation factors, we can apply them to each vertex or point in the world coordinate system. The scaling factors are used to scale the coordinates, while the translation factors are used to shift the coordinates.

Introduction of 3D transformation Matrix

  • In computer graphics, 3D transformation matrices are used to manipulate and transform objects in a three-dimensional space. These matrices allow us to perform various operations such as translation, rotation, scaling, and shearing on 3D objects.
  • A 3D transformation matrix is a 4×4 matrix that represents the transformation operations to be applied to a 3D object. Each element of the matrix corresponds to a specific transformation component. Let’s break down the different components of a 3D transformation matrix:

Translation:

  • Translation is used to move an object from one position to another in 3D space. The translation component of a 3D transformation matrix is represented by the elements in the last column of the matrix. These elements specify the amount of translation along the x, y, and z axes.

Rotation:

  • Rotation is used to change the orientation or angle of an object in 3D space. There are different types of rotations such as rotation around the x, y, or z axes, or arbitrary rotations around any axis. The rotation component of a 3D transformation matrix is represented by the elements in the upper-left 3×3 submatrix. These elements define the rotation angles or transformation matrices for each axis.

Scaling:

  • Scaling is used to resize an object in 3D space. It can make an object bigger or smaller along the x, y, and z axes. The scaling component of a 3D transformation matrix is represented by the diagonal elements in the upper-left 3×3 submatrix. These elements specify the scaling factors for each axis.

Shearing:

  • Shearing is used to distort the shape of an object by displacing its vertices along a particular axis. The shearing component of a 3D transformation matrix is represented by the off-diagonal elements in the upper-left 3×3 submatrix. These elements define the amount of shearing along each axis.

Homogeneous Coordinates:

  • The fourth column of the 3D transformation matrix is used for homogeneous coordinates. Homogeneous coordinates allow us to represent translations as part of the matrix multiplication. By using homogeneous coordinates, we can combine translation, rotation, scaling, and shearing operations into a single matrix.
  • To apply a 3D transformation matrix to a 3D object, we perform matrix multiplication between the transformation matrix and the coordinates of each vertex of the object. This results in new coordinates that represent the transformed object.

Discover more from Pencil Champions

Subscribe to get the latest posts sent to your email.

By Atul Kakran

My name is Atul Kumar. I am currently in the second year of BCA (Bachelor of Computer Applications). I have experience and knowledge in various computer applications such as WordPress, Microsoft Word, Microsoft Excel, PowerPoint, CorelDRAW, Photoshop, and creating GIFs.

Leave a Reply

Discover more from Pencil Champions

Subscribe now to keep reading and get access to the full archive.

Continue reading