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

t_point get_p1(t_rectangle r) {
	return r.p1;
}

t_point get_p2(t_rectangle r) {
	return r.p2;
}

double calculate_area(t_rectangle r) {
	return (fabs(r.p1.x-r.p2.x) *
		fabs(r.p1.y-r.p2.y));
		// You could access r.p1.x with get_x(get_p1(r)
}

double calculate_perimeter(t_rectangle r) {
	return (2 * (fabs(r.p1.x-r.p2.x) +
		     fabs(r.p1.y-r.p2.y)));
		// You could access r.p1.x with get_x(get_p1(r)
}

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

