3 d scaling and translation in homogeneous coordinates
kstiwari103
4,787 views
18 slides
Apr 19, 2017
Slide 1 of 18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
About This Presentation
3D scaling and transformation basics
Size: 440.48 KB
Language: en
Added: Apr 19, 2017
Slides: 18 pages
Slide Content
3D Scaling and Transformation in Homogeneous Coordinates
In 3D graphics we are obviously dealing with a 3 Dimensional space; however, 3*3 matrices are not big enough to allow for some of the transformations that we want to perform, namely translation and perspective projection. In this presentation we are not dealing with the perspective projection.
Translation If we consider a point (x,y) in a 2D plane and we want to move it by d x in the x-axis and d y in the y-axis, we simply do, x’ = x + d x y’ = y + d y Moving into 3 dimensions is just as simple. In matrix form, we can write = =
Scaling If we consider a simple line segment of length 1 in 2D space and we want to multiply it by n, we simply do, x’ = x.n y’ = y.n Considering 3D scaling, in matrix form, the above equations can be written as, * =
Rotation The mathematical definition of rotation is, x’ = x.cos (t)- y.sin (t) y’ = x.sin (t)+ y.cos (t) This basically gives rise to following three matrices used to perform rotations; In the x-plane, R x =
In the y-plane, In the z-plane, The application of any of these to our object in 3D space will result in rotation in that direction. =
We know that a translation matrix can be combined with a translation matrix, scaling matrix with a scaling matrix and a rotation matrix with a rotation matrix. Since scaling and rotation matrices are 3*3 matrices, they can be combined as well, i.e. we can combine several scaling matrices with several rotation matrices. Translation matrices are additive in nature, therefore, we can not combine translation matrices with scaling and rotation matrices.
Combined Transformation Combined transformation can be represented as T( ) = Where, a, b, c, d, e, f are scalars. The above definition applies to 2D spaces, but is easily increased to 3D spaces. Basically, applying the function T to any object will translate, rotate and scale the object accordingly.
Homogeneous coordinates The question arises here is where do homogenous coordinates fit to all these. Basically, homogenous coordinates allow combine transformations to be easily represented by a matrix. The conversion to homogenous transformation is quite simple and allows for multiplication instead of addition when dealing with translation. Since 3*3 matrices are not big enough to allow some of the transformation , therefore the trick is go for 4*4 matrices that will help the transformation easy.
Scaling in terms of homogeneous coordinates For making 4*4 matrices, we only need to add one extra row and column. This will give us the scaling matrix as,
Rotation in terms of homogeneous coordinates For rotation we will use the matrices as follow: In x- plane,
In y plane, In z plane,
Representing a point using homogeneous coordinates Before understanding the translation in 4 dimensions, we first need to be able to represent those points. We will do it like so, by adding a 4 th coordinate, w: It is easy to see that ‘w’ is preserved in both the rotation and scaling calculations. To find our original point we can simply use, Hence we will often see w=1 which will represent a point in 3D geometry.
Translation in homogeneous coordinates Expanding the translation matrix to our new 4x4 size is a bit tricky but if we have a good understanding of the matrices we can figure it out. We don't want to multiply our point with a scalar; we want to add something to it. So we must preserve the ( x, y, z , w ) components . That's done by adding 1's in a diagonal (identity matrix .). Next we want to add a scalar to the coordinates. Since we have to multiply the matrices together in a ( xa + yb + zc + wd ) fashion we can use the fourth row. Making w = 1 in our point we get the correct result ( x + d ).
Hence we get the translation matrix in homogenous coordinates:
What happens if w ≠ 1 ? Well if w ≠ 1 then we can simply use our above calculation to find out the point we are working with. Consider the following however, [1 2 3 0.1]= [10 20 30 1] [1 2 3 0.001]= [1000 2000 3000 1] [1 2 3 0.000000001] = a point very far away. So that w tends to 0, we can start thinking about the point very far away; i.e at infinity. For example when we use lighting, we use w=1 to represent a positional light and w=0 to represent directional light. This also allows us to represent vectors and scalars in the same fashion, using w=1 represent a scalar value or a point and w=0 to represent a vector in that direction.
References Notes (http ://home10.inet.tele.dk/moelhave/tutors/3d/transformations/transformations.html) Homogeneous coordinates from Wikipedia, the free encyclopedia Elementary Linear Algebra by Howard Anton and Chris Rorres (Text book) Homogeneous Coordinates by Steve Land (2005 notes) Transformation matrices from DmWiki ( DevMaster.net