# Mathematics for GIS Professionals

**INTERSECTION AT A MAP SHEET EDGE**

Using the coordinates of $A$ and $B$ as above with $A(1234.56, 2345.67)$ and $B(1296.32, 2417.38)$. We showed that

$$y = 1.161108 * x + 912.21$$

Now, if the edge of the map sheet is on a grid line $QP$ whose $x$ value is $xP= 1250$, then at that point $P$

$$yP = 1.161108 * 1250 + 912.21$$

$$= 2363.60$$

A computer-driven graphical plotter could be made to move from $A(1234.56,2345.67)$ to $P(1250.00, 2363.60)$. It would then stop plotting at the map sheet edge, clipping the line $AB$ at $P$.

Using the same numbers, then if $R$ has the same $x$ value as $B$ and $y$ value as $A$, then the distance

$$AR = x_B – x_A = 1296.32 – 1234.56 = 61.76$$

$$BR = y_B – y_A = 2417.38 – 2345.67 = 71.71$$

$$AQ = x_P – x_A = 1250.00 – 1234.56 = 15.44$$

Hence,

$$\frac{AQ}{AR} = \frac{15.44}{61.76} = 0.25 = s$$

$$QP = s * BR = 0.25 * 71.71 = 17.93$$ or

$$PQ = y_P – y_A = y_P – 2345.67 = 17.93$$

Hence, $$y_P = 2345.67 + 17.93 = 2363.60 $$

Once again the coordinates of $P$ are $(1250.00, 2363.60)$.

If we express the equation of the line through the two points $A(xA, yA) and B(xB, yB)$ in the form $$(y – y_A) = \frac{(y_B – y_A)}{(x_B – x_A)} * (x – x_A)$$

Then it is easy to test whether any point is above or below the line AB. To do so, take any point $C(xC, yC)$ and calculate $$y = y_A +\frac{(y_B – y_A)}{(x_B – x_A)}* (x_C – x_A) $$

**Points in Polygons**

If the answer is less than $yC$ then $C$ is above $AB$ and if it is greater, then $C$ lies below the line from $A$ to $B$. Simple tests like this are useful when determining if two points are on the same or opposite sides of a line. Such tests arise in hidden line and surface removal.

This also provides one way to test whether a point $P(xP, yP)$ lies within or outside a polygon. Consider the polygon $ABCDEF$ where the coordinates of $A$ are $(xA, yA)$, of $B$ are $(xB, yB)$, and so forth. First, one should check whether $xP$ lies between the maximum and minimum values of $x$ for the whole polygon, which in

**Equation of a plane**

We can extend the equation of a line to describe a plane. Consider the equation

$$z = mx + ny + c$$

For every fixed value of $y$ (for example, $y = d$),

$$z = mx + (nd + c) = mx + c’$$

where $c’ = nd + c$ and is a constant. This is the equation for a straight line in the plane $y = d$. Similarly, for every fixed value of $x$ we have a set of straight lines. If $z$ is regarded as the axis in the third dimension then $z = mx + ny + c$ must represent a plane surface.

**The intersection of two planes**

When two planes intersect we have equations of the form:

$z = m_1x + n_1y + c_1 $ and $z = m_2 x + n_2y + c_2$

Subtracting one equation from the other:

$$z – z = m_1x + n_1y + c_1 – (m_2 x + n_2y + c_2)$$

or

$$0 = m_1x + n_1y + c_1 – m_2 x – n_2y – c_2$$

Adding $n_2y$ to both sides of the equation:

$$n_2y = m_1x + n_1y + c_1 – m_2x – n_2y – c_2 + n_2y$$

Subtracting n1y from each side of the equation:

$$n_2y – n_1y = m_1x + n_1y + c_1 – m_2x – n_2y – c_2 + n_2y – n_1y $$

$$= m_1x + c_1 – m_2 x – c_2$$ or $$(n_2 – n_1)y = (m_1 – m_2)x + (c_1 – c_2)$$

Dividing both sides by $(n_2 – n_1)$

$$ y = {\frac{m_1-m_2}{n_2-n_1}}.{\frac{c_1-c_2}{n_2-n_1}}$$

Replacing $(\frac{(m_1 – m_2)}{(n_2 – n_1)})$ by $m$ and $+(\frac{(c_1 – c_2)}{(n_2 – n_1)})$ by $c$.The result is

$$y = mx + c$$

This has already been shown to be the equation of a straight line. Thus, two planes intersect in a straight line.