0% found this document useful (0 votes)
29 views57 pages

Ch. 4 3-D Transformations

Uploaded by

Aneesh Shinde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views57 pages

Ch. 4 3-D Transformations

Uploaded by

Aneesh Shinde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 57

3-D Transformations

• Introduction of 3-D Transformations


• Types of 3-D Transformations
• Matrix Representations of 3D Transformation
• Compositions of 3D Transformation
Three Dimensional Transformations
• The three-dimensional transformations are extensions of two-
dimensional transformation. In 2D two coordinates are used,
i.e., x and y whereas in 3D three co-ordinates x, y, and z are
used.
• For three dimensional images and objects, three-dimensional
transformations are needed. These are translations, scaling, and
rotation. These are also called as basic transformations are
represented using matrix. More complex transformations are
handled using matrix in 3D.
• The 2D can show two-dimensional objects. Like the Bar chart,
pie chart, graphs. But some more natural objects can be
represented using 3D. Using 3D, we can see different shapes of
the object in different sections.
3D Geometry
Three dimension system has three axis x, y, z. The orientation
of a 3D coordinate system is of two types. Right-handed
system and left-handed system.
In the right -handed system thumb of right- hand points to
positive z-direction and left- hand system thumb point to
negative two directions. Following figure show right-hand
orientation of the cube.
• Using right-handed system co-ordinates of corners A, B, C, D
of the cube
Point A x, y, z
Point B x, y, 0
Point C 0, y, 0
Point D 0, y, z
Three Dimensional Transformations
The geometric transformations play a vital role in generating
images of three Dimensional objects with the help of these
transformations. The location of objects relative to others can be
easily expressed. Sometimes viewpoint changes rapidly, or
sometimes objects move in relation to each other. For this
number of transformation can be carried out repeatedly.
Different types of transformation:
Rotation
Translation
Reflection
Shearing
Scaling
3-D Translation
• It is the movement of an object from one position to another
position. Translation is done using translation vectors. There
are three vectors in 3D instead of two. These vectors are in x,
y, and z directions. Translation in the x-direction is represented
using Tx. The translation is y-direction is represented using T y.
The translation in the z- direction is represented using T z.
• If P is a point having co-ordinates in three directions (x, y, z) is
translated, then after translation its coordinates will be
(x1 y1 z1) after translation. Tx Ty Tz are translation vectors in x,
y, and z directions respectively.
• x1=x+ Tx
y1=y+Ty
z1=z+ Tz
Translation of Point and Cube
Three-dimensional transformations are performed by
transforming each vertex of the object. If an object has five
corners, then the translation will be accomplished by translating
all five points to new locations.
• Following:
• figure 1 shows the translation of point
• figure 2 shows the translation of the cube.
• Matrix for translation
Example of 3-D Translation
Example: A point has coordinates in the x, y, z direction i.e., (5, 6, 7). The
translation is done in the x-direction by 3 coordinate and y direction. Three
coordinates and in the z- direction by two coordinates. Shift the object.
Find coordinates of the new position.
Solution: Co-ordinate of the point are (5, 6, 7)
Translation vector in x direction = 3
Translation vector in y direction = 3
Translation vector in z direction = 2

Multiply co-ordinates of point with translation matrix:

= [5+0+0+30+6+0+30+0+7+20+0+0+1] = [8991]

x becomes x1=8
y becomes y1=9
z becomes z1=9
• Multiply co-ordinates of point with translation matrix
3D Scaling in Computer Graphics-
In computer graphics, scaling is a process of modifying or
altering the size of objects.
Scaling may be used to increase or reduce the size of object.
Scaling subjects the coordinate points of the original object to
change.
Scaling factor determines whether the object size is to be
increased or reduced.
If scaling factor > 1, then the object size is increased.
If scaling factor < 1, then the object size is reduced.
Consider a point object O has to be scaled in a
3D plane.
Let-
Initial coordinates of the object O = (Xold, Yold,Zold)
• Scaling factor for X-axis = Sx
• Scaling factor for Y-axis = Sy
• Scaling factor for Z-axis = Sz
• New coordinates of the object O after scaling = (Xnew, Ynew, Znew)

This scaling is achieved by using the following scaling equations-


