1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphics Two Dimensional Geometric Transformations Dr. Eng.

Slides:



Advertisements
Similar presentations
COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Advertisements

Gursharan Singh Tatla TRANSFORMATIONS Gursharan Singh Tatla Gursharan Singh Tatla.
Geometric Transformations
TRANSFORMATIONS.
4-3 Warm Up Lesson Presentation Lesson Quiz
Three Dimensional Modeling Transformations
(7.7) Geometry and spatial reasoning The student uses coordinate geometry to describe location on a plane. The student is expected to: (B) graph reflections.
Transformation in Geometry Created by Ms. O. Strachan.
1 Computer Graphics Chapter 6 2D Transformations.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
Linear Algebra and SVD (Some slides adapted from Octavia Camps)
CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu.
2D/3D Geometric Transformations CS485/685 Computer Vision Dr. George Bebis.
©College of Computer and Information Science, Northeastern UniversityJune 26, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lecture 11.
CS 4731: Computer Graphics Lecture 8: 3D Affine transforms Emmanuel Agu.
Transformations of Functions and their Graphs Ms. P.
Mathematical Fundamentals
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
©College of Computer and Information Science, Northeastern UniversitySeptember 9, CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture.
5.2 Three-Dimensional Geometric and Modeling Transformations 2D3D Consideration for the z coordinate.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Transformations Dr. Amy Zhang.
Lecture Notes: Computer Graphics.
2D Geometric Transformations
Computer Graphics, KKU. Lecture 51 Transformations Given two frames in an affine space of dimension n, we can find a ( n+1 ) x ( n +1) matrix that.
Transformation.
Introduction to Computer Graphics Geometric Transformations
Computer Graphics 3D Transformations. Translation.
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
Geometric Transformations
 Remember back in geometry when you did translations? A translation is a. The coordinates of a point use a rule to move from its to its. slide preimageimage.
