CGPage: 1 東吳資訊科學 江清水 3.1 2D Geometry - points and polygons X Y A point in 2D is represented by two real numbers (X,Y) A line segment is represented by.

Slides:



Advertisements
Similar presentations
10.7: Rotations in the Coordinate Plane
Advertisements

Transformations We want to be able to make changes to the image larger/smaller rotate move This can be efficiently achieved through mathematical operations.
CGPage: 1 東吳資訊科學 江清水 The process of clipping decides which part, if any, of a primitive lies inside the window. The algorithms used for line clipping can.
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
Picture Manipulation The manipulation of (already created) pictures. May be applied to vector graphics or bitmaps. We will consider bitmaps and introduce.
8. 2D Coordinate Operations Assoc.Prof.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze.
Two-Dimensional Geometric Transformations
2D TRANSFORMATIONS. 2D Transformations What is transformations? –The geometrical changes of an object from a current state to modified state. Why the.
25 May May May 2015Week 5-2D Transformations1 2D Transformations By: KanwarjeetSingh.
Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz
Math for CSTutorial 11 Course Outline Homogeneous Coordinates.
Linear Algebra and SVD (Some slides adapted from Octavia Camps)
Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of coordinate systems Translation Scaling Rotation.
CS 376 Introduction to Computer Graphics 02 / 09 / 2007 Instructor: Michael Eckmann.
2D/3D Geometric Transformations CS485/685 Computer Vision Dr. George Bebis.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2008 Some slides from Steve Seitz
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2005 Some slides from Steve Seitz
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
Transformations. 2 Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple geometry, most of us.
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Introduction to Computer Graphics CS 445 / 645 Lecture 5 Transformations Transformations M.C. Escher – Smaller and Smaller (1956)
2D Transformations Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
CAP4730: Computational Structures in Computer Graphics
CS 450: Computer Graphics 2D TRANSFORMATIONS
A dilation is a transformation that changes the size of a figure but not its shape. The preimage and the image are always similar. A A’
CGPage: 1 東吳資訊科學 江清水 Part I: Computer Graphics 1. Computer Graphics and Its application 2. Computer Graphics Hardware and Software (Skip) 3. 2D Coordinate.
2IV60 Computer Graphics Basic Math for CG
Image Warping (Szeliski 3.6.1) cs129: Computational Photography James Hays, Brown, Fall 2012 Slides from Alexei Efros and Steve Seitz
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Warping CSE 590 Computational Photography Tamara Berg.
Part7: Geometric Transformations
 2D Transformations 2D Transformations  Translation Translation  Rotation Rotation  Scaling Scaling.
