1
   

Question about Rotational Matrix

 
 
Reply Sat 22 May, 2004 06:45 pm
Hi,

I am trying to figure out how to do a 180 degree rotation about a point. Now i know the 180 rotational matrix about the origin is :

-1 0
0 -1

But lets say we wanted to rotate an object about the point ( 1,2 ) instead of the origin, what would be the new matrix?

NB I am dealing with a simple 2 dimensional matrix.

Any ideas?

Thanks for your time and consideration.

Yours Respectfully
Avin Sinanan
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 877 • Replies: 9
No top replies

 
ebrown p
 
  1  
Reply Sat 22 May, 2004 08:30 pm
A rotation about a point is the combination of three transformations.

1) Do a translation so that the point is on the origin (in translated coordinates).

2) Rotate about the origin (as you know how to do).

3) Do the reverse translation from #1.

You can construct one matrix that will do these three steps as one step by multiplying the matrices together.


This page has a bunch of matrices. We normally do 2D points as a 3X3 matrix (the third coordinate is always 1).

http://www.udayton.edu/~cps/cps460/notes/2dtrans/2dtrans.html
0 Replies
 
avinsinanan
 
  1  
Reply Sun 23 May, 2004 09:39 am
Do you know the matrix?
Thanks a lot for the help so far.

I was wondering if you know the matrix that would move the object to the origin.

eg. If I had the 3 points ( triangle ) , A(3,0) B( 5,0) and C(5,7) and I wanted to rotate it about the point (1,2) instead of the origin.

What would be the matrix for step 1 in the reply above?

Thanks for everything

Yours Respectfully
Avin Sinanan
0 Replies
 
ebrown p
 
  1  
Reply Sun 23 May, 2004 11:36 am
There are two ways to approach this problem. I assume that this is for a class.

The first approach is the approach outlined above. This assumes that you have learned to multiply matrices. The only trick is that this will require a 3x3 matrix (since the answer has a constant term that is not muliplied by X or Y).

The second approach is to figure out the algebra and then construct a matrix from this. You need to right the algebraic eqations that will allow you to calculate the new X and Y from the old ones. Once you figure these out, constructing the correct matrix is fairly straightforward.

What approach is most appropriate for your class? If you haven't done multiplication of matrices, we should proceed with the second strategy.
0 Replies
 
avinsinanan
 
  1  
Reply Sun 23 May, 2004 05:13 pm
Yes we have done multiplication of Matricies
Yes we have done multiplication of Matricies. However why do we need a 3x3 matrix, I would prefer to stick with 2x2 matrices.

Since it should only take a 2x2 matrix to move to points to the origin. A next 2x2 matrix to roatate it and the the inverse of the first 2x2 matrix to map it back to the original points.

Yes it is for a class.

Any ideas are welcomed.

Thanks.

Yours Respectfully
Avin Sinanan
0 Replies
 
ebrown p
 
  1  
Reply Sun 23 May, 2004 05:42 pm
The reson you need a 3x3 matrix is that for a translation, you need a constant term. Remember that behind matrices is just algebra. Let's look at the matrix you started with.

-1 0
0 1

If you use this to transform a point (x0, y0) to (x1, y1), you will be doing this:

x1 = -1 * x0 + 0 * y0 ;
y1 = 0 * x0 + 1 * y1

This is all fine with a 2x2 matrix.

BUT how would we do a translation (e.g. to move the origin to a point (tx, ty) ).

you need to do this:

x1 = 1 * x0 + 0 * y0 + tx
y1 = 0 * x0 + 1 * y0 + ty

The same set of equations can be represented by transforming the point (x0, y0, 1) with this matrix:

1 0 tx
0 1 ty
0 0 1

Being able to relate the algebra to the matrix is very important. Please make sure you understand this. Note that there is no way to do this with a 2X2 matrix.

I think you now have enough to answer the question using multiplication. But this problem can also be done fairly easily without using a matrix multiply if you get the algebra. It is probably a good exercise for yourself to learn this better.

Try to come up with the algebraic equations for this transformation. I will give you the first to get started. Once you have the equations, coming up with the proper matrix should be straightforward.

Here is a big hint to get you started. I am assuming you want to rotate a point (x0 , y0 ) 180 degrees about a point (Tx, Ty).

x1 = - (x0 - Tx ) + Tx
0 Replies
 
Thomas
 
  1  
Reply Tue 25 May, 2004 06:19 am
Code:Matrix for translation of origin from point (0, 0) to point (x, y):
T = -x 0
0 -y

Matrix for rotation by phi degrees:

R = cos(phi) sin(phi)
sin(phi) -cos(phi)

T_inversed = x 0
0 y

For every point p = (xp, yp) you want to transform, its transformation p'=(xp', yp') = T_inversed * R * T * (xp, yp).

You don't need three-dimensional matrices for this.
0 Replies
 
ebrown p
 
  1  
Reply Tue 25 May, 2004 06:57 am
Thomas,

I believe you are mistaken. That first matrix you present is a scaling matrix, not a translation.

Take a point (x, y) that you want to translate so that the origin is at (A,B). The translated point will be (x', y')

What you would like to do algebraically is

x' = x + A
y' = y + B

With your matrix

A 0
0 B

What you are really doing is

x' = A * x
y' = B * y

The matrix you provided is a scaling matrix.

You need a 3x3 to do a translation.
0 Replies
 
Thomas
 
  1  
Reply Tue 25 May, 2004 07:00 am
Embarrassed
You're right. I posted before thinking here. Sorry.
0 Replies
 
g day
 
  1  
Reply Fri 28 May, 2004 05:45 pm
I think this page from the experts in everything software or hardware 3d is a good help BTW:

http://www.beyond3d.com/articles/vs/index.php?p=3

http://www.beyond3d.com/articles/vs/matrixtransformations.gif
0 Replies
 
 

Related Topics

Evolution 101 - Discussion by gungasnake
Typing Equations on a PC - Discussion by Brandon9000
The Future of Artificial Intelligence - Discussion by Brandon9000
The well known Mind vs Brain. - Discussion by crayon851
Scientists Offer Proof of 'Dark Matter' - Discussion by oralloy
Blue Saturn - Discussion by oralloy
Bald Eagle-DDT Myth Still Flying High - Discussion by gungasnake
DDT: A Weapon of Mass Survival - Discussion by gungasnake
 
  1. Forums
  2. » Question about Rotational Matrix
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 01/16/2025 at 11:03:47