Jump to content
  • Advertisement
Sign in to follow this  
Jacob Roman

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.

If you intended to correct an error in the post then please contact us.

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

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!