Geometric Transformations
Magnitude of a Vector The magnitude of a vector, denoted as |a|, is defined as the square root of the sum of the squares of its components: |a| = (x 2.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Computer Graphics 2D Transformations. 2 of 74 Contents In today’s lecture we’ll cover the following: –Why transformations –Transformations Translation.
Geometric Objects and Transformation
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Transformation.
CS559: Computer Graphics Lecture 8: Warping, Morphing, 3D Transformation Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
WARM UP: Describe in words how to rotate a figure 90 degrees clockwise.
CGPage: 1 東吳資訊管理 江清水 Computer Game : Basic 1.Computer Graphics and Its application 2.2D Coordinate Geometry 3.1 2D geometry -- points and polygons 3.2.
Two-Dimensional Geometric Transformations A two dimensional transformation is any operation on a point in space (x, y) that maps that point's coordinates.
Geometric Transformations
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
Fall 2004CS-321 Dr. Mark L. Hornick 1 2-D Transformations World Coordinates Local/Modelling Coordinates x y Object descriptions Often defined in model.
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
 An image is the new figure, and the preimage is the original figure  Transformations-move or change a figure in some way to produce an image.
Recap from Monday DCT and JPEG Point Processing Histogram Normalization Questions: JPEG compression levels Gamma correction.
Computer Graphics I, Fall 2010 Transformations.
RGpIcE5M Today’s Transformation Lesson???
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
2D Transformations What is transformations? The geometrical changes of an object from a current state to modified state. Why the transformations is needed?
Transformations Szirmay-Kalos László. Transformations Can destroy our equations Limit the transformations and the shapes and require invariance – Line.
2.4 Modeling Motion in Matrices Objectives: 1.Use matrices to determine the coordinates of polygons under a given transformation.
Computer Graphic 2 D Transformation.
Image Warping 2D Geometric Transformations
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
2D Geometry - points and polygons
Geometric Transformations
Computer Graphics Transformations.
Algebraic Representations of Transformations
Presentation transcript:

CGPage: 1 東吳資訊科學 江清水 3.1 2D Geometry - points and polygons X Y A point in 2D is represented by two real numbers (X,Y) A line segment is represented by its two end points (X 1,Y 1 ) (X 2,Y 2 ), or a 2x2 matrix [ ] X 1 Y 1 X 2 Y 2 X Y

CGPage: 2 東吳資訊科學 江清水 A polygon is represented by an list of points (X 1,Y 1 ), (X 2,Y 2 ),..... (X n,Y n ) or a n x 2 matrix [ ] For example, a triangle is represent by [ ] X 1 Y 1 : X n Y n X 1 Y 1 X 2 Y 2 X 3 Y 3 X Y

CGPage: 3 東吳資訊科學 江清水 3.2 Object transformation and Coordinates System transformation Y X (2,4) (6,2) (2,2) Object transformation is different from the coordinates system transformation

CGPage: 4 東吳資訊科學 江清水 Translation (2,1) Rotation (  /2) counter clock wise about the origin X Y Y X Object Transformation Scale (1/2) about the origin Y X

CGPage: 5 東吳資訊科學 江清水 Y X Y X Coordinates system transformation YY XX 1 23 Translation (2,1) Rotation (  /2) counter clock wise about the origin Scale (1/2) about the origin If not described explicitly, transformation always means object transformation

CGPage: 6 東吳資訊科學 江清水 There are 3 "basic" transformations: (1) Translation (2) Scaling (3) Rotation A series of transformations can be combined (concatenated) into one. (1) Translation : T(T x, T y ) X Y (x,y) (x',y') 2D Translations TxTx TyTy 3.3

CGPage: 7 東吳資訊科學 江清水 (2) Scaling (about the origin) : S(S x, S y ) What about "Mirror Images"? How do we avoid distortion? What happens when the scale factor equal to zero? X Y (x,y) Y X (x',y') S(-2, -1)

CGPage: 8 東吳資訊科學 江清水 (3) Rotation (about the origin counterclockwise) : x = R cos  y = R sin  x' = R cos(  R(cos  cos  sin  sin  y' = R sin(  R(sin  cos  cos  sin  So, x ' = xcos  - ysin  y ' = xsin  + ycos  X Y (x,y) (x',y')  

CGPage: 9 東吳資訊科學 江清水 Concatenation -- A series of transformations can be combined (concatenated) into one. Example: scaling about arbitrary point. 1. Translate so that point (a,b) becomes the temporary origin: x 1 = x - a y 1 = y - b 2. Scale to the correct size: x 2 = S x *x 1 y 2 = S y* y 1 3. Translate again to restore the coordinates of (a,b): x 3 = x 2 + a y 3 = y 2 + b (a,b) X Y (x,y)

CGPage: 10 東吳資訊科學 江清水 Algebraic representations for transformations are very limited: (1) A special procedure is need for each basic transformation and other known concatenated forms. (2) It is difficult to provide general transformation capabilities in algebraic form in the computer. (3) How can one find the inverse of a concatenated equation (to restore the original position, for example)?

CGPage: 11 東吳資訊科學 江清水 Let the point (x,y) be a row vector [x y]: x' = ax + by and y' = cx + dy can be expressed in the matrix equation: [x' y'] = [x y] * [ ] 2x2 Let P' = [x' y'] and P = [x y], this becomes the matrix equation: P' = P * T where P' =[x' y'], P = [x y], T = Consider three basic transformations, can we find a "T" for each? What about translations? X'=X+Tx, Y'=Y+Ty No, P' =[x' y']=[x y] [ ] +[T x T y ]=P*T+Q What about scaling? X'=Sx*X, Y'=Sy*Y Yes, P' =[x' y']=[x y] [ ] =P*T What about rotation? x'=xcos  -ysin , y'=xsin  +ycos  Yes, P' =[x' y']=[x y] [ ] a c b d [ ] S x 0 0 S y cos  sin  -sin  cos 

CGPage: 12 東吳資訊科學 江清水 3.4 Homogeneous Coordinates Let the point (x,y) be a row vector [x y 1]: x' = ax + by + e and y' = cx + dy + f can be expressed in the matrix equation: [x' y' 1] = [x y 1] [ ] 3x3 This becomes the matrix equation P' = P * T where P'=[x' y' 1], P= [x y 1], T= [ ] Now, can we find a "T" for each transformation? What about translations? Yes, T= [ ] What about scaling? Yes, T= [ ] What about rotation? Yes, T= [ ]

CGPage: 13 東吳資訊科學 江清水 To check, what should the matrix be if we: (1) translate by (0,0) ? P'=P* [ ] =P* [ ] =P (2) scale by (1,1) ? P'=P* [ ] =P* [ ] =P (3) rotate by 0 o ? P'=P* [ ] =P* [ ] =P (4) rotate by 90 o ? P'=[x' y' 1]=[x y 1] [ ] =[1 0 1]* [ ] =[0 1 1] Draw the pictures and find the new vertices of the triangle for the following transformations (See the figure below) : (x, y) = (1, 0) (x ', y ' ) = (0, 1) X Y (2,2) (2,1) (4,1) A B C

CGPage: 14 東吳資訊科學 江清水 (5) translate A by (2,1). (6) translate A by (-2,1). (7) scale A by (2,1). (8) scale A by (-1,1). X Y (2,2) (2,1) (4,1) A B C X Y (2,2) (2,1) (4,1) A B C X Y (2,2) (2,1) (4,1) A B C X Y (2,2) (2,1) (4,1) A B C

CGPage: 15 東吳資訊科學 江清水 (9) scale A by (1,0). (10) scale A by (0,0). (11) rotate A by 0 o. (12) rotate A by 90 o. X Y (2,2) (2,1) (4,1) A B C X Y (2,2) (2,1) (4,1) A B C X Y (2,2) (2,1) (4,1) A B C X Y (2,2) (2,1) (4,1) A B C

CGPage: 16 東吳資訊科學 江清水 Concatenation is easy now. Consider our scaling example: Example: We want to reduce the size or the box, without changing the position of point (a, b) Functional form and matrix form for each transformations: (1) translate: T(-a,-b) (2) scale : S(S x,S y ) (3) translate: T(a,b) (a,b) Y (x, y) X 3.5 Composite 2D Transformation

CGPage: 17 東吳資訊科學 江清水 Combining the matrix equations: P 3 =P 2 * T (-a,-b)=(P 1 *S(S x, S y ) )*T(a, b) =P*T(-a, -b) *S(S x, S y )*T(a, b) Multiply the matrices : Now, the matrix equation is : or, in algebraic form : Thus, a single 3x3 matrix can represent any combination of basic transformations in a simple form.