GEOMETRIC TRANFORMATIONS Presented By -Lakshmi Sahithi.
4-4 Geometric Transformations with Matrices Objectives: to represent translations and dilations w/ matrices : to represent reflections and rotations with.
Transformations of Geometric Figures Dr. Shildneck Fall, 2015.
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
January 19, y X Z Translations Objects are usually defined relative to their own coordinate system. We can translate points in space to new positions.
3-D Geometric Transformations
3D Geometric Transformation
3D Geometric Transformation
Section 3: Using Matrices to Transform Geometric Figures.
II-1 Transformations Transformations are needed to: –Position objects defined relative to the origin –Build scenes based on hierarchies –Project objects.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
Unit 5 Transformations. ) Math Pacing Review of the Coordinate Plane (3, – 2) III Q (0, 1) J (1, 4) & S (1, 0) (– 3, – 2)
Coordinates and Design. What You Will Learn: To use ordered pairs to plot points on a Cartesian plane To draw designs on a Cartesian plane To identify.
DRILL 1) If A is in between points B and C and AC is 4x + 12 and AB is 3x – 4 and BC is 57 feet how long is AB? 2) Angles A and B are Supplementary if.
Perform Congruence Transformations. Transformations: when you move or change a geometric figure in some way to produce a new figure. Image is what the.
16 Using Matrices to Transform Geometric Figures Warm Up Warm Up Lesson Presentation Lesson Presentation Lesson Quiz Lesson Quiz.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
1 Teaching Innovation - Entrepreneurial - Global The Centre for Technology enabled Teaching & Learning, N Y S S, India DTEL DTEL (Department for Technology.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
Section 1-4 Shifting, Reflecting, and Stretching Graphs
Computer Graphic 2 D Transformation.
3D Geometry and Transformations
Transformations. Transformations Introduce standard transformations ◦ Rotation ◦ Translation ◦ Scaling ◦ Shear Derive homogeneous coordinate transformation.
1.5 Graphical Transformations Represent translations algebraically and graphically.
Computer Graphics 2D Transformations
Modeling Transformations
Lecture 10 Geometric Transformations In 3D(Three- Dimensional)
Transforms.
3. Transformation
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics Transformations.
3D Transformation.
Computer Graphics 3D Transformations
CS1550 Fundamentals For Computer Graphics Transformations-1
4-4 Geometric Transformations with Matrices
2D Geometric Transformations
CS1550 Fundamentals For Computer Graphics Transformations-2
Transformations.
Using Matrices to Perform Geometric Transformations
Presentation transcript:

1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphics Two Dimensional Geometric Transformations Dr. Eng. Farag Elnagahy Office Phone: 67967

2 Translation Cartesian coordinates provide a one-to-one relationship between number and shape, such that when we change a shape’s coordinates, we change its geometry. For example, if P(x, y) is a vertex on a shape, when we apply the operation x’=x+3 we create a new point P(x’, y) three units to the right. Similarly, the operation y’=y+1 creates a new point P(x, y’) displaced one unit vertically. By applying both of these transforms to every vertex to the original shape, the shape is displaced as shown in Figure.

3 Translation The translated shape results by adding 3 to every x- coordinate, and 1 to every y-coordinate of the original shape.

4 Translation The algebraic and matrix notation for 2D translation is x’ = x + t x y’ = y + t y or, using matrices, x’10 txtx x y’=01tyty y 10011

5 Scaling Shape scaling is achieved by multiplying coordinates as follows: x’ = 2x and y’ = 1.5y This transform results in a horizontal scaling of 2 and a vertical scaling of 1.5 Note that a point located at the origin does not change its place, so scaling is relative to the origin.

6 Scaling The algebraic and matrix notation for 2D scaling is x’ = s x x y’ = s y y or, using matrices, x’ sxsx 00x y’=0 sysy 0y The scaling action is relative to the origin, i.e. the point (0,0) remains (0,0). All other points move away from the origin.

7 Scaling To scale relative to another point (p x,p y ) we first subtract (p x,p y ) from (x,y) respectively. This effectively translates the reference point (p x,p y ) back to the origin. Second, we perform the scaling operation, and third, add (p x,p y ) back to (x,y) respectively, to compensate for the original subtraction. Algebraically this is x’ = s x (x – p x ) + p x y’ = s y (y – p y ) + p y which simplifies to x’ = s x x + p x (1 – s x ) y’ = s y y + p y (1 – s y )

8 Scaling in a homogeneous matrix form x’ sxsx 0p x (1– s x )x y’=0 sysy p y (1 – s y )y For example, to scale a shape by 2 relative to the point (1, 1) the matrix is x’20– 1x y’=02– 1y 10011

9 Scaling The strategy used to scale a point (x, y) relative to some arbitrary point (p x, p y ) was to first, translate (–p x, –p y ); second, perform the scaling; and third, translate (p x, p y ). x’10pxpx sxsx 0010-p x x y’=01pypy 0sysy 001-p y y x’ [translate(px, py)] [scale(sx, sy)] [translate(–px,–py)] x y’=y 11

10 Reflection To make a reflection of a shape relative to the y-axis, we simply reverse the sign of the x-coordinate, leaving the y-coordinate unchanged x’ = – x y’ = y And to reflect a shape relative to the x-axis we reverse the y-coordinates: x’ = x y’ = – y

11 Reflection Examples of reflections are shown in Figure. The top right-hand shape can give rise to the three reflections simply by reversing the signs of coordinates

12 Reflection The matrix notation for reflecting about the y-axis is: about the x-axis is: x’– 100x y’=010y x’100x y’=0– 10y 10011

13 Reflection To make a reflection about an arbitrary vertical or horizontal axis we need to introduce some more algebraic deception. For example, to make a reflection about the vertical axis x=1  First subtract 1 from the x -coordinate. This effectively makes the x=1 axis coincident with the major y-axis.  Next we perform the reflection by reversing the sign of the modified x -coordinate.  Finally, we add 1 to the reflected coordinate to compensate for the original subtraction. Algebraically, the three steps are x 1 = x – 1 x 2 = – (x – 1) x’ = – (x – 1) + 1 which simplifies to x’ = –x + 2 y’ = y

14 Reflection In matrix form: x’– 102x y’=010y This figure illustrates this process. The shape on the right is reflected about the x = 1 axis

15 Reflection In general, to reflect a shape about an arbitrary y-axis, x = a x, the following transform is required: x’ = – (x –a x ) + a x = –x + 2a x y’ = y or, in matrix form, x’– 102a x x y’=010y 10011

16 Reflection Similarly, this transform is used for reflections about an arbitrary x-axis, y = a y : x’ = x y’ = – (y – a y ) + a y = –y + 2a y or, in matrix form, x’100x y’=0– 12a y y 10011

17 Reflection Therefore, using matrices, we can reason that a reflection transform about an arbitrary axis x = a x, parallel with the y- axis, is given by x’10axax 0010-a x x y’= y x’ [translate(ax, 0)] [reflection] [translate(–ax,0)] x y’=y 11

18 Shearing A shape is sheared by leaning it over at an angle β. Figure below illustrates the geometry, and we see that the y- coordinate remains unchanged but the x -coordinate is a function of y and tan(β). x’ = x + y tan(β) y’ = y x’1tan(β)0x y’=000y The original square shape is sheared to the right by an angle β, and the horizontal shift is proportional to y tan(β).

19 Rotation In the Figure the point P(x, y) is to be rotated by an angle β about the origin to P(x’, y’). It can be seen that: x’ = R cos(θ + β) y’ = R sin(θ + β) x’ = R(cos(θ) cos(β) – sin(θ) sin(β)) = R( (x/R) cos(β) – (y/R) sin(β)) = x cos(β) – y sin(β) y’ = R(sin(θ) cos(β) + cos(θ) sin(β)) = R( (y/R) cos(β) + (x/R) sin(β)) = x sin(β) + y cos(β)

20 Rotation x’ = x cos(β) – y sin(β) y’ = x sin(β) + y cos(β) x’cos(β)–sin(β)0x y’=sin(β)cos(β)0y For example, to rotate a point by 90 0 the matrix becomes: x’0– 10x y’=100y Thus the point (1, 0) becomes (0, 1).

21 Rotation To rotate a point (x, y) about an arbitrary point (p x, p y ) 1.Subtract (p x, p y ) from the coordinates (x, y) respectively This enables us to perform the rotation about the origin. x 1 = (x – p x ) y 1 = (y – p y ) 2.Rotate β about the origin: x 2 = (x –p x ) cos(β) – (y –p y ) sin(β) y 2 = (x –p x ) sin(β) + (y –p y ) cos(β) 3.Add (p x, p y ) to compensate for the original subtraction x’ = (x – p x ) cos(β) – (y – p y ) sin(β) + p x y’ = (x – p x ) sin(β) + (y – p y ) cos(β) + p y

22 Rotation x’ = x cos(β) –y sin(β) + p x (1 –cos(β)) + p y sin(β) y’ = x sin(β) + y cos(β) + p y (1 –cos(β)) –p x sin(β) in matrix form: x’cos(β)–sin(β)p x (1–cos(β))+p y sin(β)x y’=sin(β)cos(β)p y (1–cos(β))–p x sin(β)y x’0– 10x y’=100y rotating a point 90 º about the point (1, 1) the matrix becomes

23 Rotation x’ = x cos(β) –y sin(β) + p x (1 –cos(β)) + p y sin(β) y’ = x sin(β) + y cos(β) + p y (1 –cos(β)) –p x sin(β) in matrix form: x’cos(β)–sin(β)p x (1–cos(β))+p y sin(β)x y’=sin(β)cos(β)p y (1–cos(β))–p x sin(β)y x’0– 10x y’=100y rotating a point 90 º about the point (1, 1) the matrix becomes

24 Rotation Therefore, using matrices, we can develop a rotation about an arbitrary point (p x, p y ) as follows: x’10pxpx cos(β)–sin(β)010-p x x y’=01pypy sin(β) cos(β)001-p y y x’ [translate(px, py)] [rotate β] [translate(–px, –py)] x y’=y 11