#include "rectangle.h"

/* Are two rectangles colliding? */
bool
rectangle_collide_intersection(Rectangle* a, Rectangle* b, Rectangle* intersection)
{
	return SDL_IntersectFRect(a, b, intersection);
}

/* Are two rectangles colliding? */
bool
rectangle_collide(Rectangle* a, Rectangle* b)
{
	return SDL_HasIntersectionF(a, b);
}

/* Does the rectangle contain a point? */
bool
rectangle_has_point(Rectangle* self, vec2 point)
{
	SDL_FPoint sdlPoint;

	sdlPoint.x = point[0];
	sdlPoint.y = point[1];

	return SDL_PointInFRect(&sdlPoint, self);
}
