- C++ Game Development By Example
- Siddharth Shekar
- 480字
- 2021-06-24 14:26:14
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:

- 筆記本電腦使用、維護與故障排除實戰
- Effective STL中文版:50條有效使用STL的經驗(雙色)
- 數字邏輯(第3版)
- 計算機組裝與維修技術
- Apple Motion 5 Cookbook
- 微服務分布式架構基礎與實戰:基于Spring Boot + Spring Cloud
- 微軟互聯網信息服務(IIS)最佳實踐 (微軟技術開發者叢書)
- CC2530單片機技術與應用
- R Deep Learning Essentials
- 計算機組裝維修與外設配置(高等職業院校教改示范教材·計算機系列)
- Arduino BLINK Blueprints
- 超大流量分布式系統架構解決方案:人人都是架構師2.0
- FL Studio Cookbook
- USB應用分析精粹:從設備硬件、固件到主機端程序設計
- DevOps實戰:VMware管理員運維方法、工具及最佳實踐