Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
66 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

Contents
 Introduction
 Page 2

 Printable version
 Discuss this article
 in the forums


The Series
 Introduction
 Vectors and Planes

Coordinate Systems

When we wish to define multi-dimensional space we use a coordinate system. There are several kinds of coordinate systems including the Polar coordinate system and the Cartesian coordinate system; we will be using the latter.

The Cartesian coordinate system consists of 1 or more dimensions, with each dimension being perpendicular to the others. The 2-D coordinate system represents flat rectangular space while the 3-D coordinate system represents a solid box. Obviously the Cartesian coordinate system we will be using will be the 3-D version. First up we have the x and y axii. The x-axis is the dimension, which points horizontally while the y-axis points vertically.


The X and Y coordinates which can represent 2-D space

Next we have the z-axis which is perpendicular to the x and y axii. We can have a z-axis which is positive when it increases into the screen this is called the left-hand system. We can also have a z coordinate which is negative when it increases into the screen, this is known as the right-hand system. We use the z-axis to define the depth of our world. In this series I will be using the left-hand system since the examples will be using Direct3D.


The left-hand coordinate system


The right-hand coordinate system

All our axii meets at a place called the origin. The origin coordinates are <0x, 0y, 0z>, but alas more on this later.

The Simple Primitive: Points

To reference a particular position in our coordinate system we can use points. We can define a point structure like this.

struct Point
{
     float x;
     float y;
     float z;
};

You will notice similarities with vectors when we get to them in the next article. But for now just remember that vectors hold several other interesting properties. Note that the point we defined is made up of 3 components x-width, y-height and z-depth.


Our left-handed coordinate system with a couple of points on it.

As you can see above we have our left-handed coordinate system with two points on it. If we imagine that the length of each axis is equal to 5.0. The big dot would be about < 3.5x, 1.0y, 0.0z >. And the little dot would be about < 1.0.x, 4.0y, 3.0z >. See that the little dot in the diagram is further up the z-axis ( perspective ).

The Last Word

Well that's it I'm afraid. I know it was short and fairly simple but hey folks, that was the aim of the game. You now know that we use a coordinate system to define the 3-D world we work in and that we can use points to measure the displacement of the point along the axii of the coordinate system. Next time I'll be explaining what a vector is and discussing the many things we can do with them. Until then….

Got any questions or suggestions feel free to e-mail me bully@gdnmail.net