Assignment III

Due date first part: Tuesday October 9, 2001, second part: October 16, 2001.

```

The goal of this assignment is to develop a package to manipulate and
display simple geometric objects. We will deal with points, lines
paralel to the axes of coordinates (i,e, horizontal and vertical) and
rectangles whose sides are paralel to the axes. We also want to define
figures to be collections of rectangles and lines. Finally We want to
display several such objects, and highlight their intersections.

a) The types and their operations are declared in a package:

package Simple_Geometry is
type Point is ...       --  coordinates (2-dimensions)
type Line  is ...       --  unbounded
type Segment is ...     --  two end points
type Rectangle is ...   --  various possible representations.
type Figure is ...      --  an aggregate of several of the above.
...
function inside (P : Point; R : Rectangle) return Boolean;
...
procedure Display (F : Figure);
end Simple_Geometry;

b) The operations include: finding whether a point is within a given
rectangle, finding the points of intersection (if any) of a line
and a rectangle, finding the points of intersection of a segment
and a rectangle, and finding the area of intersection of two rectangles,
which is itself a rectangle.

c)  Finally, we want to display all the objects that we have created. For
this assignment we will just use text_io for display, so horizontal
lines will be displayed with dashes ----,  vertical lines with a vertical
bar |,  and intersections with an x.  The overlap of two rectangles
is displayed with an O  at all the common points. Corners of rectangles
look best if represented with a =.

=-----------=  |
|           |  |
|       =---x--x---=
|       |OOO|  |   |
|       |OOO|  |   |
=-------x---=  |   |
|      |   |
=------x---=
|

The first part of the assignment is to complete the package declaration
above: provide full type declarations, and add the functions and procedure
declarations for the intersection operations. The subprogram declarations
should include a few lines of comments, indicating in particular how you
deal with boundary conditions (two rectangles that touch at a point, a segment
that  ends on a side of a polygon, etc). The point is simply to make sure
you have specified all possible behaviors of these operations.

The second part of the assignment is to write the implementation of this
package, that is to say the contents of the corresponding package body.
```