< previous page page_553 next page >

Page 553
its area equals the following (see Figure 10-8):
(low + width/2.0)3 * width
The second rectangle has its left edge at the point where X equals
low + width
and its area equals the following (see Figure 10-9):
(low + width + width/2.0)3 * width
The left edge of each rectangle is at a point that is width greater than the left edge of the rectangle to its left. Thus, we can step through the rectangles by using a count-controlled loop with the number of iterations equal to the value of divisions. This loop contains a second counter (not the loop control variable) starting at low and counting by steps of width up to (high - width). Two counters are necessary because the second counter must be of type float, and it is poor programming technique to have a loop control
0553-01.gif
Figure 10-8
Area of the Leftmost Rectangle

 
< previous page page_553 next page >