2 D TRANSFORMATION Prepared by Prof Samina Anjum
2 D TRANSFORMATION Prepared by, Prof. Samina Anjum Department CSE, ACET
Syllabus: - COMPUTER GRAPHICS UNIT‐ I Introduction to Computer Graphics : Overview of Computer Graphics, Computer Graphics Application and Software, Graphics Areas, Graphics Pipeline, Graphics API’s, Numerical issues, Efficiency Display and Hardcopy Technologies, Display Technologies – Raster scan Display System, Video Controller – Vector scan display system, Random Scan Display Processor, Input Devices for Operator Interaction, Image Scanners UNIT‐ II Basic Raster Graphics Algorithms for Drawing 2 D primitives, aliasing and ant aliasing, Polygon filling methods: Scan Conversion Algorithms: Simple Ordered edge list, Edge Fill, Fence fill and Edge Flag Algorithm. , Seed fill Algorithms: Simple and Scan Line Seed Fill Algorithm, Halftoning techniques UNIT‐ III Graphics Programming using OPENGL: Why Open. GL, Features in Open. GL, Open. GL operations, Abstractions in Open. GL – GL, GLU & GLUT, 3 D viewing pipeline, viewing matrix specifications, a few examples and demos of Open. GL programs, Animations in open. GL
Syllabus: - COMPUTER GRAPHICS UNIT ‐IV 2 D Clipping algorithms for regular and irregular windows: Sutherland Cohen Outcode, Sutherland Cohen Subdivision, Mid-Point subdivision, Cyrus Beck and Sutherland Hodgeman, Cohen-Sutherland Polygon clipping Algorithm. Clipping about Concave regions. 2 D Transformations, Translation, Rotation, Reflection, Scaling, Shearing Combined Transformation, Rotation and Reflection about an Arbitrary Line UNIT ‐V Normalized Device Coordinates and Viewing Transformations, 3 D System Basics and 3 D Transformations, 3 D graphics projections, parallel, perspective, viewing transformations. 3 D graphics hidden surfaces and line removal, painter’s algorithm, Z -buffers, Warnock’s algorithm. UNIT ‐VI Basic Ray tracing Algorithm, Perspective, Computing Viewing Rays, Ray-Object Intersection Shading, A Ray tracing Program, Shadows, Ideal Specular Reflection. Curves and Surfaces: Polygon Mesh, Parametric Cubic Curves, Parametric Bicubic Surfaces, Quadratic Surface, Bezier Curves and B-spline curves.
COURSE OUTCOME • CO 4 – Analyze and apply clipping algorithms and transformation on 2 D images.
2 D Transformations • Transformation means changing some graphics into something else by applying rules or • Transformations alter points between coordinate systems Y V (2, 4) U X U=X-1 V=Y-1 X=U+1 Y=V+1 Y V (1, 3) U X
2 D Transformations • Transformations transform a point’s shape and location in one coordinate system (2, 2) Y X X'=X-1 Y’=Y-1 X=X’+1 Y=Y’+1 Y (2, 1) X
Why Transformations? • Transformations are linear – Transforming all the individual points on a line gives the same set of points as transforming the endpoints and joining them. – Geometric transformation allows us to calculate the new co-ordinates.
Types of Transforms • Transformation can be serene as a series of simple transformations: – – – Translation Scaling Rotation Shear Reflection Basic transformations Advanced transformations
2 D Translation • It is a process of changing the position of an object on the screen Y P’(X’, Y’) Y ty X tx X’=X+tx Y’=Y+ty X
2 D Scaling • Scaling is a transformation reduces the size in each dimension of an object. Y Y Y X sy Y X X sx X
2 D Rotation • Rotate counter-clockwise about the origin by an angle Y Y X X
Basic Transformations Matrix are • Translation: T= • Rotation: R= • Scaling: S=
Example: - Translate a square ABCD with the co-ordinates A(0, 0), B(5, 0), C(5, 5), D(0, 5) by 2 units in X-direction and 3 units in Y- direction on the screen. Solution: - Translation, Given: - tx = 2 and ty = 3
Therefore, Given: - tx = 2 and ty = 3
The transformation matrix is = Therefore,
D’ Therefore, A’(2, 3) B’(7, 3) C’(7, 8) D’(2, 8) A’ C’ B’
Example: - Scale the square ABCD with the co-ordinates A(0, 0), B(3, 0), C(3, 3), D(0, 3) by 3 units in X-direction and 3 units in Y- direction with respect to origin. Solution: - Scaling, Given: - Sx = 3 and Sy = 3
Therefore, Given: - tx = 3 and ty = 3
The scaling matrix is = Therefore,
D’ C’ Therefore, B’ A’ A’(0, 0) B’(9, 0) C’(9, 9) D’(0, 9)
Rotating About An Arbitrary Point • What happens when you apply a rotation transformation to an object that is not at the origin? • Solution: 1. 2. 3. Translate the center of rotation to the origin Rotate the object Translate back to the original location
Rotating About An Arbitrary Point Y Y X Y X X
Homogeneous Transform Advantages • Combined analysis of transformation as matrix multiplication – Easier in h/w and s/w • To create transformations, simply multiply matrices – Order matters: AB is generally not the same as BA • Allows for non transformations: – Perspective projections! – Bends, tapers, many others
THANKYOU!
- Slides: 24