Creating Left handed coordinate system

Started by
34 comments, last by Fulcrum.013 5 years, 6 months ago
Advertisement
29 minutes ago, ryt said:

But that was not kinda my original question. I wanted to know how could I tell by merely looking at the system or if you create one how do you choose.

look from vector z end to pivot point. if turn from vector x to vetor y counterclockwice it is laft-hand if clockwice it is right hand. DX and GL using right-hand system. Math and CADs usually using a left-hand system.

To make a LH matrices you have just to inverse one of vectors. Usually it is y.  So just reflect matrices/vectors respectively to one of planes to change a system orientation.

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

The cross product of (1,0,0) and (0,1,0) is (0,0,1) no matter what handedness you are using. Handedness only enters when you assign (1,0,0) the meaning of "to the right of the screen", (0,1,0) the meaning of "upwards along the screen" and (0,0,1) the meaning of "perpendicular to the screen away from the viewer", for example. Now in order to determine the sign of rotations and the sign of the cross product you can use a hand, and you'll find out whether this is a left-handed system or a right-handed system.

10 hours ago, Fulcrum.013 said:

DX and GL using right-hand system.

Neither Direct3D nor OpenGL enforces any particular handedness. (I'm a little uncertain about some of your other statements as well, but this is the one that seems most likely to cause confusion.)

8 hours ago, alvaro said:

The cross product of (1,0,0) and (0,1,0) is (0,0,1) no matter what handedness you are using. Handedness only enters when you assign (1,0,0) the meaning of "to the right of the screen", (0,1,0) the meaning of "upwards along the screen" and (0,0,1) the meaning of "perpendicular to the screen away from the viewer", for example.

Where do this assignments to (1,0,0) "to right of screen", (0,1,0) "upwards" and (0,0,1) "away" happen? I never seen such declarations in none of libraries.

Coming back to my own library that I build some time ago, mentioned in the first topic, I also never defined something similar. All I had is a struct for vectors, functions for their additions, cross, dot and others and a matrix class with rotations. I copied all from a math book. Yet when I had to do the rotations my resulting rotated vertices were rotated in a right-hand style.
I never defined where my "right to the screen" and others were. It could be that I missed or overlooked something.
So to understand completely I thought to create a similar system from the beginning but it to be in left-hand style. This is where I stuck.

3 hours ago, ryt said:

Where do this assignments to (1,0,0) "to right of screen", (0,1,0) "upwards" and (0,0,1) "away" happen? I never seen such declarations in none of libraries.

It not declared in libraries. It implemented in fixed part of pipeline and described on "Coordinate system" branch of SDK docs.  Of cource you can simulate opposite Z axis direction by inverting backface culling mode and depth test function. Also it possible to perform conversions from any coordinate system that you have to pipeline coordinate system in vertex shader.  For example on game logic you may use system with x axe "to forward" and z axe "upwards" that is much more intuitive in 3D space based on flat map coordinate system, or "airplane" system that uses x "forward", y "upwards" and z "to right",   but convert it to z "away" and x "to right" and y "upwards" on shader.

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

On 9/28/2018 at 1:58 PM, ryt said:

What would I need to change in my library to make it left-handed?

Mirror matrices and invert direction of cross-production result. Left-hand system is just a mirror of right-hand system,just like a left hand is mirror of right hand.

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

1 hour ago, Fulcrum.013 said:

It not declared in libraries. It implemented in fixed part of pipeline and described on "Coordinate system" branch of SDK docs.  

I think it should be as each library could be different, it does not need to do something the way other library did it.
You mentioned fixed part of pipeline, what about non-fixed, every middle-ware could do it in its own way. And what about the ones that don't use a pipeline at all, that are not used for graphics at all for e.g. They could be just a library for a physics system in some institution, but still they would have to take care of the "handness".

6 hours ago, Zakwayda said:

Neither Direct3D nor OpenGL enforces any particular handedness.

Of cource you can pass any habd matrices to pipeline. But for left-hand system you will get a mirrored results, becouse pipeline use a right-hand system. It  why libraries have to use RH and LH functions to work with pipeline. LH build mirrored matrices that by the way converts (mirror) result from LH system to RH system that pipeline use.

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

1 hour ago, Fulcrum.013 said:

Mirror matrices and invert direction of cross-production result. Left-hand system is just a mirror of right-hand system,just like a left hand is mirror of right hand.

Ok, this is if I started initially with a right-hand coordinates, but what made the initial system from start right-handed?

This topic is closed to new replies.

Advertisement