Computer Graphics Lecture 18 3-D Transformations-II Taqdees A

Slides:



Advertisements
Similar presentations
3D Transformations Assist. Prof. Dr. Ahmet Sayar
Advertisements

Computer Graphics: 3D Transformations
COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Geometric Transformations
Three Dimensional Modeling Transformations
1 Computer Graphics Chapter 6 2D Transformations.
2D TRANSFORMATIONS.
CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
2D Transformations x y x y x y. 2D Transformation Given a 2D object, transformation is to change the object’s Position (translation) Size (scaling) Orientation.
2D Transformations Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
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.
Transformation of Graphics
2D Transformation of Graphics
Part7: Geometric Transformations
 2D Transformations 2D Transformations  Translation Translation  Rotation Rotation  Scaling Scaling.
Transformations Jehee Lee Seoul National University.
Computer Graphics 2D Transformations. 2 of 74 Contents In today’s lecture we’ll cover the following: –Why transformations –Transformations Translation.
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.
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 TRANFORMATIONS Presented By -Lakshmi Sahithi.
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.
Computer Graphics Lecture 11 2D Transformations I Taqdees A. Siddiqi
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
2D Transformations What is transformations? The geometrical changes of an object from a current state to modified state. Why the transformations is needed?
Computer Graphic 2 D Transformation.
CSCE 441 Computer Graphics: 2D Transformations
Computer Graphics Lecture 19 PROJECTIONS I Taqdees A. Siddiqi
Instructor: Dr. Shereen Aly Taie Basic Two-Dimensional Geometric Transformation 5.2 Matrix Representations and Homogeneous Coordinates 5.3 Inverse.
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
Transformations Review 4/18/2018 ©Babu 2009.
Computer Graphics 2D Transformations
Lecture 10 Geometric Transformations In 3D(Three- Dimensional)
Geometric Transformations
Transformations Objectives
Geometric Transformations Hearn & Baker Chapter 5
2D TRANSFORMATIONS.
2D Transformations By: KanwarjeetSingh
2D Geometric Transformations
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics Transformations.
Review: Transformations
3D Transformation.
Computer Graphics 3D Transformations
3D Geometric Transformations
Introduction to Computer Graphics CS 445 / 645
Review: Transformations
Lecture 7 Geometric Transformations (Continued)
2D Transformations y y x x y x.
Computer Graphics Transformations
Three-Dimensional Graphics
Line and Character Attributes 2-D Transformation
Computer Graphics Lecture 12 2D Transformations II Taqdees A
Transformations in 3 Dimensions CS /28/2018 Dr. Mark L. Hornick
Three-Dimensional Graphics
Geometric Transformations
Transformations Ed Angel
Geometric Objects and Transformations (II)
Transformations Ed Angel Professor Emeritus of Computer Science
CSCE441: Computer Graphics 2D/3D Transformations
Isaac Gang University of Mary Hardin-Baylor
TWO DIMENSIONAL TRANSFORMATION
Presentation transcript:

Computer Graphics Lecture 18 3-D Transformations-II Taqdees A Computer Graphics Lecture 18 3-D Transformations-II Taqdees A. Siddiqi cs602@vu.edu.pk

Rotation Rotation is the process of moving a point in space in a non-linear manner

Normalization Note that the process of moving the points so that the POV is at the origin looking down the +Z axis is called normalization.

For Rotation Rotating a point requires that we know: 1)  the coordinates for the point, and 2)  the rotation angles

We need to know three different angles: How far to rotate around the X axis(YZ rotation, or “pitch”) How far to rotate around the Y axis (XZ rotation, or “yaw”) How far to rotate around the Z axis (XY rotation, or “roll”)

Rotating a Point

Repositions an object along a circular path in xy-plane Rotation Angle θ Rotation Point (xr, yr) θ is +ve  counterclockwise rotation θ is -ve  clockwise rotation θ is zero  ?

For simplicity, consider the pivot at origin and rotate point P (x,y) where x = r cosФ and y = r sinФ If rotated by θ then: x′ = r cos(Ф + θ) = r cosФ cosθ – r sinФ sinθ and y′ = r sin(Ф + θ) = r cosФ sinθ + r sinФ cosθ

Replacing r cosФ with x and r sinФ with y, we have: x′ = x cosθ – y sinθ and y′ = x sinθ + y cosθ

Column vector representation: P′ = R . P Where

Rotation: Homogeneous Coordinates The rotation can now be expressed using homogeneous coordinates as: Abbreviated as: P’ = R (θ) . P

… Now in 3D Rotation can be about any of the three axes: About z-axis (i.e. in xy plane) About x-axis (i.e. in yz plane) About y-axis (i.e. in xz plane)

Roll : around z-axis

Pitch: around x-axis

Yaw: around y-axis

Rotation about z-axis (i.e. in xy plane): x′ = x cosθ – y sinθ y′ = x sinθ + y cosθ z’ = z

Cyclic Permutations of Coordinate Axes Alright, but what about rotations w.r.t. other axes? Cyclic Permutations of Coordinate Axes

Cyclic permutation

Rotation about x-axis (i.e. in yz plane): x′ = x y′ = y cosθ – z sinθ z′ = y sinθ + z cosθ