• Xnew = Xold x Sx
• Ynew = Yold x Sy
• Znew = Zold x Sz
PRACTICE PROBLEMS BASED ON 3D SCALING IN
COMPUTER GRAPHICS-
Given a 3D object with coordinate points A(0, 3, 3), B(3, 3, 6), C(3, 0, 1), D(0, 0, 0). Apply
the scaling parameter 2 towards X axis, 3 towards Y axis and 3 towards Z axis and
obtain the new coordinates of the object.
Solution-
Given-
Old coordinates of the object = A (0, 3, 3), B(3, 3, 6), C(3, 0, 1), D(0, 0, 0)
• Scaling factor along X axis = 2
• Scaling factor along Y axis = 3
• Scaling factor along Z axis = 3

For Coordinates A(0, 3, 3)


Let the new coordinates of A after scaling = (Xnew, Ynew, Znew).

Applying the scaling equations, we have-


• Xnew = Xold x Sx = 0 x 2 = 0
• Ynew = Yold x Sy = 3 x 3 = 9
• Znew = Zold x Sz = 3 x 3 = 9

Thus, New coordinates of corner A after scaling = (0, 9, 9).


For Coordinates B(3, 3, 6)
Let the new coordinates of B after scaling = (Xnew, Ynew, Znew).
Applying the scaling equations, we have-
• Xnew = Xold x Sx = 3 x 2 = 6
• Ynew = Yold x Sy = 3 x 3 = 9
• Znew = Zold x Sz = 6 x 3 = 18

Thus, New coordinates of corner B after scaling = (6, 9, 18).

For Coordinates C(3, 0, 1)


Let the new coordinates of C after scaling = (Xnew, Ynew, Znew).
Applying the scaling equations, we have-
• Xnew = Xold x Sx = 3 x 2 = 6
• Ynew = Yold x Sy = 0 x 3 = 0
• Znew = Zold x Sz = 1 x 3 = 3

Thus, New coordinates of corner C after scaling = (6, 0, 3)


For Coordinates D(0, 0, 0)

Let the new coordinates of D after scaling = (Xnew, Ynew, Znew).

Applying the scaling equations, we have-


• Xnew = Xold x Sx = 0 x 2 = 0
• Ynew = Yold x Sy = 0 x 3 = 0
• Znew = Zold x Sz = 0 x 3 = 0

Thus, New coordinates of corner D after scaling = (0, 0, 0).


3D Reflection in Computer
Graphics-
 Reflection is the kind of rotation where the angle of rotation is 180 degree.
 The reflected object is always formed on the other side of mirror.
 The size reflected object is same as the size of original object.

Consider a point object O has to be reflected in a 3D plane.


Let-
• Initial coordinates of the object O = (Xold, Yold, Zold)
• New coordinates of the reflected object O after reflection = (Xnew, Ynew,Znew)

In 3 dimensions, there are 3 possible types of reflection-


• Reflection relative to XY plane
• Reflection relative to YZ plane
• Reflection relative to XZ plane
1. Reflection Relative to XY Plane:
This reflection is achieved by using the following reflection
equations-
• Xnew = Xold
• Ynew = Yold
• Znew = -Zold

2. Reflection Relative to YZ Plane:


This reflection is achieved by using the following reflection
equations-
• Xnew = -Xold
• Ynew = Yold
• Znew = Zold
3. Reflection Relative to XZ Plane:
This reflection is achieved by using the following reflection
equations-
• Xnew = Xold
• Ynew = -Yold
• Znew = Zold
PRACTICE PROBLEMS BASED ON 3D
REFLECTION IN COMPUTER GRAPHICS-
Problem-01:
Given a 3D triangle with coordinate points A(3, 4, 1), B(6, 4, 2), C(5, 6, 3). Apply the
reflection on the XY plane and find out the new coordinates of the object.
Solution-
Given-
• Old corner coordinates of the triangle = A (3, 4, 1), B(6, 4, 2), C(5, 6, 3)
• Reflection has to be taken on the XY plane

For Coordinates A(3, 4, 1)


Let the new coordinates of corner A after reflection = (X new, Ynew, Znew).
Applying the reflection equations, we have-
• Xnew = Xold = 3
• Ynew = Yold = 4
• Znew = -Zold = -1

Thus, New coordinates of corner A after reflection = (3, 4, -1).


For Coordinates B(6, 4, 2)Le

