Coordinate SystemsWhen 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.
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.
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: PointsTo 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.
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 WordWell 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 |