Before attacking our area problem let us take a short digression to consider some possible methods of computing areas. How long do you think it would take to calculate the area inside the polygon P of Figure2.7that started this chapter by any of the methods we have so far discussed?
The method we have already suggested for doing the computation would require us to break up P into the three triangles displayed in Figure2.4, com- pute the area of each, and then add up the three areas. But you would notice that none of the three triangles has a horizontal or vertical side. It would take
2.2. SOME METHODS OF CALCULATING AREAS 37
P
Figure 2.7: The polygon P and its triangulation
some calculating to determine the areas of these triangles. The methods of Sec- tion 2.1.6 would certainly work for each of these three triangles and so, in a reasonable amount of time, we could indeed compute the area of the polygon.
This is not impressive, however, and takes far longer than the 41 seconds that we claimed in our introduction. We should consider some other approaches.
2.2.1
An ancient Greek method
Let’s look at another method that dates back to the ancient Greeks. They devised a method2for approximating the area of any shaped region.
Figure 2.8: Too big and too small approximations
Figure 2.8 shows the polygon with some grid squares highlighted. If we count the grid squares that lie entirely inside P, and add up their areas, we have an approximation to the area inside P. This approximation is too small, because we have not counted the contributions of the squares that lie only partially inside P.
We could also obtain an approximation to the area that is too large by includ- ing the full areas of those squares that lie partially inside and partially outside P. The exact area is somewhere between these two approximations. If we do
2The ancient Greeks would not have used this method for finding areas of polygons. It would be used for circles and other figures that couldn’t be broken into triangles.
this for the polygon in Figure2.7, we find the two approximations are not that close to each other. This is so because there are so many grid squares, each of area 1, that are only partially inside P. the difference between counting them and not counting them is relatively large.
The method of exhaustion The two approximations will improve if we used smaller grid squares. They would improve again if we used even smaller grid squares.
Suppose each grid square were subdivided into 4 smaller squares and the process were repeated. Do you see that the excess of counting the partial squares is reduced, while the approximation obtained by not counting them is increased. In a more advanced course one could show that by using smaller and smaller squares, one can obtain the exact area using the theory of limits. The approxi- mations that are too small increase towards the area, while the approximations that are too big decrease towards the actual area.
How long do you think it would take to find the area of P using this method?
This method is sometimes called the method of exhaustion which refers to the fact that the area is exhausted by each step although, as you can well imagine, it might be the person doing the computations that is exhausted.
One wouldn’t actually have to compute all those approximating areas. A person well-versed with the limit process could obtain formulas for the approx- imating areas at an arbitrary stage of the subdividing process and could then calculate the limit. Still—not a quick process, probably slower than calculating the area by our first method.
2.2.2
Grid point credit—a new fast method?
Now for our purposes, the sizes of our squares are fixed – they all have area 1. To get an exact area we would have to calculate the exact areas of the parts of the partial squares that lie inside P.
Is there a connection between the number of grid points and the number of grid squares inside a grid polygon? Perhaps we can find a way of assigning “grid point credit” to grid points that mimics the approximations we discussed. Since we don’t have the option of reducing the size of grid squares, we seek a formula that gives an exact area, not one that requires some sort of limit. Perhaps we can do this by giving credit to points depending on their location inside the polygon. Let’s see if we can formulate a method of assigning full or partial credit to grid points.
If we were dealing with the whole plane, rather than with the inside of a polygon, we would note that every grid point is a corner point of four squares,
2.2. SOME METHODS OF CALCULATING AREAS 39 and every grid square had four grid points as corners. Thus one could count grid squares by counting grid points. Of course, we are not dealing with the whole plane, we are dealing with a polygon. But it does suggest a start.
Assigning credit When a grid point p is “well inside” the polygon, all four squares that have p as a corner are inside P. Let’s try giving full credit of 1 to such points.
What about other points? When only a certain part of the four squares that have the point as a corner lies inside P, we try giving that point proportional credit.
v
q
p
w
u
Figure 2.9: Polygon P with 5 special points and their associated squares Notice there are several grid points, such as the point q, on an edge of P, many grid points like p “well inside” P, points like w that are inside P but near an edge, vertices like v and points like u that are outside of P but near an edge.
In this simple figure, we see that only half of the area of the four squares that have q as a corner lies inside P. Let’s try half credit for q. You can check that the same is true of all grid points that are on an edge of P, except the vertices where a similar picture would suggest credit different from 1/2.
We have already determined that the point p deserves credit equal to 1 be- cause the four squares associated with p lie inside P.
At w the 4 associated squares appear to be more than half filled with points of P, so w should get more than 1/2 credit. The vertex v should receive more than 1/2 credit. Even points like u that are outside but near P deserve some credit. The exact amount of credit each of these grid points deserves has to be calculated.
We can do this type of calculation for all grid points inside, on, or near P, add up all the credits and get the exact area of P.
Is this useful or practical? This would be useful if there were a way of as- signing credit to grid points in a simple way, based only on their location. Points
well inside P, like p would get full credit, and all other points whose associated squares contain points inside P (like q, w, v and u) would get credit between 0 and 1, based on the percentage of the area of the four associated squares that lies inside P.
Will adding up all these credits give us the exact area? Yes, it will.
Is this practical? Is it easy? Would all grid points on an edge of a polygon (except vertices) deserve credit exactly 1/2? Look at Figure2.10.
T
Figure 2.10: A “skinny” triangle.
Here the point p is located on the boundary of the triangle T at (9,9). Our earlier example suggested that such a boundary point should receive credit 1/2. But less than half of the area of the four squares having the point p as a corner lies inside T . So this point p doesn’t deserve half credit after all: it deserve less. We’d have to do a calculation to determine the credit this point deserves, even though it lies on an edge of T . That would defeat our purpose of finding a simple and quick method of obtaining the area.
We see that just knowing the location of a point gives no immediate clue as to the proper credit, unless the point is well inside the polygon, or well outside it. A possibly messy calculation would be necessary to determine its proper credit.
How long do you think it would take to find the area of P using this method?
The answer is “Way too long.” The process would involve so much calcula- tion that for practical purposes it is useless.
Some other kind of credit? What now? We can give up the idea of assigning grid points credit. Or, we can keep that idea, but use what we have learned from our earlier experiments to find a way that does lead to a simple, practical method of calculating the area.
2.3. PICK CREDIT 41