Let the new coordinates of corner B after reflection = (X new, Ynew, Znew).
Applying the reflection equations, we have-
• Xnew = Xold = 6
• Ynew = Yold = 4
• Znew = -Zold = -2
Thus, New coordinates of corner B after reflection = (6, 4, -2).

For Coordinates C(5, 6, 3)


Let the new coordinates of corner C after reflection = (X new, Ynew, Znew).
Applying the reflection equations, we have-
• Xnew = Xold = 5
• Ynew = Yold = 6
• Znew = -Zold = -3

Thus, New coordinates of corner C after reflection = (5, 6, -3).


Thus, New coordinates of the triangle after reflection = A (3, 4, -1), B(6, 4, -2), C(5, 6, -3).
Rotation
A rotation is a transformation in which the object is rotated
about a fixed point.
The direction of rotation can be clockwise or anticlockwise.
The fixed point in which the rotation takes place is called
the center of rotation. The amount of rotation made is called
the angle of rotation.

For any rotation, we need to specify the center, the angle and
the direction of rotation.
Cont…
Consider a point object O has to be rotated from one angle to
another in a 3D plane.
Let-
• Initial coordinates of the object O = (Xold, Yold, Zold)
• Initial angle of the object O with respect to origin = Φ
• Rotation angle = θ
• New coordinates of the object O after rotation = (Xnew, Ynew, Znew)

In 3 dimensions, there are 3 possible types of rotation-


• X-axis Rotation
• Y-axis Rotation
• Z-axis Rotation
For X-Axis Rotation-
This rotation is achieved by using the following rotation equations-
• Xnew = Xold
• Ynew = Yold x cosθ – Zold x sinθ
• Znew = Yold x sinθ + Zold x cosθ
In Matrix form, the above rotation equations may be represented
next:

For Y-Axis Rotation-


This rotation is achieved by using the following rotation equations-
• Xnew = Zold x sinθ + Xold x cosθ
• Ynew = Yold
• Znew = Yold x cosθ – Xold x sinθ
For Z-Axis Rotation-
This rotation is achieved by using the following rotation
equations-
• Xnew = Xold x cosθ – Yold x sinθ
• Ynew = Xold x sinθ + Yold x cosθ
• Znew = Zold

In Matrix form, the above rotation equations may be


represented as-
PRACTICE PROBLEMS BASED ON 3D
ROTATION
Given a homogeneous point (1, 2, 3). Apply rotation 90 degree towards X, Y and Z axis and
find out the new coordinate points.

Solution-
Given-
Old coordinates = (Xold, Yold, Zold) = (1, 2, 3)
Rotation angle = θ = 90º

For X-Axis Rotation-


Let the new coordinates after rotation = (Xnew, Ynew, Znew).

Applying the rotation equations, we have-


• Xnew = Xold = 1
• Ynew = Yold x cosθ – Zold x sinθ = 2 x cos90° – 3 x sin90° = 2 x 0 – 3 x 1 = -3
• Znew = Yold x sinθ + Zold x cosθ = 2 x sin90° + 3 x cos90° = 2 x 1 + 3 x 0 = 2

Thus, New coordinates after rotation = (1, -3, 2).


For Y-Axis Rotation-
Let the new coordinates after rotation = (Xnew, Ynew, Znew).

Applying the rotation equations, we have-


• Xnew = Zold x sinθ + Xold x cosθ = 3 x sin90° + 1 x cos90° = 3 x 1 + 1 x 0 = 3
• Ynew = Yold = 2
• Znew = Yold x cosθ – Xold x sinθ = 2 x cos90° – 1 x sin90° = 2 x 0 – 1 x 1 = -1
Thus, New coordinates after rotation = (3, 2, -1).

For Z-Axis Rotation-


Let the new coordinates after rotation = (Xnew, Ynew, Znew).

Applying the rotation equations, we have-


• Xnew = Xold x cosθ – Yold x sinθ = 1 x cos90° – 2 x sin90° = 1 x 0 – 2 x 1 = -2
• Ynew = Xold x sinθ + Yold x cosθ = 1 x sin90° + 2 x cos90° = 1 x 1 + 2 x 0 = 1
• Znew = Zold = 3

