   How to choose between left handed and right handed coordinate system?
  Before in my programs I used D3DX. D3DX uses left handed coordinate system so I used left handed. Now I have bilt my own math library that uses vectors and matrices. How can I set for my library to use left handed or right handed coordinate system? Where should I put that?   
Eeny, meeny, miny, moe... Use whatever convention works for you. Once you have all your low-level things working, your choice will probably not affect many future decisions.;Eeny, meeny, miny, moe... Use whatever convention works for you. Once you have all your low-level things working, your choice will probably not affect many future decisions.The only place it really matters is in the view and projection matricies. This is the reason D3DX provides left and right versions of functions that create these.   ;Before in my programs I used D3DX. D3DX uses left handed coordinate system so I used left handed.D3D/DX isn't left-handed; you can use whichever handedness you prefer. (The DX math library even includes functions for both.)Now I have bilt my own math library that uses vectors and matrices. How can I set for my library to use left handed or right handed coordinate system? Where should I put that?[/quote]As previously mentioned, there's only a couple of places where it matters (specifically view and projection transforms). You can implement both left- and right-handed versions of those functions, or you can just go with one handedness or the other.;  I understand, but if I havent decided yet how can you tell for eg. what will the resoult be of cross product? I have bilt cross product function and inputed some values and got some result. The result is according to left handed eaven if I havent specify left handed. Than I have bilt rotation matrix according to left handed rotation but it rotates wrong. After I have changed it to right handed it rotaded according to left handed. I dont understand that. Maybe I should explicitly specify somewhere that I use left handed?   ;I understand, but if I havent decided yet how can you tell for eg. what will the resoult be of cross product? I have bilt cross product function and inputed some values and got some result. The result is according to left handed eaven if I havent specify left handed. Than I have bilt rotation matrix according to left handed rotation but it rotates wrong. After I have changed it to right handed it rotaded according to left handed. I dont understand that. Maybe I should explicitly specify somewhere that I use left handed?I think you're confusing some things here.The cross product (for example) doesn't know or care about (spatial) handedness. The implementation of a cross product function and the (numerical) result of a cross-product operation will be exactly the same regardless of handedness. Handedness simply does not factor in, and you don't need to think about handedness at all when implementing your cross-product function.Similarly, there's no such thing as a 'left-handed' rotation matrix, so although you might be under the impression that your rotation matrices are left-handed, they aren't really. A rotation matrix will look exactly the same regardless of what handedness is being used. As with the cross product, the implementation for your rotation matrix functions will be exactly the same either way, and you do not need to think about handedness when implementing them.As mentioned earlier, there are really only a few places where handedness comes into play (specifically view and projection transforms, and perhaps code that deals with polygon winding). For the most part though, all of the code for your math library will look exactly the same regardless of whether you intend to use a left- or right-handed coordinate system.If that's still unclear, perhaps you could post your cross product or rotation matrix functions, and describe in what way you think they're left-handed.   ;  Look at this article Wiki Rotation Matrix under Rotations in three dimensions Basic rotations and Ambiguities Right- or left-handed coordinates. They show right handed that is counter clockwise around every basis axis. In this article Fastgraph Rotation Matrix under Other Ways to Build a Rotation Matrix there are left handed clockwise rotation around every basis axis.I see that they show same matrix but that's becase probably Wiki uses pre-multiplication and Fastgraph uses post-multiplication.This is my code:struct Vector3{float x;float y;float z;Vector3();Vector3(float x, float y, float z);Vector3 operator - ();Vector3 operator + (Vector3 &vector);Vector3 operator - (Vector3 &vector);Vector3 operator * (Vector3 &vector);Vector3 operator * (float scalar);Vector3 operator / (float scalar);};struct Matrix{float m[4][4];Matrix();Matrix(float m11, float m12, float m13, float m14,  float m21, float m22, float m23, float m24,  float m31, float m32, float m33, float m34,  float m41, float m42, float m43, float m44);};Matrix::Matrix(float m11, float m12, float m13, float m14,float m21, float m22, float m23, float m24,float m31, float m32, float m33, float m34,float m41, float m42, float m43, float m44){m[0][0] = m11;m[0][1] = m12;m[0][2] = m13;m[0][3] = m14;m[1][0] = m21;m[1][1] = m22;m[1][2] = m23;m[1][3] = m24;m[2][0] = m31;m[2][1] = m32;m[2][2] = m33;m[2][3] = m34;m[3][0] = m41;m[3][1] = m42;m[3][2] = m43;m[3][3] = m44;}Matrix *MatrixRotationZ(Matrix *pOut, float angle){Matrix temp(cosf(angle), sinf(angle), 0.0f, 0.0f,  -sinf(angle), cosf(angle), 0.0f, 0.0f,  0.0f, 0.0f, 1.0f, 0.0f,  0.0f, 0.0f, 0.0f, 1.0f);*pOut = temp;return pOut;}Vector3 *Vector3Transform(Vector3 *pOut, Vector3 *pV, Matrix *pM){Vector3 temp;temp.x = pV->x*pM->m[0][0] + pV->y*pM->m[1][0] + pV->z*pM->m[2][0] + 1.0f*pM->m[3][0];temp.y = pV->x*pM->m[0][1] + pV->y*pM->m[1][1] + pV->z*pM->m[2][1] + 1.0f*pM->m[3][1];temp.z = pV->x*pM->m[0][2] + pV->y*pM->m[1][2] + pV->z*pM->m[2][2] + 1.0f*pM->m[3][2];*pOut = temp;return pOut;}I also use post-multiplication so I assume my matrix should look like one from Fastgraph for Z rotation. But if I use that my rotation is counter clockwise instead of clockwise. So I switched the "-" sign in front of sinf().   ;  I'm not sure if you're still looking for help with this or if you've got it figured out, but I'll go ahead and attempt to clarify a couple of things. In particular, the second article you linked to includes some inaccurate and/or confusing statements (or at least that appears to be the case after a quick read-through), which I'll attempt to clarify here.A rotation matrix can take two forms, and the two forms are transposes of one another. Which form to use is determined by whether row vectors or column vectors are being used. Sometimes it's stated that one form is 'right-handed' and the other form is 'left-handed', but this is incorrect.It is true that sometimes you'll want to transpose a rotation matrix (thereby 'reversing' the rotation) when going from a right-handed to a left-handed coordinate system or vice versa, but that's a different issue.To be completely clear: whether the basis vectors go in the rows or columns and whether matrices are pre- or post-multiplied has nothing to do with coordinate-system handedness. These issues are often conflated with one another, but the issues in question are all independent of one another.Unfortunately, it's the case that differences in matrix storage, vector notation, and coordinate-system handedness can all necessitate the transposition of rotation matrices under certain circumstances, which seems to cause quite a bit of confusion. However, in each case the transposition is for a different reason.To reiterate: choice of handedness should affect very few functions in your math library (e.g. the aforementioned view and projection transforms). If you're allowing choice of coordinate-system handedness to affect how your rotation matrices are built, then you're doing it wrong.   ;  CW and CCW are different definitions compared to left- and right handedness. I.e. a positive rotation in RH and a positive rotation in LH both use exactly the same matrix. With "positive rotation" I mean the following: Naturally bend the fingers of the right hand excluding the thumb, and stretch the thumb. Use the thumb as the direction indicator that points along the positive axis of a cartesian co-ordinate system. Define this as "positive rotation", i.e. to where positive angles will rotate. Now, looking onto the tip of the thumb, the other fingers are bend in CCW direction. Now do the same with the left hand, again using the bend fingers as "positive rotations". There the other fingers are bend in CW direction.If you derive the rotation matrix for the one and the other case, you'll get the same matrix both times. If you apply that matrix in the one or other case, you get the same result but of course interpreted one time in a RH system and the other time interpreted in a LH system. If you apply a conversion, e.g. mirroring over z, you'll see the identity.The problem is not the rotation matrix, and it is not the RH / LH system, but it is that you look at a rotation direction definition (i.e. CW / CCW) that has an own fixed reference so to say. IMHO, when using e.g. LH, then I have to rotate using the left hand, too. If I really want to deal with CW / CCW at that point, e.g. because it is an option of an editor application, then I adapt the angle, but then the results are obviously no longer universal. Just my 2 EUR Cent.   