Computer Graphics Lecture 17 3-D Transformations-I Taqdees A. Siddiqi

Slides:



Advertisements
Similar presentations
6.4 Best Approximation; Least Squares
Advertisements

Lecture 7 2D Transformation. What is a transformation? Exactly what it says - an operation that transforms or changes a shape (line, shape, drawing etc.)
Computer Graphics Lecture 4 Geometry & Transformations.
Transformations We want to be able to make changes to the image larger/smaller rotate move This can be efficiently achieved through mathematical operations.
Geometric Transformations
Chapter 4.1 Mathematical Concepts
Linear Algebra and SVD (Some slides adapted from Octavia Camps)
CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu.
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Coordinate System VECTOR REPRESENTATION 3 PRIMARY COORDINATE SYSTEMS: RECTANGULAR CYLINDRICAL SPHERICAL Choice is based on symmetry of problem Examples:
CS 450: Computer Graphics 2D TRANSFORMATIONS
VECTORS AND THE GEOMETRY OF SPACE 12. VECTORS AND THE GEOMETRY OF SPACE So far, we have added two vectors and multiplied a vector by a scalar.
Mathematical Fundamentals
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Vectors in 2-Space and 3-Space II
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Vectors. Definitions Scalar – magnitude only Vector – magnitude and direction I am traveling at 65 mph – speed is a scalar. It has magnitude but no direction.
Chapter 4.1 Mathematical Concepts
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.
Computer Graphics Bing-Yu Chen National Taiwan University.
Prof. David R. Jackson ECE Dept. Fall 2014 Notes 6 ECE 2317 Applied Electricity and Magnetism Notes prepared by the EM Group University of Houston 1.
Lecture Notes: Computer Graphics.
Part7: Geometric Transformations
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
H.Melikyan/12001 Vectors Dr.Hayk Melikyan Departmen of Mathematics and CS
Transformations Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
©Larry F. Hodges (modified by Amos Johnson) 1 3-D Mathematical Preliminaries & Transformations.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Transformation.
Geometric Transformations
GEOMETRIC TRANFORMATIONS Presented By -Lakshmi Sahithi.
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
CSCI 425/ D Mathematical Preliminaries. CSCI 425/525 2 Coordinate Systems Z X Y Y X Z Right-handed coordinate system Left-handed coordinate system.
Fall 2004CS-321 Dr. Mark L. Hornick 1 2-D Transformations World Coordinates Local/Modelling Coordinates x y Object descriptions Often defined in model.
AP Physics C – Vectors. 1.1 Vectors. Vectors are mathematical quantities indicated by arrows. The length of the arrow denotes the magnitude or the size.
Computer Graphics Matrices
Graphics Lecture 2: Slide 1 Lecture 2 Transformations for animation.
Digital Image Processing Additional Material : Imaging Geometry 11 September 2006 Digital Image Processing Additional Material : Imaging Geometry 11 September.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
Chapter 3 Lecture 5: Vectors HW1 (problems): 1.18, 1.27, 2.11, 2.17, 2.21, 2.35, 2.51, 2.67 Due Thursday, Feb. 11.
Vectors for Calculus-Based Physics AP Physics C. A Vector …  … is a quantity that has a magnitude (size) AND a direction.  …can be in one-dimension,
Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi
Computer Graphics Lecture 11 2D Transformations I Taqdees A. Siddiqi
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry "Old Henry And His Old Aunt" Defined using right triangle  x y h.
Lecture 10 Geometric Transformations In 3D(Three- Dimensional)
Vectors for Calculus-Based Physics
Vectors AP Physics C.
General Physics 101 PHYS Dr. Zyad Ahmed Tawfik
Math Fundamentals Maths revisit.
Geometric Transformations Hearn & Baker Chapter 5
Computer Graphics Lecture 18 3-D Transformations-II Taqdees A
GEOMETRIC TRANSFORMATIONS Yingcai Xiao
3D Geometric Transformations
By: Engr. Hinesh Kumar Lecturer I.B.T, LUMHS, Jamshoro
Chapter 3: Vectors Reading Assignment: Chapter
Vectors for Calculus-Based Physics
Lecture 03: Linear Algebra
Physics VECTORS AND PROJECTILE MOTION
COMP 175: Computer Graphics February 9, 2016
C H A P T E R 3 Vectors in 2-Space and 3-Space
Computer Graphics Lecture 20
Chapter 3 Vectors.
Physics VECTORS AND PROJECTILE MOTION
Type to enter a caption. Computer Graphics Week 3 Lecture 1.
Translation in Homogeneous Coordinates
Presentation transcript:

Computer Graphics Lecture 17 3-D Transformations-I Taqdees A. Siddiqi

Definition of a 3D Point  A 3-D point is similar to its 2D counterpart; we simply add an extra component, Z, for the 3rd axis:  P = (x,y,z)

3D Point

Distance between Two 3D Points  The distance between two points (Ax,Ay,Az) and (Bx,By,Bz) can be found by again using the pythagorus theorem

