PDA

View Full Version : 2d vector and matrix operation

giuseppe500
10-27-2011, 07:33 AM
hello.
I have the x axis of a 2x2 matrix, how i can calculate the y axis?
Is sufficent rotate the x axis of 90°?
How i can rotate it a 2 dimensional vector of 90°?
I have two classes : a 3dvector(x,y and z) and a 3x3 matrix ?
Can i use these 3d classes for work in 2d?

thanks.

thokra
10-27-2011, 09:08 AM
First, I don't know of any definition of the mathematical construct of the matrix that involves the term "axis". Furthermore it sound rather unclear what your problem is.

If what you're trying to say is that you have a 2D vector representing the x-axis of the Cartesian basis, then yes, rotating it using

|0 -1| * |1| = |0|
|1 0| |0| |1|

will rotate the vector by 90° about the origin and yield the second basis vector - the y-axis.

Using your classes this can be expressed using a 3x3 rotation matrix and rotating the 3D vector v = (1, 0, 0) about the z-axis. Then extract the x and y coordinate and form your 2D vector.