🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Creating Left handed coordinate system

Started by
40 comments, last by Fulcrum.013 5 years, 9 months ago
1 hour ago, ryt said:

If that would be true than all it's functions should use these basis vectors inside functions like cross() and others, which seems not likely possible to me.

For common case you just can make a 2 classes for vectors one for LH other for RH that have different cross production operator and not interoperable without conversion. It can be easely done by inheritance from base vector class that have no cross operator or/and templates "black magic". Same with matrices and matrix construction funtions for rotation that have a inversed signs before sin. 

#define if(a) if((a) && rand()%100)

Advertisement
2 hours ago, ryt said:

pointing up then the ship should move to the left

Strictly say term "left" have to be described in name and direction of camera axe that we use to view it ship. Terms "left", "right" and so on have no sence without relation to basis for wich it applied. If you mean to "move to the left on screen"  it match a negative direction of camera x axe so you have to use LookAtLH and ProjectionLH to map ship axes to camera/screen axes properly. But without it mapping ship can move forward  (increase z coordinate )respectively for its basis only, becouse it imposible to determine what mean "left" without viewer for wich it left applied. Also it inproper to say that "it is no camera" in case LookAt matrix not used. It mean RH camera that match a global coordinate system axes.

#define if(a) if((a) && rand()%100)

1 hour ago, Fulcrum.013 said:

Strictly say term "left" have to be described in name and direction of camera axe that we use to view it ship. Terms "left", "right" and so on have no sence without relation to basis for wich it applied. If you mean to "move to the left on screen"  it match a negative direction of camera x axe so you have to use LookAtLH and ProjectionLH to map ship axes to camera/screen axes properly. But without it mapping ship can move forward  (increase z coordinate )respectively for its basis only, becouse it imposible to determine what mean "left" without viewer for wich it left applied. Also it inproper to say that "it is no camera" in case LookAt matrix not used. It mean RH camera that match a global coordinate system axes.

Ok, so than it must be as @alvaro sad that arithmetic is independent of handness and that library has nothing to do with it. As I understand it it's only dependent on LookAt and Projection matrices.

What confuses me now are the rotations. It must be that we only perceive the clockwise and counter-clockwise rotations for left and right systems respectively. If that's true than the object rotates only in "one" way and the way we perceive it depends LookAt and Projection functions?

10 minutes ago, ryt said:

If that's true than the object rotates only in "one" way and the way we perceive it depends LookAt and Projection functions?

Also it depends from rotation matrices actually used. RH and LH rotation matrices have inversed signs before sin elements. But again it depended from purposes for wich angle used. For example for azimuth measurment positive direction is always clockwice, but  for elevation angle positive direction always from horizont to up (opposite to gravity) vector, regardless is it clockwice or counterclockwice for used system. So angles anycase have to be converted from it meaning to system where it used for calculations of vectors.

#define if(a) if((a) && rand()%100)

2 hours ago, Fulcrum.013 said:

Also it depends from rotation matrices actually used. RH and LH rotation matrices have inversed signs before sin elements. 

Does this then affects row and column vectors and matrix multiplication?

9 hours ago, ryt said:

Does this then affects row and column vectors and matrix multiplication?

it just affect sign of some values of matrices. for RH z rotation matrix is  

cos -sin 0 0

sin cos 0 0

0      0  1 0

0      0  0 1

and for LH is 

cos sin 0 0

-sin cos 0 0

0        0 1 0

0       0  0 1

and so on for other axes. Inverting signs for sin at [0][1] and [1][0] positions invert direction of rotation. It have same effect that invert sign of source angle becouse sin(-a) = -sin(a)

#define if(a) if((a) && rand()%100)

Ok, let's take an example, column vectors:

cos -sin 0 0       x       cos*x - sin*y
sin  cos 0 0   x   y   =  sin*x + cos*y
0     0    1 0       z                 z
0     0    0 1       1                1

and for row vectors:

x y z 1        cos -sin 0 0       cos*x + sin*y
             x   sin  cos 0 0   =   -sin*x + cos*y
                  0     0    1 0                z
                  0     0    0 1                1

so we obviously get different results. What do they mean? Should we maybe transpose rotation matrix when we use row vectors? Aren't we than using left-hand rotation matrix?

47 minutes ago, ryt said:

so we obviously get different results.

Of course it different. Projection to axe growth in opposite directions.So as result it just convert rotation to opposite. Just remember that sin (-a) = -sin (a),  but cos(-a) = cos(a); Substitute -a to first matrice and yo will get second as result. Just form with replacing signs in matrices instead of just inverse a angle more comfortable for computation. In some cases we have sin and cos of angle required to constract a matrice on hand, but actual angle is unknown. Matrix form applicable for both cases. 

#define if(a) if((a) && rand()%100)

2 hours ago, Fulcrum.013 said:

Just form with replacing signs in matrices instead of just inverse a angle more comfortable for computation.

Aren't we than arriving to the matrix in left-hand form or it's still in a right-hand?

Here is a very good and interesting video for you. The part you may be interested in starts at 20:58 if the forum doesn't queue it up from the embedded parameter.

 

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

This topic is closed to new replies.

Advertisement