• Thus, New coordinates after rotation = (-2, 1, 3).
Rotate a point about an arbitrary axis
Rotation of a point in 3 dimensional space by theta about an
arbitrary axes defined by a line between two points P 1 = (x1,y1,z1)
and P2 = (x2,y2,z2) can be achieved by the following steps
(1) translate space so that the rotation axis passes through the
origin
(2) rotate space about the x axis so that the rotation axis lies in
the xz plane
(3) rotate space about the y axis so that the rotation axis lies
along the z axis
(4) perform the desired rotation by theta about the z axis
(5) apply the inverse of step (3)
(6) apply the inverse of step (2)
(7) apply the inverse of step (1)
Note
• If the rotation axis is already aligned with the z axis then
steps 2, 3, 5, and 6 need not be performed.
• In all that follows a right hand coordinate system is assumed
and rotations are positive when looking down the rotation axis
towards the origin.
• Symbols representing matrices will be shown in bold text.
• The inverse of the rotation matrices below are particularly
straightforward since the determinant is unity in each case.
• All rotation angles are considered positive if anticlockwise
looking down the rotation axis towards the origin.
Perspective Transformation
• When human eyes see near things they look bigger as compare
to those who are far away. This is called perspective in a
general way. Whereas transformation is the transfer of an
object e.t.c from one state to another.
• So overall, the perspective transformation deals with the
conversion of 3d world into 2d image. The same principle on
which human vision works and the same principle on which
the camera works.
• We will see in detail about why this happens, that those objects
which are near to you look bigger, while those who are far
away, look smaller even though they look bigger when you
reach them.
Frame of reference:
Frame of reference is basically a set of values in relation to which we
measure something.
5 frames of reference
In order to analyze a 3d world/image/scene, 5 different frame of
references are required.
• Object
• World
• Camera
• Image
• Pixel
Object coordinate frame
Object coordinate frame is used for modeling objects. For example,
checking if a particular object is in a proper place with respect to the
other object. It is a 3d coordinate system.
World coordinate frame
World coordinate frame is used for co-relating objects in a 3
dimensional world. It is a 3d coordinate system.
Camera coordinate frame
Camera co-ordinate frame is used to relate objects with respect
of the camera. It is a 3d coordinate system.
Image coordinate frame
It is not a 3d coordinate system, rather it is a 2d system. It is used
to describe how 3d points are mapped in a 2d image plane.
Pixel coordinate frame
It is also a 2d coordinate system. Each pixel has a value of pixel
co ordinates.
What is Projection?
• It is the process of converting a 3D object into a 2D
object. It is also defined as mapping or transformation of
the object in projection plane or view plane. The view
plane is displayed surface.
Perspective Projection
In perspective projection farther away object from the viewer, small it
appears. This property of projection gives an idea about depth. The artist
use perspective projection from drawing three-dimensional scenes.
Two main characteristics of perspective are vanishing points and
perspective foreshortening. Due to foreshortening object and lengths
appear smaller from the center of projection. More we increase the
distance from the center of projection, smaller will be the object appear.

Vanishing Point
It is the point where all lines will appear to meet. There can be one point,
two point, and three point perspectives.
One Point: There is only one vanishing point as shown in fig (a)
Two Points: There are two vanishing points. One is the x-direction and
other in the y -direction as shown in fig (b)
Three Points: There are three vanishing points.
Important terms related to perspective

1. View plane: It is an area of world coordinate system which is


projected into viewing plane.
2. Center of Projection: It is the location of the eye on which
projected light rays converge.
3. Projectors: It is also called a projection vector. These are
rays start from the object scene and are used to create an
image of the object on viewing or view plane.
Parallel Projection
• Parallel Projection use to display picture in its true shape and
size. When projectors are perpendicular to view plane then is
called orthographic projection. The parallel projection is
formed by extending parallel lines from each vertex on the
object until they intersect the plane of the screen. The point of
intersection is the projection of vertex.
• Parallel projections are used by architects and engineers for
creating working drawing of the object, for complete
representations require two or more views of an object using
different planes.
Orthographic Projection
In orthographic projection the direction of projection is normal
to the projection of the plane. There are three types of
orthographic projections −
• Front Projection
• Top Projection
• Side Projection

Oblique Projection
In oblique projection, the direction of projection is not normal to
the projection of plane. In oblique projection, we can view the
object better than orthographic projection.

You might also like