Professional Documents
Culture Documents
Coordinate Systems
6.1 Introduction
In this chapter we revise Cartesian coordinates, axial systems, the distance between
two points in space, and the area of simple 2D shapes. It also covers polar, spherical
polar and cylindrical coordinate systems.
6.2 Background
Rene Descartes is often credited with the invention of the xy-plane, but the French
lawyer and mathematician Pierre de Fermat (1601-1665) was probably the first
inventor. In 1636 Fermat was working on a treatise titled Ad locus pianos et soli-
dos isagoge, which outlined what we now call "analytic geometry". Unfortunately,
Fermat never published his treatise, although he shared his ideas with other mathe-
maticians such as Blaise Pascal (1623-1662). At the same time, Descartes devised
his own system of analytic geometry and in 1637 published his results in the presti-
gious journal Geometric. In the eyes of the scientific world, the publication date of
a technical paper determines when a new idea or invention is released into the pub-
lic domain. Consequently, ever since this publication Descartes has been associated
with the xy-plane, which is why it is called the Cartesian plane.
The Cartesian plane is such a simple idea that it is strange that it took so long
to be discovered. However, although it is true that Rene Descartes showed how
an orthogonal coordinate system could be used for graphs and coordinate geometry,
coordinates had been used by ancient Egyptians, almost 2000 years earlier! If Fermat
had been more efficient in publishing his research results, the xy-plane could have
been called the Fermatian plane! (Boyer and Merzbach, 1989).
P(3, 2)
2-
~
- - -3 _i)
-, 0 'x
-
-,.
Q(-4 -2)
-J
The Cartesian plane provides a mechanism for locating points with a unique, ordered
pair of numbers (x, y) as shown in Fig. 6.1, where P has coordinates (3, 2) and Q has
coordinates (-4, -2). The point (0, 0) is called the origin. As previously mentioned,
Descartes suggested that the letters x and y should be used to represent variables,
and letters at the other end of the alphabet should stand for numbers. Which is why
equations such as y = ax2 +bx+ c, are written this way.
The axes are said to be oriented as the x-axis rotates anticlockwise towards the
y-axis. They could have been oriented in the opposite sense, with the y-axis rotating
anticlockwise towards the x-axis.
linear: y = mx + c,
quadratic: y = ax2 + bx + c,
cubic: y = ax3 + bx2 +ex+ d,
trigonometric: y = a sm x,
are drawn as graphs, they create familiar shapes that permit the function to be easily
identified. Linear functions are straight lines; quadratics are parabolas; cubics have
an "S" shape; and trigonometric functions often possess a wave-like trace. Figure6.2
shows examples of each type of function.
6.5 Shape Representation 97
quad atic
sinuso d
The Cartesian plane also provides a way to represent 2D shapes numerically, which
permits them to be manipulated mathematically. Let's begin with 2D polygons and
show how their internal area can be calculated.
6.5.1 2D Polygons
A polygon is formed from a chain of vertices (points) as shown in Fig. 6.3. A straight
line is assumed to connect each pair of neighbouring vertices; intermediate points
on the line are not explicitly stored. There is no convention for starting a chain
of vertices, but software will often dictate whether polygons have a clockwise or
anticlockwise vertex sequence.
(3, 2)
2
(I, I) (3, I)
2 3 4 5 X
98 6 Coordinate Systems
We can now subject this list of coordinates to a variety of arithmetic and mathe-
matical operations. For example, if we double the values of x and y and redraw the
vertices, we discover that the shape's geometric integrity is preserved, but its size
is doubled relative to the origin. Similarly, if we divide the values of x and y by 2,
the shape is still preserved, but its size is halved relative to the origin. On the other
hand, if we add 1 to every x-coordinate, and 2 to every y-coordinate, and redraw the
vertices, the shape's size remains the same but is displaced 1 unit horizontally and 2
units vertically.
The area of a polygonal shape is readily calculated from its list of coordinates. For
example, using the list of coordinates shown in Table 6.1: the area is computed by
1
area= + (x1y2 - x2y1) + (x2y3 + (x3yo - xoy3)].
2[(xoyi - xiyo) - x3y2)
You will observe that the calculation sums the results of multiplying an x by the
next y, minus the next x by the previous y. When the last vertex is selected, it is
paired with the first vertex to complete the process. The result is then halved to reveal
the area. As a simple test, let's apply this formula to the shape described in Fig. 6.3:
1
area= 2((1 x 1 - 3 x 1) + (3 x 2 - 3 x 1) + (3 x 3 - 1 x 2) + (1 x 1 - 1 x 3)]
1
area = -[-2
2
+ 3 + 7 - 2] = 3.
which, by inspection, is the true area. The beauty of this technique is that it works
with any number of vertices and any arbitrary shape.
Another feature of the technique is that if the set of coordinates is clockwise,
the area is negative, which means that the calculation computes vertex orientation as
well as area. To illustrate this feature, the original vertices are reversed to a clockwise
sequence as follows:
1
area= -[(l x 3 - 1 x 1) + (1 x 2 - 3 x 3) + (3 x 1 - 3 x 2) + (3 x 1 - 1 x 1)]
2
1
area= -[2 - 7 - 3 + 2] = -3.
2
The minus sign confirms that the vertices are in a clockwise sequence.
The theorem of Pythagoras is used to calculate the distance between two points.
Figure6.4 shows two arbitrary points P1 (x1, YI) and P2(x2, y2). The distance b.x =
x2 - x1 and b.y = y2 - YI. Therefore, the distanced between P1 and P2 is given by
d = ✓ (b.x)2 + (b.y)2.
For example, given P1 (1, 1), P2(4, 5), then d = J32 + 42 = 5.
Two coordinates are required to locate a point on the 2D Cartesian plane, and three
coordinates are required for 3D space. The corresponding axial system requires three
mutually perpendicular axes; however, there are two ways to add the extra z-axis.
Figure6.5 shows the two orientations, which are described as left- and right-handed
axial systems. The left-handed system permits us to align our left hand with the axes
such that the thumb aligns with the x-axis, the first finger aligns with the y-axis,
and the middle finger aligns with the z-axis. The right-handed system permits the
same system of alignment, but using our right hand. The choice between these axial
~y d
X
100 6 Coordinate Systems
(b) y
(a) y
z X
X z
z X ,. z X
systems is arbitrary, but one should be aware of the system employed by commercial
computer graphics packages. The main problem arises when projecting 3D points
onto a 2D plane, which has an oriented axial system. A right-handed system is
employed throughout this book, as shown in Fig. 6.6, which also shows a point P
with its coordinates. It also worth noting that handedness has no meaning in spaces
with 4 dimensions or more.
d = Jx2 + y2 + z2.
Polar coordinates are used for handling data containing angles, rather than linear
offsets. Figure6.7 shows the convention used for 2D polar coordinates, where the
point P(x, y) has equivalent polar coordinates P(p, 0), where:
x = p cos0
y = p sine
p = Jx2 + y2
0 = arc tan (y / x).
For example, the point Q(4, 0.8n) in Fig.6.7 has Cartesian coordinates:
x = 4 cos(0.8n) ~ -3.24
y = 4 sin(0.8n) ~ 2.35
-4 3 4 X
-2
-3
102 6 Coordinate Systems
p = J32 + 42 = 5
0 = arctan(4/3) ~ 53.13°.
These conversion formulae work only for the first quadrant. The atan2 function
should be used in a software environment, as it works with all four quadrants.
Figure6.8 shows one convention used for spherical polar coordinates, where the
point P(x, y, z) has equivalent polar coordinates P(p, ¢, 0), where:
x = p sin ¢ cos 0
y = p sin ¢ sin 0
z = p cos d:
P J
= x2 + y2 + 22
¢ = arccos(z/ p)
0 = arctan(y /x).
For example, the point (3, 4, 0) has spherical polar coordinates (5, 90°, 53 .13 °):
p = J32 + 42 + 02 = 5
<p = arccos(0/5) = 90°
0 = arctan(4/3) ~ 53.13°.
p I
,z
I
fa-----,--~-• y
/
.... : /,, X
------ ---- -- _-......, /
X
6.9 Spherical Polar Coordinates 103
Take great care when using spherical coordinates, as authors often swap </J with 0, as
well as the alignment of the Cartesian axes; not to mention using a left-handed axial
system in preference to a right-handed system!
Figure6.9 shows one convention used for cylindrical coordinates, where the point
P(x, y, z) has equivalent cylindrical coordinates P(p, 0, z), where
x = p cos0
y = p sin0
z=z
P = Jx2 + y2
0 = arctan ( i) .
For example, the point (3, 4, 6) has cylindrical coordinates (5, 53.13°, 6):
p = J32 + 4 2
= 5
0 = arctan ( i) ~ 5 3 .13 °
z = 6.
:z
-'<-------'-------+ y
e ', ,P' : , ,X'
' I /
----------~V
y
X
104 6 Coordinate Systems
Barycentric coordinates locate a point in space relative to existing points, rather than
to an origin, and are also known as local coordinates. The German mathematician
August Mobius (1790-1868) is credited with their invention.
Given two points in 2D space A(xa, Ya) and B(xb, Yb), an intermediate point
P(xp, Yp) has barycentric coordinates:
Xp = SXa + t xi,
Yp = SYa + tyb
1 = s + t.
Xp = r Xa + s Xb + t Xe
Yp = rv« + SYb + t y;
Zp = rza + SZb + tze
1 = r + s + t.
For example, whenr = 1, s = t = 0, then P =A.Similarly, whens= 1, r = t = 0,
then P = B. When r = s = t = 1/3, then Pis located at the triangle's centroid.
Homogeneous coordinates surfaced in the early 19th century where they were inde-
pendently proposed by Mobius, Feuerbach, Bobillier, and Plilcker. Homogeneous
coordinates, define a point in a plane using three coordinates instead of two. This
means that for a point (x, y) there exists a homogeneous point (xt, yt, t) where
t is an arbitrary number. For example, the point (3, 4) has homogeneous coordi-
nates (6, 8, 2), because 3 = 6/2 and 4 = 8/2. But the homogeneous point (6, 8, 2)
is not unique to (3, 4); (12, 16, 4), (15, 20, 5) and (300,400, 100) are all possible
homogeneous coordinates for (3, 4).
The reason why this coordinate system is called "homogeneous" is because it is
possible to transform functions such as f (x, y) into the form f (x / t, y / t) without
disturbing the degree of the curve. To the non-mathematician this may not seem
anything to get excited about, but in the field of projective geometry it is a very
powerful concept.
6.12 Homogeneous Coordinates 105
In 3D, a point (x, y, z) becomes (xt, yt, zt , t) and for may applications t = 1,
which seems a futile operation, but in matrix theory it is very useful, as we will
discover.
Compute the area and orientation of the shape defined by the coordinates in Table 6.2.
1
area= 2[(2 x 2 - 0 x 2) + (2 x 2 - 2 x 1) + (1 x 1 - 2 x 1) + (1 x 1 - 1 x 0)]
1
=2(4+2-1+1)
= 3.
Find the distance d12 between P1(1, 1) and P2(6, 7), and d34 between P3(1, 1, 1)
and P4(7, 8, 9).
Convert the 2D polar coordinates (3, n /2) to Cartesian form, and the point (4, 5) to
polar form.
y
106 6 Coordinate Systems
p=3
0 = n/2
x = p cos0 = 3 cos(n/2) = 0
y = psin0 = 3sin(n/2) = 3
x=4
y=5
p = Jx2 + y2 = J42 + 52 ~ 6.4
0 = arctan(y/x) = arctan(5/4) ~ 51.34°
Convert the spherical polar coordinates (10, n /2, 45°) to Cartesian form, and the
point (3, 4, 5) to spherical form.
p = 10
</J = n/2
0 = 45°
x = p sin </J cos 0 = 10 sin(n /2) cos 45° = 10✓2/2 ~ 7 .07
y = p sin </J sin 0 = 10 sin(n /2) sin 45° = 10✓2/2 ~ 7.07
z =peas¢= lOcos(n/2) = 0
x=3
y=4
z=5
P = Jx2 + y2 + z2 = J32 + 42 + 52 ~ 7.07
</J= arccos(z/ p) ~ arccos(5/7.07) = 45°
0 = arctan(y/x) = arctan(4/3) ~ 53.13°
Convert the 3D cylindrical coordinates (10, n /2, 5) to Cartesian form, and the point
(3, 4, 5) to cylindrical form.
p = 10
0 = n/2
z=5
x = pcos0 = lOcos(n/2) = 0
y = p sin 0 = 10 sin(n /2) = 10
z=5
Given A(xa, Ya, Za), B(xb, Yb, Zb) and C(xc, Ye, z-), state the barycentric coordi-
nates for A, B, C the points r.:
Pbc and Pea mid-way between AB, BC and CA
respectively, and the centroid Pc.
Table6.3 shows the barycentric coordinates for ABC.
7 .1 Introduction
When patterns of numbers or symbols occur over and over again, mathematicians
often devise a way to simplify their description and assign a name to them. For
example,
is shorthand for
and
is shorthand for