The document discusses 3D transformations and projections in computer aided design. It describes how translation, rotation, and scaling transformations are represented by homogeneous transformation matrices. It then explains how to perform an arbitrary 3D rotation of a point about a arbitrary axis using a series of steps. First, the point is translated so the axis passes through the origin. Then it is rotated about one axis so the axis vector is aligned with another axis. This results in the axis vector lying in a plane where the final rotation can place it along an axis.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
61 views14 pages
Lec 9
The document discusses 3D transformations and projections in computer aided design. It describes how translation, rotation, and scaling transformations are represented by homogeneous transformation matrices. It then explains how to perform an arbitrary 3D rotation of a point about a arbitrary axis using a series of steps. First, the point is translated so the axis passes through the origin. Then it is rotated about one axis so the axis vector is aligned with another axis. This results in the axis vector lying in a plane where the final rotation can place it along an axis.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14
Computer Aided Design
Dr. Anoop Chawla
Department of Mechanical Engineering Indian Institute of Technology, Delhi Lecture No. # 09 3D Transformations and Projection
We will be talking of 3 D transformations. In the last class we have introduced the different standard transformations, the first was translation and we said that translation can be captured by the transformation matrix which looks like this.
(Refer Slide Time: 00:01:06 min)
This is a 4 by 4 transformation matrix in homogenous coordinates which will translate a point by a vector t x t y t z . Then we said rotations and lets say rotation about the x axis would be captured by this matrix where c stands for cos theta, s stands for sin theta. Similarly we said rotation over the x axis would be captured by and rotation about the y axis would be captured by the transformation matrix which would look like this, about the y axis was 0 1 and then for scaling we mention a matrix like this where if we want to give a uniform scaling by a factor of s, we will only change the homogeneous coordinate.
1
(Refer Slide Time: 00:02:44 min)
If we want to give a non uniform scaling in the x, y and z direction values s x s y and s z in the three diagonal terms corresponding to the x y and z directions and we also mentioned that if we have a general 4 by 4 matrix like this and in this 4 by 4 matrix this corner term is the homogeneous coordinate which controls the uniform scaling. These three terms control the translation matrix, these 9 would control a different rotations, rotations about R x R y R z all three of these will be controlled by these 9 terms. Then these three diagonal terms will control the scaling in the x y and z directions. These three terms we have been just talked about these will control the projections and how they will control the projection that we will see later on.
So out of these 16 terms, these 13 terms will control the different transformations that we have already seen that is translation, rotation and scaling. Then the last time we also saw that if we want to reflect about any axis or about a plane that can be done by changing the scale factors in the three directions by giving either 1 2 or all of them values of minus 1, we can reflect about the about either an access, about the plane or about the origin. Today we will talk of rotating any arbitrary point about any arbitrary axis.
2
(Refer Slide Time: 00:05:45 min)
So if we have this, there are the xyz axis and we have any arbitrary point xyz. We want to rotate it about an axis which is passing through the point d e f and has directions cosines of a b c. That is a general arbitrary rotation about any axis. We already know how to rotate about the x axis, about the y axis or about the z axis. For carrying out this rotation, this rotation would be carried out in the sequence of a number of steps.
(Refer Slide Time: 00:06:26 min)
The first step is translation so that this point d e f will now become the origin. A new coordinate system would be passing through this point like this, that it would involve translation by an amount of minus d minus e minus f. 3
So the first step, here translation step in that this would be carried out by a transformation matrix which would look like this. This we call as T 1 then the second step will be rotation. In the first rotation that we will carry out would be a rotation such that this direction vector abc will now be rotated lets say about the z axis so that it will now lie in the zy plane. We will rotate it so that it will now lie in the zy plane. We can take it, we can rotate it so that it can lie in any of the three planes. I can lets say if you locate it from the front this is one axis, this is second axis and this vertical is the third axis and we have a vector like this.
I can rotate it in this manner, from this point as I rotate it in this manner, the angle by which it will be rotated will be the angle which I will be seeing as the projection in the bottom plane. I will again repeat, if I look at the top view of this vector, if you look at the top view whatever angle I see in the bottom plane that will be the angle by which I have to rotate this vector so that it will come into this vertical plane and this rotation is being carried out about this vertical axis. Is that all right?
(Refer Slide Time: 00:09:27 min)
So what we will do is this is my point abc and this is the origin, this is the new origin after I have already done the translation in the first step. As a result this point has now become the origin and this abc is the direction vector for the axis of rotation. This gives the direction cosines for the axis of rotation, so I will take this vector abc and now I am looking at its projection on to the yz pane. I am planning to rotate about the x axis, so its projection on the yz plane would look like this. This would be the projection on to the yz plane. This diagonal, what will the magnitude of this diagonal? The direction cosine of this vector are abc. So now the projection, this will have the coordinates of. It is a projection on to the yz plane, so the x coordinate will be 0 and the y and the z coordinates will be how much? b and c, because this has coordinates of abc so the y and z coordinates of this would be bc.
4
Basically projecting a point abc on to the yz plane. Again if you look at it on this table, this is one axis, this is second axis and this is my third vertical axis. If I have any point like this and I take its top view, this point has coordinates of abc. When I projected on to the yz plane, its x coordinate will become zero the other two coordinates will remain unchanged. So this will have coordinates of 0, b, c which means this distance would be c and this distance would be b and this diagonal lets say would be lambda where lambda will be equal to square root of b square plus c square. And how much will be this angle? This theta would be tan inverse of c by b or we can say that sin theta would be equal to c by lambda and cos theta would be equal to b by lambda that is for this angle theta but now you have to be careful that we have to rotate such that this vector will now coincide lets say with the xy plane. You are rotating about the x axis so that this vector now coincides with the xy plane. So what should be the angle by which we should be rotating our axis theta or minus theta? You have to be careful in answering that.
If I take this vector and I rotate it by an angle of theta, what will happen? It will again go theta in this direction, I dont want that. So if this is my vector, I will have to rotate it by minus theta so that it will now lie in xy plane. I have to rotate it by minus theta for the sake of my transformation, lets say my theta prime for transformation is equal to minus theta. So I will get sin of theta prime will be equal to minus c by lambda and cos of theta prime will be equal to b by lambda. So for this step my transformation matrix, what would that look like? I am rotating about the x axis by an angle of minus theta. So this will be 1 0 0 0, this term is cos theta which is b by lambda, this term is sin theta prime which is minus c by lambda, this would be c and this would be b and I can have one by lambda outside sorry. So this should be a transformation matrix after which my axis of rotation would now lie in the xy plane, so I will repeat here.
(Refer Slide Time: 00:15:04 min)
This is rotation about x by an angle of theta prime and this is given by the transformation matrix that I just wrote. After this stage this vector is now lying in the xy plane. 5
(Refer Slide Time: 00:15:46 min)
So if I draw another figure, earlier my vector with respect to this origin looks something like this. Now it will be rotated so that it will now lie in a xy plane. So my vector now lies in this xy plane and since this vector has been rotated, what is the length of this vector? The length would be same, unit. Since we said abc are the direction cosines, it has still got unit length. And what will be the coordinates of this point? Let us look at this. The a is 0, c, are you sure? If the coordinates are a, 0, c, the length will not be one. We will have to normalize it but what will it be? J ust I have to visualize it. I have rotated it about the x axis so that this vector has now fallen on to the xy plane.
A vector, again if you are looking at from front these are my three axis, these are vertical axis. A vector like this has been rotated and it is coming to this plane, so now in this plane I want to find out the coordinates of this point. This vector like this, it is coming like this to the xy plane. So this point has a distance of one, but how much is this angle? The x coordinate will remain the same. The x coordinate will remain the same. Why?
When we took this vector, we rotate it about the about the x axis. So if I am taking this vector and rotating it about the x axis, the x coordinate remains the same. So the x coordinate is how much? So the x coordinator that is this distance will remain to be a. Is that okay? See I even the written the transformation matrix over here. I had a vector like this which will rotate on to the xy plane, the rotation is about the x axis. If I rotate any point about the x axis, this x coordinate remains unchanged. So I take the tip, the tip of this vector which is the point abc and I am rotating it about the x axis. So the x coordinate will remain unchanged and the z coordinate will of course become 0. So the x coordinate is now unchanged, therefore the x coordinate will remain at 1. And what will be the y coordinate? Under root of 1 minus a square which is the same as under root of b square plus c squared which is the same as lambda. If you look at this figure, under root of b square plus c square the same as lambda.
6
So in this figure, when a vector is now in the xy plane, the x coordinate is a and the y coordinate will be lambda and if I am looking at now if I want this angle this is my z axis, if I want this angle, what will be cos of that angle and what will be the sin of that angle? And sin of that angle is lambda divided by 1 because 1 is the diagonal and this angle is 90 degrees. So sin of this angle will be lambda divided by 1 and the cos of this angle will be a divided by 1, cos theta will be equal to a and now I want to rotate this vector about this z axis lets say so that it coincides with the x axis now. Again that will be a rotation by minus theta. So by rotation my minus theta would give me a transformation matrix which would look like this. Again rotation about the z axis, so cos theta is a, sin theta is minus lambda lambda a 0 0. Is that all right?
(Refer Slide Time: 00:23:05 min)
So after this second rotation, after the second step, a third step will also be a rotation which is rotation about the z axis lets say by an angle of alpha such that a transformation matrix would be a minus lambda lambda a 0 0 and after this stage or axis of rotation is now coinciding with the x axis.
7
(Refer Slide Time: 00:24:08 min)
Once an axis of rotation is coinciding with x axis, the next step is to rotate by an angle of lets say theta about the x axis and that is given by, this is cos theta sin theta minus sin theta cos theta. Step 5 would be reverse of step 3 which will be R z alpha inverse and step 3 was this rotating, the reverse of this will be inverse of this and that will be obtained just by a minus lambda here and a plus lambda here that will be step 5. Step 6 would be reverse of step number 2 and step 7 would be reverse of step number 1. This would be R x
theta prime inverse and this would be T 1 inverse. So now the complete transformation will be obtained by this is T 1 , this is T 2 , this is T 3 , this is equal to T 4 , the complete transformation will be obtained by T 1 T 2 T 3 T 4 T 5 T 6 T 7 or so.
(Refer Slide Time: 00:26:56 min)
8
By this complete transformation we can rotate any point about any arbitrary axis. Is that all right? One thing you have to keep in mind is that while carrying on the rotations in this case, you first rotate it about the x axis so that it came into the xy plane and then you rotate it about the z axis so the vector came along the x axis. I have aligned this vector along the x axis, there is no reason why I should align along the x axis. I can align it either with respect to the y axis or with respect to the z axis. If I align it with respect to the y axis then the rotation will be about the y axis. If I align it with respect to the z axis, my actual rotation will be with respect to the z axis. I can do it either way, the sequence of rotations is also immaterial, the final transformation matrix will remain the same. Any questions with respect to this generalized rotation?
(Refer Slide Time: 00:28:13 min)
Then the next thing we will now talk about is what is referred to as projections. If you have any arbitrary point xyz and we project it on to the yz plane, we just saw it, its coordinates would now become 0 y z. That is simple projection on to one of the orthographic planes but we also have other kinds of projections, where of what are the different kinds of projections that are there? Orthographic projections, oblique projections, isometric projection, perspective projections. If we have any parallel projection, we will consider case where it will be either orthographic or it will be oblique.
Do you know the difference between orthographic and oblique projection? Orthographic or an oblique projection, what is the difference between the two? How do we define an orthographic projection? Projection of the three perpendicular planes. Isometric projection is that a orthographic projection? First thing, what is the parallel projection? When you view from an infinite distance so then what happens? So all the projecting rays, projecting lines are parallel that is the parallel projection. A parallel projection can either be oblique or it can be orthographic. When is it called orthographic and when is it called an oblique projection? When, what is oblique? What I have here is oblique? I will 9
give you the definitions. In an orthographic projection, your projecting rays are perpendicular to the projecting plane.
If you have any object, lets take a simple block like this and I take parallel rays from it for the sake of projection in any direction and my projecting plane is taken perpendicular to it, then I get orthographic views. The three standard orthographic views that you see the front view, the top view or the side view are profile. These are obtained when the projecting plane is either parallel perpendicular to the y axis or perpendicular to the x axis or perpendicular to the z axis. Then you get your standard orthographic views but orthographic view is a general view in which the projecting lines are parallel to the projecting plane. All the projecting lines are parallel and the projecting lines will be perpendicular to the projecting plane like in this case. In the case of an oblique projection, by projecting lines can be at an angle to the plane. These are the projecting lines but my projecting plane can be at an angle. In contrast to parallel another kind of projection which is called the perspective projection. In the perspective projection, the observer is at a finite distance so the projecting lines are not parallel.
(Refer Slide Time: 00:33:08 min)
If we have a or lets take a view like this and we have an observer was here. This observer, the lines that are coming to him, the projecting lines would be something like this. The projecting lines coming to here are not parallel. 3 D, it is a 3 D effect. Lets say a very standard example given is if you are standing on the railway track and you look at the railway track, the railway track would look something like this. at infinity it will seem to converge to a point. Even though the lines are parallel very close to you, the distance between them look to be larger than the distance at a very far away point. that is the perspective view of the railway track. In this case the projecting lines are not parallel and they appear as if they all converging at a point. So we will see a perspective view in detail later on. Lets first talk of the parallel or the orthographic views.
10
(Refer Slide Time: 00:34:45 min)
Lets talk of an orthographic projection on any arbitrary plane. This is the plane that we are talking about, this plane is passing through a point x 0 , y 0 , z 0 and its unit normal vector was given by lmn. Now if I take any arbitrary point and I want to project it on to this plane. Mind you right now I am talking of an orthographic projection. So my direction of projecting is going to be the same as the direction element because my direction of projection is going to be perpendicular to this plane. So this point which is some point xyz will get projected on to x prime, y prime, z prime.
Now this point x prime, y prime, z prime would lie on the projecting plane and the projecting plane is given by a plane which is passing through the point x 0 , y 0 , z 0 with directions cosine of element. So now we want to find out this point x prime, y prime, z prime. How do you do that? Bring the xy plane on to this projecting plane. Lets say this is x y z and how do you align? This is my original origin of my xyz coordinates and this is the point through which the plane is passing. So in step 1, I will translate, this becomes the new origin. If this becomes the new origin, my translation is by minus x 0 minus y 0
minus z 0 .
In my step 2, I will now rotate my axis such that this plane becomes same as the lets say the xy plane or my z axis will now start coinciding with the lmn vector. So once you rotate such that z axis becomes identical to the direction vector lmn. How this rotation performed? It will again be a sequence of two rotations, the way we just solve in the other example. In step three, we will project the point xyz on to the xy plane that is project on xy. And how do we project on xy? We just put z equal to zero. This transformation matrix is projected on to the xy plane and then steps 4 and 5 would be reverse of steps 2 and 1. So by the sequence of these five transformations, we will be able to get the orthographic projection of any arbitrary point xyz, on any arbitrary plane. Is that all right? Again please repeat. Yeah. 11
The point is xyz, lmn is the lmn is the direction of the projecting lines. lmn is the normal vector for the projecting planes. So what we will do is, what we are doing is we are first translating the origin so it my axis would now look like this. Then I want to rotate my coordinates such that lmn coincide with the z axis. Once that happens this would look something like this. This is my z axis and my x and y axis will probably look something like this. So whatever be now on the coordinates of this point xyz, I can easily projected on to this plane just by ignoring the z coordinate. Yeah, all these. All these transformations are done on the point, lets say take a transformations T 1 T 2 T 3 T 2
inverse and T 1 inverse if this is a point P, a point P prime will be equal to P multiplied by all this. So this is our orthographic, general orthographic projection can be obtained. Lets now take another example which is a general parallel projection.
(Refer Slide Time: 00:42:29 min)
In a general parallel projection we have any arbitrary point xyz and we want to project on to the xy plane. This is the xy plane but now our projecting direction is not perpendicular to the projecting plane. I am talking about general parallel projection, not necessarily an orthographic projection. Say a projecting direction is a direction given by lmn. We project this point in the direction of lmn, I will get some point on the xy plane which is lets say x prime y prime z prime. I want to get coordinates of x prime y prime z prime. In earlier case a projecting plane was perpendicular to the projecting lines, so when I was projecting on to the xy plane I simply put the z coordinate equal to zero but now I want to project in the direction of lmn. It can be an oblique direction. How will we get the coordinates of x prime y prime z prime? Any ideas on that? Anyone? Again repeat please. [Conversation between Student and Professor Not audible ((00:45:00 min))] But we dont know xy x dash y dash z dash, we have to find out x dash y dash z dash. We cant find out the projection without that. Correct, we know the initial point of the line, we know the direction cosine of this line, we can write down the equation of this line and we know the equation of this plane. 12
The intersection of the two will give us this point x prime y prime z prime. In this case I should not try to translate my xyz axis on to this point and then rotate the axis and so on What you are doing in the earlier cases, that is not necessary. All that we have to do is we know the point xyz, we know the direction cosines, we can write down the equation on the line and we can find out its intersection with the xy plane. How do we do that lets just for the, if I write down the parametric equation of this line, what will that look like? Any point on this line will be given by x plus t times l y plus t times m and z plus t times n. Is that okay? Yeah it so happen that here this is simple. Thats all.
So for when you are trying to rotate the axis and so on it is simpler to do that. Finding out the coordinates using the intersection of planes and all that would have been very complex. For example if I take up this case itself, if I try to write down the equation of this plane and the equation of this line and find the intersection, yes I can do that. That will be a bit more complex than following this method. In this case it so happens that the equation of this line is quite straight forward, the equations of this xy plane that is also very straight forward. The parametric equation of this line is simply this, any point x will be given by x pus tl, the y coordinate of any point will be y plus t times m, the z coordinate will be z plus t times n and for the intersection with the xy plane, we will just have to put that this has to be equal to zero. This has to be equal to 0, t is equal to minus z by n. So we will get the point x prime y prime z prime will be equal to x minus l by n, y minus m by n and 0. All that I have done is t equal to minus z by n, I have put that over here. So x prime y prime z prime will be x minus lz by n and y minus mz by n and 0.
(Refer Slide Time: 00:49:10 min)
I will just repeat that over here and this again I can write it in a matrix form using homogeneous coordinates as what will be a transformation matrix, x prime is equal to x minus lz by n. So x will have a one, there is no term of called y and z will have minus l by n. Similarly y prime is y minus mz by n, no term of x, this should be one, this should be minus m by n and this should be 0 and z prime is 0 and homogeneous coordinate h 13
should turn out to be one. So this is a transformation matrix for a general parallel projection where my projecting lines are at an angle of or have the direction cosine of lmn and my projecting plane is the xy plane. Any questions on this general parallel projection? In that case we will stop here now. In the next class we will see other types of projections. 14