Pythagorus Theorem  Distance between A and B = sqrt(dx*dx + dy*dy + dz*dz) where dx = Ax-Bx dy = Ay-By dz = Az-Bz

Definition of a 3D Vector  Like it's 2D counterpart, a vector can be thought of in two ways: either a point at (x,y,z) or a line going from the origin (0,0,0) to the point (x,y,z).

Length of vector  To calculate the length of a vector we simply calculate the distance between the origin and the point at (x,y, z) :

Length of vector length = | (x,y,z) – (0,0,0) | = sqrt( (x-0)*(x-0) + (y-0)*(y-0) + (z-0)* (z-0) ) = sqrt(x*x + y*y + z*z)

Unit Vector  Often in 3D computer graphics you need to convert a vector to a unit vector, i.e. a vector that points in the same direction but has a length of 1.

Finding Unit Vector  This is done by simply dividing each component by the length:

Finding Unit Vector  Let (x,y,z) be our vector  length = sqrt(x*x + y*y + z*z)  Unit vector = | x, y, z | | length length length | Where length = |(x,y,z)|

 Note that if the vector is already a unit vector then the length will be 1, and the new values will be the same as the old ones.

3D Vector Addition Adding vector to point point.x = point.x + vector.x; point.y = point.y + vector.y; point.z = point.z + vector.z;

Operations between Points and Vectors  point – point => vector  point + point = point – ( - point) => vector  vector – vector => vector

Operations between Points and Vectors  vector + vector => vector  point + vector => point  point – vector = point + (-vector) => point

Multiplying: Scalar Multiplication  Multiplying a vector by a scalar ( a number with no units) :  Vector.x = Vector.x * Scalar  Vector.y = Vector.y * Scalar  Vector.z = Vector.z * Scalar

Example  A vector of length 4  if multiplied by 2.5  Yields a vector of length 10  in the same direction as original

Example  A vector of length 4  If multiplied by -2.5 instead,  Yields a vector of length 10;  but in the direction opposite to original

Vector Multiplication 1.Vectors can be multiplied in two ways: 1.Dot Product 2.Cross Product

Dot Product  The dot product of two vectors A & B is defined by the formula:  A * B = A.x * B.x + A.y * B.y + A.z * B.z

Another definition of Dot Product A * B = |A| * |B| * cos(θ) Where θ is the angle between the two vectors

Properties of Cos(θ) cos(θ) > 0 if θ 270 o cos(θ) < 0 if θ is > 90 o and θ < 270 o cos(θ) = 0 if θ = 90 o or θ = 270 o

Use of Dot Product  If point of view is at (px,py,pz).  and is looking along the vector (vx,vy,vz),  we have a point P (x,y,z) in space.

 we want to know if P is visible from the point-of-view (POV), or if P is “behind” the POV

Dot Product - Example  Point3D pov;  Vector3D povDir;  Point3D test;  Vector3D vTest  float dotProduct;

Example cont…  vTest.x = pov.x – test.x;  vTest.y = pov.y – test.y;  vTest.z = pov.z – test.z;

Example cont… dotProduct = vTest.x * povDir.x + vTest.y * povDir.y + vTest.z * povDir.z

if(dotProduct > 0)  point is “in front of “ POV  else if (dotProduct < 0)  point is “behind” POV  else point is orthogonal to the POV direction

Cross Product  for Vectors A, B  A X B = (A.y * B.z – A.z * B.y, A.z * B.x – A.x * B.z, A.x * B.y – A.y * B.x )

 This formula for A x B came from the determinate of order 3 of the matrix: | X Y Z | |A.xA.y A.z| |B.xB.y B.z|

Cross Product for physicists  |A x B| = |A| * |B| sin(θ)  Where θ is the angle between the two vectors

A Question  A static set of 3D points or other geometric shapes on screen are not very interesting, are they ?

Transformations

 The process of moving points in space is called transformation

Types of Transformation  Translation  Rotation  Scaling  Reflection  Shearing

Translation  Translation is used to move a point, or a set of points, linearly in space

 Translation Distances t x, t y, t z  For point P(x,y,z) after translation we have P′(x′,y′,z′)  x′ = x + t x, y′ = y + t y, z′ = z + t z (t x, t y, t z ) is Translation vector

Now x′ = x + t x, y′ = y + t y and z′ = z + t z can be expressed as a single matrix equation: P′ = P + T Where P =P′ = T =

3D Translation Example  you may want to move a point “3 meters east, -2 meters up, and 4 meters north.”

Steps for Translation  Point3D point = (0, 0, 0)  Vector3D vector = (10, -3, 2.5)  Adding vector to point

Steps for Translation  point.x = point.x + vector.x;  point.y = point.y + vector.y;  point.z = point.z + vector.z;  And finally we have translated point

Abbreviated as: P’ = T (t x, t y, t z ). P Homogeneous Coordinates

Computer Graphics Lecture 17