Extracting overall angle from a matrix

In summary, the conversation is discussing the use of a transform matrix on a square shape and how to determine the overall angle between the horizontal and one of the square's sides after the transformation. The solution is to use the inverse tangent formula on the y and x components of the transformed shape. The conversation also touches on the concept of transforming the coordinate system versus transforming the object itself.
  • #1
humanchimp
4
0
Hi - was wondering if anyone could help with this problem.

If I have a square, which is like this:
Code:
A-----B
|     |
|     |
C-----D

and I then apply a transform matrix to it, which might consist of multiple rotations and translations, is there any way to determine what the overall angle is between the horizontal and the line AB of the square?

I am assuming there is a way to do this, because it is always possible to just draw out the square with the matrix applied to it, on paper and just measure the angle that it makes to the horizontal with a protractor. However I have no idea how to go about working out the angle purely mathematically.

The matrix I am using is of the form:
[a] [c] [e]
[d] [f]
[0] [0] [1]

I would appreciate any help with this.
Thanks
 
Mathematics news on Phys.org
  • #2
You're using an x-y coordinate frame. The angle that AB makes with respect to the x-axis is just the inverse tangent of YAB/XAB, where YAB is the y component of A minus the y component of B.
 
  • #3
Hi - thanks for the help.

I should say that this is for use with Javascript and SVG.

The problem is that I don't know what the x and y coordinates are of any of the corners once the matrix is applied to it. I know the x and y position of the top left hand corner of the square before the matrix is applied to it, however when you apply the matrix to it, according to the computer, the x and y coordinates of the square stay the same even though the position of the top left hand corner has moved.

So because I don't have the x and y coordinates of the corners A or B I can't use that formula.

Do you have any suggestions on how I could work out the position of A and B just by using the coordinates of the square before the matrix is applied, and the matrix itself?

Sorry if this post isn't very clear.
 
  • #4
It looks like you're applying a rotation matrix to the components.

i.e.

r'=Mr
where M is your matrix and r is the triplet r=(rx,ry,rz). Is that correct?
 
  • #5
erm - I'm not really sure what that means - my maths has never been very good.

Maybe this explains it better:
http://www.w3.org/TR/SVG/coords.html
if you search for: "Mathematically, all transformations can be represented as 3x3 transformation matrices of the following form:" without the speech marks that section explains how the matrix system I am using works.

Thanks for your help again.
 
  • #6
OK.

Are you transforming the coordinate system (x and y axes) or are you transforming the box, whilst keeping the coordinate system fixed?

These are largely equivalent processes, but it would be nice to know which one you're doing.
 
  • #7
Hi - sorry for the delay in replying. I was expecting to get an email but it never arrived.

When I apply the matrix, the coordinate system of the object is changed to reflect the matrix. So, for example if I rotate the object by 30 degrees, the coordinate system of the object, will rotate 30 degrees. However, the 'base' coordinate system stays the same. So in essence you have a coordinate system within another coordinate system.

If you have a look here: http://www.w3.org/TR/SVG/images/coords/RotateScale.svg [edit] you will need Internet explorer with the Adobe SVG Viewer plugin or just firefox to view that file [/edit] the black lines along the top and left hand side is the 'base' coordinate system, and the red lines are the new coordinate system for each matrix.

So in answer to your question, i am transforming a 'child' coordinate system within a fixed coordinate system.
 

FAQ: Extracting overall angle from a matrix

How do you extract the overall angle from a matrix?

The overall angle can be extracted from a matrix by calculating the inverse tangent of the ratio of the vertical and horizontal components of the matrix. This will give the angle in radians, which can be converted to degrees if needed.

What is the purpose of extracting the overall angle from a matrix?

Extracting the overall angle from a matrix is useful in various applications such as computer graphics, robotics, and image processing. It allows for the manipulation and transformation of objects represented by matrices.

Can the overall angle be extracted from any type of matrix?

Yes, the overall angle can be extracted from any 2D or 3D matrix, as long as it represents a geometric object with angular orientation.

Is there a specific formula for extracting the overall angle from a matrix?

Yes, the formula for extracting the overall angle from a matrix is arctan(y/x), where y is the vertical component of the matrix and x is the horizontal component.

Are there any limitations to extracting the overall angle from a matrix?

The main limitation is that the matrix must represent a 2D or 3D geometric object with angular orientation. Additionally, the extracted angle may be limited to a certain range, depending on the specific application and implementation of the formula.

Similar threads

Replies
1
Views
982
Replies
1
Views
946
Replies
8
Views
2K
Replies
1
Views
2K
Replies
25
Views
2K
Replies
16
Views
2K
Replies
2
Views
2K
Back
Top