# Problem Description
This is a geometric transformation problem where we need to:
1. Calculate the new position of a circle's center after rotation
2. The rotation occurs around a fixed point (green point)
3. The rotation angle is given in degrees (can be positive or negative)
4. The circle maintains its size and shape during transformation

# Visual Facts
1. The diagram shows two examples with different rotations:
   - Example 1: 90° (counterclockwise)
   - Example 2: -90° (clockwise)

2. Coordinate Points:
   - Green point coordinates: (3,5) in both examples
   - Red point coordinates: 
     - Example 1: starts at (3,3), ends at (5,5)
     - Example 2: starts at (5,5), ends at (3,3)

3. Grid Properties:
   - Both x and y axes range from 0 to 8
   - Grid lines are spaced at unit intervals

4. Visual Elements:
   - Red dot represents the circle's center
   - Green dot serves as the rotation pivot point
   - Circle maintains constant radius during rotation
   - Dotted lines show the rotation path

# Visual Patterns
1. Rotational Properties:
   - Positive angle (90°) results in counterclockwise rotation
   - Negative angle (-90°) results in clockwise rotation
   - The rotation preserves the distance between red and green points

2. Mathematical Patterns:
   - The radius of rotation equals the distance between red and green points
   - The rotation follows standard geometric rotation formulas around a pivot point
   - 90° rotation creates perpendicular lines between original and final positions

3. Transformation Rules:
   - The circle's shape and size remain unchanged during rotation
   - The transformation only affects the position of the circle's center
   - All points maintain their relative distances from the pivot point
   - The rotation arc length is proportional to the angle of rotation

4. Geometric Constraints:
   - The rotation occurs in a 2D plane
   - The pivot point (green) remains stationary
   - The transformation preserves the circle's geometric properties

# Solution
from typing import Tuple
import math

def solution(red: Tuple[float, float], angle: int, green: Tuple[float, float]) -> Tuple[float, float]:        
    """
    Calculate the new coordinates of a circle's center after applying the transformation.

    Args:
        red: A tuple (x, y) representing the coordinates of the red point.
        angle: The transformation parameter
        green: A tuple (x, y) representing the coordinates of the green point.

    Returns:
        A tuple (x, y) representing the transformed coordinates of the circle's center.
    """
    rx, ry = red
    gx, gy = green
    dx = rx - gx
    dy = ry - gy

    rad = math.radians(angle)

    rotated_x = dx * math.cos(rad) - dy * math.sin(rad)
    rotated_y = dx * math.sin(rad) + dy * math.cos(rad)

    new_x = rotated_x + gx
    new_y = rotated_y + gy

    return round(new_x, 2), round(new_y, 2)


# Test Script
def test():
    def tuples_almost_equal(t1, t2,  tol: float = 1e-2) -> bool:
        return all(abs(a - b) < tol for a, b in zip(t1, t2))

    test_cases = [
        {
            'red': (5.0, 5.0),
            'angle': 90,
            'green': (3.0, 5.0),
            'expected': (3.0, 7.0)
        },
        {
            'red': (5.0, 5.0),
            'angle': 180,
            'green': (3.0, 3.0),
            'expected': (1.0, 1.0)
        },
        {
            'red': (5.0, 5.0),
            'angle': 270,
            'green': (2.5, 5.0),
            'expected': (2.5, 2.5)
        },
        {
            'red': (1.0, 5.0),
            'angle': 45,
            'green': (3, 5.0),
            'expected': (1.59, 3.59)
        },
        {
            'red': (1, 1),
            'angle': 90,
            'green': (4, 4),
            'expected': (7.0, 1.0)
        },
        {
            'red': (0, 0),
            'angle': 90,
            'green': (100, 100),
            'expected': (200.0, 0.0)
        },
        {
            'red': (5.0, 5.0),
            'angle': -90,
            'green': (-5, -5),
            'expected': (5.0, -15.0)
        },
        {
            'red': (10.0, 5.0),
            'angle': -90,
            'green': (-5, -10),
            'expected': (10.0, -25.0)
        },
                {
            'red': (10.0, 5.0),
            'angle': 90,
            'green': (-5, -10),
            'expected': (-20.0, 5.0)
        },
                {
            'red': (10.0, 5.0),
            'angle': 180,
            'green': (-5, -10),
            'expected': (-20.0, -25.0)
        },
    ]

    for idx, test in enumerate(test_cases, start=1):
        try:
            result = solution(
                red=test['red'],
                angle=test['angle'],
                green=test['green']
            )
        except Exception as e:
            error_message = (
                f"An exception occurred while running the test case:\n"
                f"`red`: {test['red']}\n"
                f"`angle`: {test['angle']}\n"
                f"`green`: {test['green']}\n\n"
                f"Exception: '{str(e)}'"
            )
            assert False, error_message

        if not tuples_almost_equal(result, test['expected']):
            error_message = (
                f"The following Test Case failed:\n"
                f"`red`: {test['red']}\n"
                f"`angle`: {test['angle']}\n"
                f"`green`: {test['green']}\n\n"
                f"Actual Output: {result}\n"
                f"Expected Output: {test['expected']}"
            )
            assert False, error_message

test()