# 2D Vertex and 2x2 Matrix Addition [RESOLVED]

This topic is 4315 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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

##### 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 on other sites
here is some info : http://en.wikipedia.org/wiki/Transformation_matrix

##### 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 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

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
19
5. 5

• 14
• 26
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631771
• Total Posts
3002253
×