Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

This is a general question but can someone provide a worked example of a 3d transformation? Or a link that has a worked example of one? I've looked on the internet for a long time and couldn't find anything except explanations on how to do a transformation but no mathematical examples.

I am trying to transform an object from one location to another where initial (location 1) and final coordinates (location 2) are given. I know that you have to translate the object to the origin (which I'll call O for origin), rotate is in alignment with the origin, translate it to the new location and then rotate it to the final coordinates. I understand conceptually what's going on but not clear on the math.

So basically: t(O-->2).R(O-->2).R(1-->O).t(1-->O) = F (frame transformation)

I also know that the two rotation matrices can be calculated simply as R(1-2) so the equation becomes: t(O-->2).R(1-->2).t(1-->O)=F

share|improve this question
1  
Instead of four steps, it seems like it should be three. Move to origin, rotate to its final orientation, then translate to second position. But I guess if your scheme requires it, you could rotate to a "standard" orientation, and then rotate it to the final orientation from standard. Still, those rotations should probably take place next to each other, not alternating with the translations. –  rschwieb Sep 27 '12 at 18:23
    
That is why the final equation I stated only has three terms: translation from 1 to origin, rotation from 1 to 2 and translation from origin to 2. However, if you could provide an example of how to do this it would be great. –  user Sep 27 '12 at 18:26
    
Oh ok, great :) Sorry, sometimes without TeX things like that pass me by. Can you produce a rotation to align two oriented spheres centered at the origin? That's the hardest part, and I think you understand the translation, right? –  rschwieb Sep 27 '12 at 18:40
    
BTW translation is not a linear transformation. –  rschwieb Sep 27 '12 at 18:42
    
I understand the translation conceptually. The translation matrix is T = [1 0 0 d(x)| 0 1 0 d(y) | 0 0 1 d(z) | 0 0 0 1]. What I don't understand is if you had a triangle for example, do you have to compute the distances for each point relative to the origin or how does that work? Let's say I had a triangle with points (1,5),(2,8),(1,11), how would that work with the translation matrix? –  user Sep 27 '12 at 18:45
show 2 more comments

2 Answers

up vote 0 down vote accepted

Suppose you have an oriented sphere $O_1$ initialy, which moves to become the oriented sphere $O_2$ finally.

Suppose $O_1-w$ and $O_2-v$ are the translations of those spheres to the origin. The spheres can be rotated with a rotation $R$ so that they become the same, that is:

$R(O_1-w)=O_2-v$

Then $R(O_1-w)+v=O_2$.

This is where I'm getting the "shift rotatate shift" scheme from.


Here is an example in the plane. Suppose you want to move the oriented square with vertices $A,B,C,D$ at $(0,1),(0,2),(1,2),(1,1)$ to $(-1,-1),(-1,-2),(-2,-2),(-2,-1)$.

First, translate $A$ to the origin by transforming the plane with $T_1(x)=x-[0,1]$.

Then rotate the square around $A$ so that its orientation matches the second square: $R(x)=x\begin{bmatrix}0&-1\\-1&0\end{bmatrix}=M$ where $M$ is the rotation matrix rotating the plane 180 degrees around the origin.

Then, translate the result to the final position with the translation $T_2(x)=x+[-1,-1]$.

So the final transformation is $M(x-[0,1])+[-1,-1]$, which takes in any coordinate pair $[x_1,x_2]$ and outputs its new location.

share|improve this answer
    
I'm doing this all in my head, so apologies for any typos that might have slipped in. –  rschwieb Sep 27 '12 at 19:20
    
Hey, this helps but can you show the actual math for the first translation? As I mentioned in one of my comments, I know what the 4x4 translation matrix is. I'm just not sure how to utilize it in problems. –  user Sep 27 '12 at 19:25
    
The "translation matrix" is $1\times 2$. The math is: $[0,1]-[0,1]=[0,0]$,$[0,2]-[0,1]=[0,1]$,$[1,2]-[0,1]=[0,1]$, $[1,1]-[0,1]=[1,0]$. Those are the new vertices of the translated square. –  rschwieb Sep 27 '12 at 19:27
    
Oh right, for your example it is not 4x4 but is it possible for you to show a translation of an rigid object in 3-space? –  user Sep 27 '12 at 19:28
    
Yes: every translation on 3-space is affected by adding whatever fixed $[a,b,c]$ you want to every point in the space. This translation moves $[0,0,0]$ to $[a,b,c]$. –  rschwieb Sep 27 '12 at 19:30
add comment

Here is a valuable reference of geometric transformations:

http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/geometry/geo-tran.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.