3D coordinate system
When we want to specify a location, we have to specify a coordinate system before we specify a point. A 3D coordinate system has three axes: the X axis, Y axis, and Z axis. The three axes start from the origin where the three axes intersect.
The positive X axis starts from the origin and starts moving endlessly in a direction and the negative X axis moves in the opposite direction. The positive Y axis starts from the origin as the X axis and starts going in the upward direction at 90 degrees to the X axis and the negative Y moves in the opposite direction. This describes a 2D XY plane which forms the basis for a 2D coordinate system.
The positive Z axis also starts from the origin as the X and Y axis and is perpendicular in to X and Y axis. The positive Z axis can go in either direction to the XY plane forming a 3D coordinate system.
Assuming the positive X axis is to the right and positive Y axis is to the up direction then the Z axis can either go into or comes out of the screen as the Z axis is perpendicular to both the X and Y axis.
If the positive Z axis moves into the screen, it is called a Left Hand Coordinate System. If the positive Z axis comes out of the screen, then it is called Right Hand Coordinate System.
Open out your right arm with the palm facing towards you and make a fist. Extend the thumb to the right, and extend the index finger upwards. Now extend the middle finger which faces towards you. This is the right hand coordinate system.
The thumb represents the direction of the positive X axis, the index finger represents the direction of the positive Y axis and the middle finger is the direction of the positive Z axis. OpenGL, Vulkan or any graphics framework that use them also use this coordinate system.
For the left-hand coordinate system, extend your left arm out with the palm of the hand facing away from you and make a fist. Next extend the thumb and index finger in the right and upwards direction. Now extend the middle finger away from you. In this case, the thumb also represents the direction of the X axis and the index finger is pointing in the direction of the positive Y axis which faces in the right and upwards direction. The Z axis (which is the middle finger) is now facing away from you. This is the Left Hand Coordinate System. Direct3D of DirectX uses this coordinate system.
In this book, since we are going to be covering OpenGL and Vulkan, we will be using the Right Hand Coordinate System: