#include "util.h"


sf::Vector2f getOverlap(const sf::FloatRect first, const sf::FloatRect second)
{
    const float deltaX = std::abs(second.position.x - first.position.x);
    const float deltaY = std::abs(second.position.y - first.position.y);

    const float resultX = (first.size.x + second.size.x) - deltaX;
    const float resultY = (first.size.y + second.size.y) - deltaY;
    return {resultX, resultY};
}

sf::Vector2f velocityInDirection(const float speed_in, const sf::Angle angle_in)
{
    return sf::Vector2f{speed_in * std::cos(angle_in.asRadians()), speed_in * std::sin(angle_in.asRadians())};
}