Tuesday 26 February 2008

Cartesian Coordinate System

To talk about Cartesian coordinate, maybe most of us still remember what we have learnt during high school. Or perhaps what you remember is what you draw in a graph paper. The one we use in school is in 2-dimensional which has only 2 axes. The horizontal axis is called x-axis and the vertical axis is called y-axis. The point where these 2 axes cross together is called origin.

Figure 1: Cartesian coordinate system

A point in the coordinate system is represented by a coordinate pair (x, y). The x and y value represent the distances along each axis.

Those who have experience in gaming most probably has experience in 3-dimension as well. Cartesian coordinate system in 3D world needs another axis – z-axis. Z-axis is along side the line that passes through the screen to our eyes.

Figure 2: 3D coordinate system

To represent a line in 2D Cartesian, a function consist of variables can be introduced. In general, a straight line in x and y coordinate system can be represented by

y = mx + c

where y and x are the values represents the point while m is the gradient of the straight line and c is the y value where the straight line intercept to y-axis.

Example:

Figure 3: y = 3x + 2