Rotation about y-axis (i.e. in xz plane): x′ = z sinθ + x cosθ y ′ = y z′ = z cosθ – x sinθ

Matrix Representations

Rotation about z-axis P` = Rz(θ) . P

Rotation about x-axis P` = Rx(θ) . P

Rotation about y-axis P` = Ry(θ) . P

Example Let's manually rotate the point (2,0,0) 45 degrees clockwise about the z axis

Around arbitrary axis

Around arbitrary axis

Around arbitrary axis

Around arbitrary axis

Composite Transformation Now you can take an object and apply a sequence of transformations to it to make it do whatever you want. All you need to do is figure out the sequence of transformations needed and then apply the sequence to each of the points in the model.

As an example, let's say you want to rotate an object sitting at a certain point p around its z axis. You would perform the following sequence of transformations to achieve this

Around arbitrary axis

Scaling

Scaling an object changes its size and repositions the object relative to the coordinate origin. If the transformation parameters are not all equal, relative dimensions in the object are changed

Coordinate transformations for scaling relative to the origin are X` = X . Sx Y` = Y . Sy Z` = Z . Sz

1) Uniform Scaling 2) Differential Scaling

Uniform Scaling We preserve the original shape of an object with a uniform scaling ( Sx = Sy = Sz)

Differential Scaling We do not preserve the original shape of an object with a differential scaling ( Sx <> Sy <> Sz)

Scaling w.r.t. Origin

Scaling w.r.t. a fixed position Scaling with respect to a selected fixed position (Xf,Yf,Zf) can be represented with the transformation sequence: 

Transformation sequence Translate the fixed point to the origin. Scale the object relative to the coordinate origin Translate the fixed point back to its original position

Composite Transformation

Composite Transformation

Reflection A reflection can be performed relative to a selected reflection axis or with respect to a selected reflection plane.

In general, three-dimensional reflection matrices are set up similarly to those for two dimensions. Reflections relative to a given axis are equivalent to 180 degree rotations.

Reflection of points relative to the X axis

Reflection of points relative to the Y axis

Reflection of points relative to the xy plane

Shears

Shearing transformations can be used to modify object shapes

As an example of three-dimensional shearing, the following transformation produces a z-axis shear:

Y-axis shear

X-axis shear

Computer Graphics Lecture 18

Rotation w.r.t. y-axis: P` = Ry(θ) . P

From the drawing and elementary trigonometry, we can say: cos(q) = X/D or D = X /cos(q) sin(q) = Y/D or D = Y/sin(q)

where D = hypotenuse = length of vector from origin to (x,y) To rotate to our new point, we just add m to q For our new point, we know that: cos ( q + m) = X` / D sin ( q + m) = Y`/ D

X` = D * cos ( q + m ) Y` = D * sin ( q + m )

We can expand these using the addition formulas

cos ( q + m ) = cos ( q ) * cos ( m ) – sin( q ) * sin ( m )

X` = D * cos (q + m ) =D*[cos ( q ) * cos( m ) – sin ( q ) * sin ( m )] =D*cos ( q ) * cos ( m ) – D*sin ( q )*sin( m )

But we noted that D= X / cos(q) D= Y/sin(q) so we can substitute them in :

X`= [X / cos(q)] * cos (q) * cos(m) – [Y/sin(q) ] *sin(q) * sin(m) = X * cos(m) – Y*sin(m)

And we can follow a similar approach to find Y`

Y` = D*sin(q+m) = D*[sin(q) * cos(m) + cos(q) * sin(m)] = D*sin(q) * cos(m) + D*cos(q) * sin(m)

Y` = [ X/ cos(m)] * sin(q ) *cos(m) + [Y/sin(m) ] * cos(q ) * sin(m) = X * sin(q) + Y*cos(q)

So to rotate the point (x,y,z) around the Z axis through an angle of M degrees, we use: X` = x*cos(M) – y*sin(M) Y` = x*sin(M) + y*cos(M) Z` = z

You see, in the above, we rotate M degrees around the Z axis (“roll”), moving from the +X axis to the +Y axis But if you look down on the XY plane from the +Z axis, this is a –M degree rotation!

you can go through a similar process to calculate the rotation formula for rotating around the X axis (“pitch”) and around the Y axis (“yaw”), ending up with:

Roll ( rotate around Z axis): x` = x * cos(m ) + y* sin(m) y` = y* cos(m) – x * sin(m) z` = z

Pitch ( rotate around the X axis): x` = x y` = y * cos(m) + z * sin(m) z` = z * cos(m) – y*sin(m)

Yaw ( rotate about the Y axis): x` = x * cos(m) – z * sin(m) y` = y; z` = x * sin(m) + z * cos(m)

Using Matrices for Rotation

Roll (rotate about the Z axis) | cos(m) sin(m) 0 0 | | -sin(m) cos(m) 0 0 | | 0 0 1 0 | | 0 0 0 1 | or P` = Rz(m) . P

Pitch (rotate about the X axis) | 1 0 0 0 | | 0 cos(m) sin(m) 0 | | 0 -sin(m) cos(m) 0 | | 0 0 0 1 | or P` = Rx(m) . P

Yaw (rotate about the Y axis) | cos(m) 0 -sin(m) 0| | 0 1 0 0| | sin(m) 0 cos(m) 0| | 0 0 0 1|  or P` = Ry(m) . P