Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

3D Game Math Primer 1: The 3-Dimensional Coordinate Space

, 18 Nov 2012
Rate this:
Please Sign up or sign in to vote.
The 3-dimensional co-ordinate space.

The 3D coordinate system is a natural extension of the 2D cartesian coordinate system we are all familiar with and have studied. The cartesian coordinate system has an interesting history, first documented by the French mathematician Rene Descartes in around 1637. Early work in this time period dealt with only one or two axis coordinate systems, although later findings indicated that the mathematician Pierre de Fermat worked with a three axis (3D) system which was not published. The work done by these great men laid the basis for the great discoveries by Newton and Leibniz later on: the invention of the Calculus. But enough reflections on history, and back to the matter at hand…

We will be covering the following aspects in this first blog post dealing with 3D mathematics:

  • The 3D coordinate space
  • Left handed and right handed orientation
  • The need for multiple coordinate spaces (in games)

The 3D Coordinate Space

The 3D coordinate system consists of three lines or axes (singular form: axis), which are mutually perpendicular to each other, and form the abstract representation of the three dimensions that we humans are able to see. If we had the ability to sense or see in more than 3 dimensions, we would not be limited to the 3 axis system, though this limitation is absent in areas such as linear algebra where you can describe systems with any number of dimensions in an abstract sense. In real life, we see only in three dimensions, and will be our basis behind creating real life-like game environments and models.

The three axes are referred to as the X, Y, and Z axes. Any and every point in 3D space (relative to the axes) can be described in reference to these three axes. The point where the three axis lines intersect is known as the origin. The origin is to the 3D space, what the number zero is to the number line. A coordinate in 3D space is described by the length units projected on the X, Y, and Z axes respectively to reach that position, starting from the origin. Thus the position of the origin can be described as (0, 0, 0) and the point shown in the coordinate system below has the coordinates (x, y, z).

LEFT HANDED AND RIGHT HANDED COORDINATE SYSTEMS

Left handed and right handed orientation is nothing more than a categorization of how the 3D axes can be aligned. If you take your left hand and extend the thumb, index, and third finger at right angles to each other, and hold your hand so that the thumb (positive x-axis) is pointing to your right, the index (positive y-axis) is pointing up, and the third finger (positive z-axis) is pointing towards the direction you are facing, then you have a left handed 3D coordinate system. If we do the same with our right hand, where the thumb, index, and third finger are the positive x, y, and z axes respectively, we have a right handed coordinate system. Notice that if you rotate the right handed orientation to match the x and y axis directions of the left handed system, only the positive z-axis changes direction. We could say that the difference between the orientations is that in a left handed system, the positive z-axis points away from us towards where we are facing, whereas in a right handed orientation, the positive z-axis points towards us. The figure below represents this fact.

image courtesy of http://viz.aset.psu.edu/

In the next post, we will learn about multiple (3D) coordinate spaces and nested coordinate space, and also how basic coordinate transformations can take place. Please leave any feedback on content, clarity of writing,  on what you think should be changed, or errata in general, and I will do my best to work on it.


License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Mark Sinnathamby
Software Developer Air Liquide Industrial Services
Singapore Singapore
Mark is a software developer at Air Liquide Industrial Services - Singapore, where he helps Develop, Deploy, and Maintain large scale enterprise applications in the Asia-Pacific region. While his main work experience converges on .Net technologies, he has proficient experience in C++, HTML5/CSS/Javascript Web technologies, mobile development, OpenGL and DirectX API's, as well as a bit of J2EE. He loves to dabble with Game programming in his spare time, and blogs about his development experience at http://markfaction.wordpress.com and http://gamecoderlogic.wordpress.com.
Follow on   Twitter

Comments and Discussions

 
QuestionThank You Pinmemberrindus19-Nov-12 3:01 
AnswerRe: Thank You PinmembermarkFaction19-Nov-12 6:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 18 Nov 2012
Article Copyright 2012 by Mark Sinnathamby
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid