Sign in to follow this  
Jacob Roman

2D Vertex and 2x2 Matrix Addition [RESOLVED]

Recommended Posts

If you are adding a 2d vertex with a 2x2 matrix, how would you go about doing it? Can get it right for some reason. [Edited by - Jacob Roman on September 26, 2006 4:31:04 PM]

Share this post


Link to post
Share on other sites
If you are asking what I think you are, then the operation is undefined. Two matrices can be added (unlike multiplied) if and only if their dimensions are the same. Since the vector is 1x2 and the matrix 2x2, you're in some trouble.

It is possible to represent a vector as a square matrix, using only the primary diagonal, for example, but unless you're aware of any such technique being used, we can't help you.

What is it that you're trying to achieve? Maybe we can suggest an alternative.

Regards
Admiral

Share this post


Link to post
Share on other sites
Trying to rotate the vertices actually. I was gonna setup a matrix identity, add the vertex to the matrix to combine it with a matrix, multiply the matrix by a rotational matrix, and convert it back to the original vertex. Couldn't find much online on doing it correctly.

Share this post


Link to post
Share on other sites
Can't believe that after all the places I've looked, I didn't even bother searching wikipedia thinking it was just gonna be 3D 4x4 matrices. Thanks. Got this out of it:

Rotation

For rotation by an angle θ counterclockwise about the origin, the functional form is x' = xcosθ − ysinθ and y' = xsinθ + ycosθ. Written in matrix form, this becomes:

Share this post


Link to post
Share on other sites
Sure thing.

Just to clear up, if you weren't already aware, you need to create the rotation matrix from the angle (and only the angle) then multiply by (not sum with) the vector to get the desired results. This is true of all matrix transformations.

Regards
Admiral

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this