Click here to Skip to main content
15,886,860 members
Articles / STL

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

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
18 Nov 2012CPOL3 min read 12.5K   5   2
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).

Image 1

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 2

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.

Image 3 Image 4

License

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


Written By
Technical Lead Exilesoft
Sri Lanka Sri Lanka
Mark is a Technical Lead at Exilesoft, whose passion lies in coding, mentoring, and fueling technical innovation. In the past, he has worked as a developer for a product engineering company, an ERP/Technical Consultant in a Fortune 500 conglomerate, and also as a senior engineer for a startup in the manufacturing and design space. His current areas of research revolve around Enterprise Architecture, Big Data, NoSQL Technology, and Machine Learning.

In his spare time, Mark experiments with (computer) game design/development, operating system internals, and compiler design. He also discusses and blogs about various topics surrounding software development, computer science, game programming, and mathematics, which can be read at markfaction.wordpress.com. Feel free to email or message him anytime and strike up a conversation.

Comments and Discussions

 
QuestionThank You Pin
rpragyan19-Nov-12 3:01
rpragyan19-Nov-12 3:01 
AnswerRe: Thank You Pin
Mark Vinod Sinnathamby19-Nov-12 6:46
professionalMark Vinod Sinnathamby19-Nov-12 6:46 

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

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