Download presentation

Presentation is loading. Please wait.

Published byStephen Bridewell Modified over 2 years ago

1
Computer Graphics Lecture 4 Geometry & Transformations

2
Computer Graphics 7/10/2008Lecture 42 Some Basics Basic geometric types. –Scalars s –Vectors v –Points p = p + s * v Transformations –Types of transformation: rotation, translation, scale. –Matrix representation –Order Geometric modelling –Hierarchical modelling –Polyhedral shapes.

3
Computer Graphics 7/10/2008Lecture 43 Transformations. What is a transformation? P=T(P) Why use them? Modelling - Create objects in natural/convenient coordinates - Multiple instances of a prototype shape - Kinematics of linkages/skeletons - robot animation Viewing –Windows and device independence –Virtual camera: parallel and perspective projections

4
Computer Graphics 7/10/2008Lecture 44 Types of Transformations Continuous (preserves neighbourhoods) One to one, invertible Classify by invariants or symmetries Isometry (distance preserved) –Reflections (interchanges left-handed and right- handed) –Rigid body motion: Rotations + Translations Similarity (preserves angles) –Uniform scale Affine (preserves parallel lines) –Non-uniform scales, shears or skews Collineation (lines remain lines) –Perspective Non-linear (lines become curves) –Twists, bends, warps, morphs,...

5
Computer Graphics 7/10/2008Lecture 45 2D Translations. P P’

6
Computer Graphics 7/10/2008Lecture 46 2D Scaling from the origin. P P’

7
Computer Graphics 7/10/2008Lecture 47 2D Rotation about the origin. y x r r P’(x’,y’) P(x,y)

8
Computer Graphics 7/10/2008Lecture 48 2D Rotation about the origin. y x r r P’(x’,y’) P(x,y) y x

9
Computer Graphics 7/10/2008Lecture 49 2D Rotation about the origin. y x r r P’(x’,y’) P(x,y) y x

10
Computer Graphics 7/10/2008Lecture 410 2D Rotation about the origin. Substituting for r : Gives us :

11
Computer Graphics 7/10/2008Lecture 411 2D Rotation about the origin. Rewriting in matrix form gives us :

12
Computer Graphics 7/10/2008Lecture 412 Transformations. Translation. –P=T + P Scale –P=S P Rotation –P=R P We would like all transformations to be multiplications so we can concatenate them express points in homogenous coordinates.

13
Computer Graphics 7/10/2008Lecture 413 Homogeneous coordinates Add an extra coordinate, W, to a point. –P(x,y,W). Two sets of homogeneous coordinates represent the same point if they are a multiple of each other. –(2,5,3) and (4,10,6) represent the same point. At least one component must be non-zero (0,0,0) is not defined. If W 0, divide by it to get Cartesian coordinates of point (x/W,y/W,1). If W=0, point is said to be at infinity.

14
Computer Graphics 7/10/2008Lecture 414 Homogeneous coordinates If we represent (x,y,W) in 3-space, all triples representing the same point describe a line passing through the origin. If we homogenize the point, we get a point of form (x,y,1) –homogenised points form a plane at W=1. P X Y W W=1 plane

15
Computer Graphics 7/10/2008Lecture 415 Translations in homogenised coordinates Transformation matrices for 2D translation are now 3x3.

16
Computer Graphics 7/10/2008Lecture 416 Concatenation. We perform 2 translations on the same point:

17
Computer Graphics 7/10/2008Lecture 417 Concatenation. Matrix product is variously referred to as compounding, concatenation, or composition

18
Computer Graphics 7/10/2008Lecture 418 Concatenation. Matrix product is variously referred to as compounding, concatenation, or composition. This single matrix is called the Coordinate Transformation Matrix or CTM.

19
Computer Graphics 7/10/2008Lecture 419 Properties of translations. Note : 3. translation matrices are commutative.

20
Computer Graphics 7/10/2008Lecture 420 Homogeneous form of scale. Recall the (x,y) form of Scale : In homogeneous coordinates :

21
Computer Graphics 7/10/2008Lecture 421 Concatenation of scales.

22
Computer Graphics 7/10/2008Lecture 422 Homogeneous form of rotation.

23
Computer Graphics 7/10/2008Lecture 423 Orthogonality of rotation matrices.

24
Computer Graphics 7/10/2008Lecture 424 Other properties of rotation.

25
Computer Graphics 7/10/2008Lecture 425 Types of transformations. Rotation and translation –Angles and distances are preserved –Unit cube is always unit cube –Rigid-Body transformations. Rotation, translation and scale. –Angles & distances not preserved. –But parallel lines are. –Affine transformations.

26
Computer Graphics 7/10/2008Lecture 426 3D Transformations. Use homogeneous coordinates, just as in 2D case. Transformations are now 4x4 matrices. We will use a right-handed (world) coordinate system - ( z out of page ). z (out of page) y x Note: Convenient to think of display as Being left-handed !! ( z into the screen )

27
Computer Graphics 7/10/2008Lecture 427 Translation in 3D. Simple extension to the 3D case:

28
Computer Graphics 7/10/2008Lecture 428 Scale in 3D. Simple extension to the 3D case:

29
Computer Graphics 7/10/2008Lecture 429 Rotation in 3D Need to specify which axis the rotation is about. z-axis rotation is the same as the 2D case.

30
Computer Graphics 7/10/2008Lecture 430 Rotation in 3D For rotation about the x and y axes:

31
Computer Graphics 7/10/2008Lecture 431 Rotation about an arbitrary axis? Hard! But we know how to rotate about the major axes. So turn required rotation into one about major axis. We need to translate arbitrary axis a to pass through origin, rotate to align with major axis, perform rotation, and rotate and translate back to original position. Say M z is the compound transformation to translate and rotate a to align with z-axis, then M z -1 is the reverse transformation required to restore a to its original position. Ignore translation for present, a passes through origin…..

32
Computer Graphics 7/10/2008Lecture 432 How do we define M? M transforms a into a vector along the z-axis, ie. Ma = k Construct the rotation matrix R as follows: R a ( ) = M -1 R z ( )M A suitable M -1 can be found with a little effort, ie. M -1 k = a First define axis direction a as a unit vector as: a = (a 1,a 2,a 3 ) = R z (- )R x (- )k = (sin sin , sin cos , cos ) Thus:and:

33
Computer Graphics 7/10/2008Lecture 433 Rotation about arbitrary axis So: M -1 = R z ( )R x ( ) and therefore: M = R x ( )R z ( ) And the full expression for a rotation about an arbitrary axis is: R a ( ) = T -1 R z ( )R x ( )R z ( )R x ( )R z ( )T Example: consider axis through origin, Thus = 45 o and 0 o and R a ( ) = R x (-45 o )R z ( )R x (45 o )

34
Computer Graphics 7/10/2008Lecture 434 Transformations of coordinate systems. Have been discussing transformations as transforming points. Useful to think of them as a change in coordinate system. Model objects in a local coordinate system, and transform into the world system. Unrealistic to think all objects are defined in the same coordinate system.

35
Computer Graphics 7/10/2008Lecture 435 Transformations of coordinate systems.

36
Computer Graphics 7/10/2008Lecture 436 Transform Left-Right, Right-Left Transforms between world coordinates and viewing coordinates. That is: between a right-handed set and a left- handed set.

Similar presentations

OK

Transformations Objectives Understand how transformations work in 2D and 3D Understand the concept of homogenous coordinate system Understand scene graphs.

Transformations Objectives Understand how transformations work in 2D and 3D Understand the concept of homogenous coordinate system Understand scene graphs.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on area of parallelogram games Ppt on disk formatting types Ppt on any one mathematician rene Ppt on artificial intelligence techniques for electrical applications Ppt on you can win if you want Ppt on subconscious mind power Ppt on poem the road not taken Ppt on history of badminton and rules Ppt online open school Ppt on tribal group of india