2D Vertex and 2x2 Matrix Addition [RESOLVED]

Started by
4 comments, last by TheAdmiral 17 years, 6 months ago
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]
Advertisement
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
Ring3 Circus - Diary of a programmer, journal of a hacker.
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.
here is some info : http://en.wikipedia.org/wiki/Transformation_matrix
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:

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
Ring3 Circus - Diary of a programmer, journal of a hacker.

This topic is closed to new replies.

Advertisement