/*
 * Faculty of Applied Science and Engineering, University of Toronto
 * CSC181: Introduction to Computer Programming, Fall 2000
 *
 * Assignment: 2
 * File: a2.c
 * Author: Ray Ortigas (rayo@dgp.toronto.edu)
 * Contains: Typedefs and function prototypes for A2.
 */

#define MAX_RECTANGLES (50)

typedef enum {false, true} boolean;

typedef struct {
	double x;
	double y;
} Point;

typedef struct {
	Point c;
	double w;
	double h;
} Rectangle;

typedef struct {
	Rectangle rectangles[MAX_RECTANGLES];
	int rectanglesSize;
} RectangleList;

Point pointInit(const double x, const double y);
double pointX(const Point p);
double pointY(const Point p);
boolean	pointAreEqual(const Point p1, const Point p2);
double pointDistanceBetween(const Point p1, const Point p2);

Rectangle rectangleInit(const Point c, const double w, const double h);
Point rectangleCentre(const Rectangle r);
double rectangleWidth(const Rectangle r);

double rectangleHeight(const Rectangle r);
boolean rectangleAreEqual(const Rectangle r1, const Rectangle r2);
Rectangle rectangleUnion(const Rectangle r1, const Rectangle r2);
Rectangle rectangleIntersection(const Rectangle r1, const Rectangle r2);
double rectangleArea(const Rectangle r);

RectangleList rectangleListInit(void);
int rectangleListSize(const RectangleList rl);
Rectangle rectangleListGet(const RectangleList rl, const int i);
RectangleList rectangleListAdd(const RectangleList rl, const Rectangle r);
RectangleList rectangleListSet
(const RectangleList rl, const Rectangle r, const int i);
RectangleList rectangleListSubList
(const RectangleList rl, const int a, const int b);
Rectangle rectangleListUnion(const RectangleList rl);
Rectangle rectangleListIntersection(const RectangleList rl);
double rectangleListArea
(const RectangleList rl, const boolean discountOverlap);
