#define measure(a,b) a*b

typedef struct{
  coord bl;
  coord tr;
  double area;        /* =(tr.x-bl.x)*(tr.y-bl.y). */
}rect;

void calc_p(point *points,     /* Calculate p\_max and p\_min */
	    point *nextpoint,  /* for new point `nextpoint' */
	    double gamma1,     /* and existing points in `points' */
	    double gamma2,
	    double w1,
	    double w2,
	    double h1,
	    double h2,
	    double *p_max,
	    double *p_min
	    );

void count(point *p,void *arg); /* Use with applyinorder to count 
				   points */

void count_min(point *p,void *arg);/* Use with applyinorder to count 
				      points in the minimum process */

void makerectinorder(point *tree,  /* Traverses `tree' in order and */
		     rect *rects,  /* generates an array of `rect's */
		     int *counter, /* corresponding to the */
		     double width, /* rectangles centred at the */
		     double height /* points in `tree' with */
		     );            /* dimensions `width' by `height' */

void makerectinorder_min(point *tree,  /* Traverses `tree' in order */
			 rect *rects,  /* and generates an array of */
			 int *counter, /* `rect's corresponding to */
			 double width, /* the rectangles centred at */
			 double height /* the points in `tree' with */
			 );            /* dimensions `width' by */
                                       /*  `height' for those points */
				       /* which are in the min */
				       /* process */

double extra(rect *new,
	     rect old[],
	     int n_old,
	     int sign);

/* Return value of 0 means that the rectangles passed were 
   non-overlapping */
double overlap(rect *A,
	       rect *B,
	       rect *overlap);
