#include <stdio.h>
#include <math.h>
#include "point.h"
#include "rectangle.h"

void print_rectangle(t_rectangle r) {
	printf("(");
	print_point(r.p1);
	printf(",");
	print_point(r.p2);
	printf(")");
}

double calculate_area(t_rectangle r) {
	return (fabs(r.p1.x-r.p2.x) *
		fabs(r.p1.y-r.p2.y));
}

double calculate_perimeter(t_rectangle r) {
	return (2 * (fabs(r.p1.x-r.p2.x) +
		     fabs(r.p1.y-r.p2.y)));
}

